From b4ec54a708ac4f11e9c710edd09219849ebf3242 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Wed, 15 Mar 2017 15:38:50 +0100 Subject: [PATCH] Updating translations and version conversions --- configure.ac | 1 + doc/en/advanced.rst | 21 ++++ doc/fr/advanced.rst | 22 ++++ i18n/Makefile.am | 28 +++++ i18n/adao_en.qm | Bin 0 -> 229 bytes i18n/adao_fr.qm | Bin 0 -> 241 bytes src/daComposant/daCore/BasicObjects.py | 4 +- src/daEficas/Makefile.am | 17 +-- src/daEficas/prefs_ADAO.py.in | 14 ++- ...V8_2_0.py => traduitADAOV7_4_0ToV8_3_0.py} | 2 +- ...V8_2_0.py => traduitADAOV7_5_0ToV8_3_0.py} | 2 +- ...V8_2_0.py => traduitADAOV7_5_1ToV8_3_0.py} | 2 +- ...V8_2_0.py => traduitADAOV7_6_0ToV8_3_0.py} | 2 +- ...V8_2_0.py => traduitADAOV7_7_0ToV8_3_0.py} | 2 +- ...V8_2_0.py => traduitADAOV7_8_0ToV8_3_0.py} | 2 +- ...V8_2_0.py => traduitADAOV8_1_0ToV8_3_0.py} | 2 +- src/daEficas/traduitADAOV8_2_0ToV8_3_0.py | 98 ++++++++++++++++++ ...ToV8_2_0.py => traduitADAOsansToV8_3_0.py} | 2 +- 18 files changed, 200 insertions(+), 21 deletions(-) create mode 100644 i18n/Makefile.am create mode 100644 i18n/adao_en.qm create mode 100644 i18n/adao_fr.qm rename src/daEficas/{traduitADAOV7_4_0ToV8_2_0.py => traduitADAOV7_4_0ToV8_3_0.py} (99%) rename src/daEficas/{traduitADAOV7_5_0ToV8_2_0.py => traduitADAOV7_5_0ToV8_3_0.py} (99%) rename src/daEficas/{traduitADAOV7_5_1ToV8_2_0.py => traduitADAOV7_5_1ToV8_3_0.py} (99%) rename src/daEficas/{traduitADAOV7_7_0ToV8_2_0.py => traduitADAOV7_6_0ToV8_3_0.py} (99%) rename src/daEficas/{traduitADAOV7_8_0ToV8_2_0.py => traduitADAOV7_7_0ToV8_3_0.py} (99%) rename src/daEficas/{traduitADAOV8_1_0ToV8_2_0.py => traduitADAOV7_8_0ToV8_3_0.py} (99%) rename src/daEficas/{traduitADAOV7_6_0ToV8_2_0.py => traduitADAOV8_1_0ToV8_3_0.py} (99%) create mode 100644 src/daEficas/traduitADAOV8_2_0ToV8_3_0.py rename src/daEficas/{traduitADAOsansToV8_2_0.py => traduitADAOsansToV8_3_0.py} (99%) diff --git a/configure.ac b/configure.ac index e2bb3c4..483d278 100644 --- a/configure.ac +++ b/configure.ac @@ -145,5 +145,6 @@ AC_CONFIG_FILES([ doc/en/Makefile doc/fr/Makefile test/Makefile + i18n/Makefile ]) AC_OUTPUT diff --git a/doc/en/advanced.rst b/doc/en/advanced.rst index fe6b5dc..4a20a4f 100644 --- a/doc/en/advanced.rst +++ b/doc/en/advanced.rst @@ -434,6 +434,27 @@ There is no known incompatibility for the ADAO case files. The upgrade procedure is to read the old ADAO case file with the new SALOME/ADAO module, and save it with a new name. +To make future developments easier, it is strongly recommended to ensure that +your user scripts files use a Python 2 and a Python 3 compatible syntax. In +particular, it is recommended to use the functional syntax for "*print*" and not +the "*command*" syntax, for example: + + # Python 2 & 3 + x, unit = 1., "cm" + print( "x = %s %s"%(str(x),str(unit)) ) + +or:: + + # Python 2 & 3 + x, unit = 1., "cm" + print( "x = {0} {1}".format(str(x),str(unit)) ) + +rather than:: + + # Python 2 only + x, unit = 1., "cm" + print "x =", x, unit + Switching from 7.8 to 8.1 +++++++++++++++++++++++++ diff --git a/doc/fr/advanced.rst b/doc/fr/advanced.rst index 59a6175..0600f88 100644 --- a/doc/fr/advanced.rst +++ b/doc/fr/advanced.rst @@ -457,6 +457,28 @@ Il n'y a pas d'incompatibilit procédure de montée en version consiste à lire l'ancien fichier de cas ADAO avec le nouveau module SALOME/ADAO, et à l'enregistrer avec un nouveau nom. +Pour faciliter les futures évolutions, il est fortement recommandé de veiller à +ce que vos fichiers scripts utilisateurs utilisent une syntaxe compatibible avec +Python 2 et avec Python 3. En particulier, on recommande d'utiliser la syntaxe +fonctionnelle pour les "*print*" et non pas la syntaxe "*commande*", comme par +exemple:: + + # Python 2 & 3 + x, unit = 1., "cm" + print( "x = %s %s"%(str(x),str(unit)) ) + +ou:: + + # Python 2 & 3 + x, unit = 1., "cm" + print( "x = {0} {1}".format(str(x),str(unit)) ) + +plutôt que:: + + # Python 2 uniquement + x, unit = 1., "cm" + print "x =", x, unit + Passer de la version 7.8 à la 8.1 +++++++++++++++++++++++++++++++++ diff --git a/i18n/Makefile.am b/i18n/Makefile.am new file mode 100644 index 0000000..8890991 --- /dev/null +++ b/i18n/Makefile.am @@ -0,0 +1,28 @@ +# Copyright (C) 2008-2017 EDF R&D +# +# This file is part of SALOME ADAO module +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D + +include $(top_srcdir)/adm_local/make_common_starter.am + +DATA_INST = adao_en.qm adao_fr.qm + +salomeres_DATA = ${DATA_INST} +EXTRA_DIST = ${DATA_INST} diff --git a/i18n/adao_en.qm b/i18n/adao_en.qm new file mode 100644 index 0000000000000000000000000000000000000000..2813893f17cec34c9454b6eac9034979082d3024 GIT binary patch literal 229 zcmcE7ks@*G{hX<16=n7(EZlq7iGhJZfbo9vNg!RwrIx!ANHb&t@fKzv;l$v=kjPL1 z#0o%M41}2sxj>u)7R_YHXUGG}4Rr z2Zw~ZM6v^gIUG__(-KQ_N*F;FN-%^mqyml0WJm+zWGu$;IeWM|dwcr1V>6-yXao}@ FBLFh}Pz;2b z47os@!;r{O0;Ka9@)#5tQW#RfB#4*C@Dj)?2J-V6O2K3SSS3hTF+vvy$Z$3w7IF*@ z_Vo4iaSZYF_lpk>33Z8N2MTjIq@<=LmgbZ&f-IL{2m=~h1T-QIh?B7x!{_Yb>g?_5 O=Z?*Y4xkZC%!~jO*)($i literal 0 HcmV?d00001 diff --git a/src/daComposant/daCore/BasicObjects.py b/src/daComposant/daCore/BasicObjects.py index a53a9d2..f86fc82 100644 --- a/src/daComposant/daCore/BasicObjects.py +++ b/src/daComposant/daCore/BasicObjects.py @@ -359,7 +359,7 @@ class Algorithm(object): def _pre_run(self, Parameters ): "Pré-calcul" logging.debug("%s Lancement", self._name) - logging.debug("%s Taille mémoire utilisée de %.1f Mio", self._name, self._m.getUsedMemory("Mio")) + logging.debug("%s Taille mémoire utilisée de %.0f Mio", self._name, self._m.getUsedMemory("Mio")) # # Mise a jour de self._parameters avec Parameters self.__setParameters(Parameters) @@ -403,7 +403,7 @@ class Algorithm(object): if _oH is not None: logging.debug("%s Nombre d'évaluation(s) de l'opérateur d'observation direct/tangent/adjoint.: %i/%i/%i", self._name, _oH["Direct"].nbcalls(0),_oH["Tangent"].nbcalls(0),_oH["Adjoint"].nbcalls(0)) logging.debug("%s Nombre d'appels au cache d'opérateur d'observation direct/tangent/adjoint..: %i/%i/%i", self._name, _oH["Direct"].nbcalls(3),_oH["Tangent"].nbcalls(3),_oH["Adjoint"].nbcalls(3)) - logging.debug("%s Taille mémoire utilisée de %.1f Mio", self._name, self._m.getUsedMemory("Mio")) + logging.debug("%s Taille mémoire utilisée de %.0f Mio", self._name, self._m.getUsedMemory("Mio")) logging.debug("%s Terminé", self._name) return 0 diff --git a/src/daEficas/Makefile.am b/src/daEficas/Makefile.am index 1c529b6..32a14e1 100644 --- a/src/daEficas/Makefile.am +++ b/src/daEficas/Makefile.am @@ -32,13 +32,14 @@ mypkgpython_PYTHON = \ __init__.py \ prefs_ADAO.py \ prefs.py \ - traduitADAOsansToV8_2_0.py \ - traduitADAOV7_4_0ToV8_2_0.py \ - traduitADAOV7_5_0ToV8_2_0.py \ - traduitADAOV7_5_1ToV8_2_0.py \ - traduitADAOV7_6_0ToV8_2_0.py \ - traduitADAOV7_7_0ToV8_2_0.py \ - traduitADAOV7_8_0ToV8_2_0.py \ - traduitADAOV8_1_0ToV8_2_0.py + traduitADAOsansToV8_3_0.py \ + traduitADAOV7_4_0ToV8_3_0.py \ + traduitADAOV7_5_0ToV8_3_0.py \ + traduitADAOV7_5_1ToV8_3_0.py \ + traduitADAOV7_6_0ToV8_3_0.py \ + traduitADAOV7_7_0ToV8_3_0.py \ + traduitADAOV7_8_0ToV8_3_0.py \ + traduitADAOV8_1_0ToV8_3_0.py \ + traduitADAOV8_2_0ToV8_3_0.py EXTRA_DIST = prefs_ADAO.py.in diff --git a/src/daEficas/prefs_ADAO.py.in b/src/daEficas/prefs_ADAO.py.in index 2335a8a..9f599f0 100644 --- a/src/daEficas/prefs_ADAO.py.in +++ b/src/daEficas/prefs_ADAO.py.in @@ -29,18 +29,26 @@ import os, sys # Configuration de Eficas # ======================= # -# INSTALLDIR, REPINI est obligatoire +# INSTALLDIR, repIni est obligatoire INSTALLDIR = "@EFICAS_DIR@" sys.path.insert(0,INSTALLDIR) -# positionnee a repin au debut mise a jour dans configuration +# +# Positionnee a repin au debut, mise a jour dans configuration repIni=os.path.dirname(os.path.abspath(__file__)) # # Sert comme directory initial des QFileDialog initialdir=os.environ["PWD"] # # Traductions et codages +# # Codage des strings qui accepte les accents (en remplacement de 'ascii') -encoding='iso-8859-1' +# encoding='iso-8859-1' +# ===== Specifique : pour la 8_3_0 et suivantes 8_x ! Enlever pour les 9_x ! +import sys +reload(sys) +sys.setdefaultencoding('latin1') +# ===== Fin specifique ===================================================== +# # Indique la langue du catalogue utilisee pour les chaines d'aide : fr ou ang # lang='fr' # Traduction des labels de boutons ou autres diff --git a/src/daEficas/traduitADAOV7_4_0ToV8_2_0.py b/src/daEficas/traduitADAOV7_4_0ToV8_3_0.py similarity index 99% rename from src/daEficas/traduitADAOV7_4_0ToV8_2_0.py rename to src/daEficas/traduitADAOV7_4_0ToV8_3_0.py index 7297cb3..b834a83 100644 --- a/src/daEficas/traduitADAOV7_4_0ToV8_2_0.py +++ b/src/daEficas/traduitADAOV7_4_0ToV8_3_0.py @@ -32,7 +32,7 @@ from Traducteur.inseremocle import * from Traducteur.movemocle import * from Traducteur.renamemocle import * -version_out = "V8_2_0" +version_out = "V8_3_0" usage="""Usage: python %prog [options] diff --git a/src/daEficas/traduitADAOV7_5_0ToV8_2_0.py b/src/daEficas/traduitADAOV7_5_0ToV8_3_0.py similarity index 99% rename from src/daEficas/traduitADAOV7_5_0ToV8_2_0.py rename to src/daEficas/traduitADAOV7_5_0ToV8_3_0.py index 7297cb3..b834a83 100644 --- a/src/daEficas/traduitADAOV7_5_0ToV8_2_0.py +++ b/src/daEficas/traduitADAOV7_5_0ToV8_3_0.py @@ -32,7 +32,7 @@ from Traducteur.inseremocle import * from Traducteur.movemocle import * from Traducteur.renamemocle import * -version_out = "V8_2_0" +version_out = "V8_3_0" usage="""Usage: python %prog [options] diff --git a/src/daEficas/traduitADAOV7_5_1ToV8_2_0.py b/src/daEficas/traduitADAOV7_5_1ToV8_3_0.py similarity index 99% rename from src/daEficas/traduitADAOV7_5_1ToV8_2_0.py rename to src/daEficas/traduitADAOV7_5_1ToV8_3_0.py index 7297cb3..b834a83 100644 --- a/src/daEficas/traduitADAOV7_5_1ToV8_2_0.py +++ b/src/daEficas/traduitADAOV7_5_1ToV8_3_0.py @@ -32,7 +32,7 @@ from Traducteur.inseremocle import * from Traducteur.movemocle import * from Traducteur.renamemocle import * -version_out = "V8_2_0" +version_out = "V8_3_0" usage="""Usage: python %prog [options] diff --git a/src/daEficas/traduitADAOV7_7_0ToV8_2_0.py b/src/daEficas/traduitADAOV7_6_0ToV8_3_0.py similarity index 99% rename from src/daEficas/traduitADAOV7_7_0ToV8_2_0.py rename to src/daEficas/traduitADAOV7_6_0ToV8_3_0.py index d3422a0..8a5d3d1 100644 --- a/src/daEficas/traduitADAOV7_7_0ToV8_2_0.py +++ b/src/daEficas/traduitADAOV7_6_0ToV8_3_0.py @@ -32,7 +32,7 @@ from Traducteur.inseremocle import * from Traducteur.movemocle import * from Traducteur.renamemocle import * -version_out = "V8_2_0" +version_out = "V8_3_0" usage="""Usage: python %prog [options] diff --git a/src/daEficas/traduitADAOV7_8_0ToV8_2_0.py b/src/daEficas/traduitADAOV7_7_0ToV8_3_0.py similarity index 99% rename from src/daEficas/traduitADAOV7_8_0ToV8_2_0.py rename to src/daEficas/traduitADAOV7_7_0ToV8_3_0.py index d3422a0..8a5d3d1 100644 --- a/src/daEficas/traduitADAOV7_8_0ToV8_2_0.py +++ b/src/daEficas/traduitADAOV7_7_0ToV8_3_0.py @@ -32,7 +32,7 @@ from Traducteur.inseremocle import * from Traducteur.movemocle import * from Traducteur.renamemocle import * -version_out = "V8_2_0" +version_out = "V8_3_0" usage="""Usage: python %prog [options] diff --git a/src/daEficas/traduitADAOV8_1_0ToV8_2_0.py b/src/daEficas/traduitADAOV7_8_0ToV8_3_0.py similarity index 99% rename from src/daEficas/traduitADAOV8_1_0ToV8_2_0.py rename to src/daEficas/traduitADAOV7_8_0ToV8_3_0.py index d3422a0..8a5d3d1 100644 --- a/src/daEficas/traduitADAOV8_1_0ToV8_2_0.py +++ b/src/daEficas/traduitADAOV7_8_0ToV8_3_0.py @@ -32,7 +32,7 @@ from Traducteur.inseremocle import * from Traducteur.movemocle import * from Traducteur.renamemocle import * -version_out = "V8_2_0" +version_out = "V8_3_0" usage="""Usage: python %prog [options] diff --git a/src/daEficas/traduitADAOV7_6_0ToV8_2_0.py b/src/daEficas/traduitADAOV8_1_0ToV8_3_0.py similarity index 99% rename from src/daEficas/traduitADAOV7_6_0ToV8_2_0.py rename to src/daEficas/traduitADAOV8_1_0ToV8_3_0.py index d3422a0..8a5d3d1 100644 --- a/src/daEficas/traduitADAOV7_6_0ToV8_2_0.py +++ b/src/daEficas/traduitADAOV8_1_0ToV8_3_0.py @@ -32,7 +32,7 @@ from Traducteur.inseremocle import * from Traducteur.movemocle import * from Traducteur.renamemocle import * -version_out = "V8_2_0" +version_out = "V8_3_0" usage="""Usage: python %prog [options] diff --git a/src/daEficas/traduitADAOV8_2_0ToV8_3_0.py b/src/daEficas/traduitADAOV8_2_0ToV8_3_0.py new file mode 100644 index 0000000..8a5d3d1 --- /dev/null +++ b/src/daEficas/traduitADAOV8_2_0ToV8_3_0.py @@ -0,0 +1,98 @@ +#-*-coding:iso-8859-1-*- +# +# Copyright (C) 2008-2017 EDF R&D +# +# This file is part of SALOME ADAO module +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D + +import optparse +import sys +import re + +import Traducteur.log as log +from Traducteur.load import getJDC, getJDCFromTexte +from Traducteur.mocles import parseKeywords +from Traducteur.dictErreurs import GenereErreurPourCommande +from Traducteur.inseremocle import * +from Traducteur.movemocle import * +from Traducteur.renamemocle import * + +version_out = "V8_3_0" + +usage="""Usage: python %prog [options] + +Typical use is: + python %prog --infile=xxxx.comm --outfile=yyyy.comm""" + +atraiter = ( + ) + +dict_erreurs = { + } + +sys.dict_erreurs=dict_erreurs + +def traduc(infile=None,outfile=None,texte=None,flog=None): + hdlr = log.initialise(flog) + if infile is not None: + jdc = getJDC(infile,atraiter) + elif texte is not None: + jdc = getJDCFromTexte(texte,atraiter) + else: + raise ValueError("Traduction du JDC impossible") + # ========================================================================== + + + # ========================================================================== + fsrc = jdc.getSource() + fsrc = re.sub( "#VERSION_CATALOGUE:.*:FIN VERSION_CATALOGUE", "#VERSION_CATALOGUE:%s:FIN VERSION_CATALOGUE"%version_out, fsrc) + fsrc = re.sub( "#CHECKSUM.*FIN CHECKSUM", "", fsrc ) + # + log.ferme(hdlr) + if outfile is not None: + f=open(outfile,'w') + f.write( fsrc ) + f.close() + else: + return fsrc + +class MonTraducteur: + def __init__(self,texte): + self.__texte = str(texte) + def traduit(self): + return traduc(infile=None,outfile=None,texte=self.__texte,flog=None) + +def main(): + parser = optparse.OptionParser(usage=usage) + + parser.add_option('-i','--infile', dest="infile", + help="Le fichier COMM en entree, a traduire") + parser.add_option('-o','--outfile', dest="outfile", default='out.comm', + help="Le fichier COMM en sortie, traduit") + + options, args = parser.parse_args() + if len(options.infile) == 0: + print + parser.print_help() + print + sys.exit(1) + + traduc(options.infile,options.outfile) + +if __name__ == '__main__': + main() diff --git a/src/daEficas/traduitADAOsansToV8_2_0.py b/src/daEficas/traduitADAOsansToV8_3_0.py similarity index 99% rename from src/daEficas/traduitADAOsansToV8_2_0.py rename to src/daEficas/traduitADAOsansToV8_3_0.py index 7297cb3..b834a83 100644 --- a/src/daEficas/traduitADAOsansToV8_2_0.py +++ b/src/daEficas/traduitADAOsansToV8_3_0.py @@ -32,7 +32,7 @@ from Traducteur.inseremocle import * from Traducteur.movemocle import * from Traducteur.renamemocle import * -version_out = "V8_2_0" +version_out = "V8_3_0" usage="""Usage: python %prog [options] -- 2.39.2