From: pascale.noyret Date: Mon, 19 Jul 2021 10:01:51 +0000 (+0200) Subject: Maj Telemac2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=14f001d3469c876ec786c57877310a99d627019f;p=tools%2Feficas.git Maj Telemac2 --- diff --git a/Editeur/catadesc.py b/Editeur/catadesc.py index e0623af6..3a30d159 100644 --- a/Editeur/catadesc.py +++ b/Editeur/catadesc.py @@ -24,7 +24,7 @@ except : pass class CatalogDescription(object): def __init__(self, labelCode, fichierCata, formatFichierOut = "python", formatFichierIn='python', - default = False, code = None,ss_code=None,): + default = False, code = None,ssCode=None, selectable = True, userName=None): """ This class can be used to describe an Eficas catalog. @@ -43,8 +43,19 @@ class CatalogDescription(object): :type code: string :param code: Used to indicate the code associated to this catalog - :type ss_code: string - :param ss_code: scheme associated to this catalog (Map only) + :type ssCode: string + :param ssCode: scheme associated to this catalog (Map only) + + :type userName: string + :param userName: name of the catalog as it will appear in the list + + :type selectable: boolean + :param selectable: indicate if this catalog appears in the list. + Setting this parameter to False is useful to keep + old catalogs to edit existing files but to forbid + to use them to create new files. + + """ @@ -55,11 +66,26 @@ class CatalogDescription(object): self.formatFichierIn = formatFichierIn self.default = default self.code = code + self.ssCode = ssCode + if userName is None: + self.userName = labelCode + else: + self.userName = userName + self.selectable = selectable + @staticmethod def createFromTuple(cataTuple): #print "Warning: Describing a catalog with a tuple is deprecated. " \ # "Please create a CatalogDescription instance directly." + if cataTuple[0] == 'TELEMAC': + desc = CatalogDescription(code = cataTuple[0], + ssCode = cataTuple[1], + labelCode = cataTuple[0]+cataTuple[1], + fichierCata = cataTuple[2], + formatFichierOut = cataTuple[3], + formatFichierIn = cataTuple[4]) + return desc if cataTuple[0] == 'MAP' : desc = CatalogDescription(code = cataTuple[0], labelCode = cataTuple[1], diff --git a/InterfaceQT4/qtEficasSsIhm.py b/InterfaceQT4/qtEficasSsIhm.py index b72fa260..16ef61c5 100755 --- a/InterfaceQT4/qtEficasSsIhm.py +++ b/InterfaceQT4/qtEficasSsIhm.py @@ -40,7 +40,7 @@ class AppliSsIhm: """ Class implementing the main user interface. """ - def __init__(self,code=None,salome=1,parent=None,multi=False,langue='fr',ssIhm=True,labelCode=None,genereXSD=False,fichierCata=None): + def __init__(self,code=None,salome=1,parent=None,multi=False,langue='fr',ssIhm=True,labelCode=None,genereXSD=False,fichierCata=None,ssCode=None,versionCode=None): """ Constructor """ @@ -52,6 +52,8 @@ class AppliSsIhm: self.ssIhm=True self.code=code self.genereXSD=genereXSD + self.versionCode=versionCode + self.ssCode=ssCode self.dict_reels={} self.fichierIn=None diff --git a/InterfaceQT4/readercata.py b/InterfaceQT4/readercata.py index a2ee29fa..fad67e8b 100644 --- a/InterfaceQT4/readercata.py +++ b/InterfaceQT4/readercata.py @@ -101,13 +101,37 @@ class ReaderCataCommun(object): if isinstance(catalogue, CatalogDescription): listeTousLesCatas.append(catalogue) elif isinstance(catalogue, tuple) : listeTousLesCatas.append(CatalogDescription.createFromTuple(catalogue)) else: print(("Catalog description cannot be interpreted: ", catalogue)) + + if self.labelCode is None: listeCataPossibles = listeTousLesCatas + else : + for catalogue in listeTousLesCatas: + if catalogue.code == self.code and catalogue.ssCode == self.ssCode: + listeCataPossibles.append(catalogue) + + if len(listeCataPossibles)==0: + try : + QMessageBox.critical(self.QWParent, tr("Import du catalogue"), + tr("Pas de catalogue defini pour le code ") + self.code) + except : + print("Pas de catalogue defini pour le code " + self.code) + if self.appliEficas.salome == 0 : sys.exit(1) + self.appliEficas.close() + return - # This filter is only useful for codes that have subcodes (like MAP). - # Otherwise, the "code" attribute of the catalog description can (should) be None. - if self.ssCode is None: listeCataPossibles = listeTousLesCatas + if self.labelCode is not None: + # La version a ete fixee + for cata in listeCataPossibles: + if self.labelCode == cata.identifier: + self.fichierCata = cata.fichierCata + self.labelCode = cata.labelCode + self.appliEficas.formatFichierOut = cata.formatFichierOut + self.appliEficas.formatFichierIn = cata.formatFichierIn else: - for catalogue in listeTousLesCatas: - if catalogue.code == self.code and catalogue.ssCode == self.ssCode: listeCataPossibles.append(catalogue) + cataChoiceList = [] + for cata in listeCataPossibles: + if cata.selectable: + if cata.default : cataChoiceList.insert(0, cata) + else : cataChoiceList.append(cata) # le catalogue est fixe dans la ligne de commande if self.appliEficas.fichierCata != None : diff --git a/generator/generator_aplat.py b/generator/generator_aplat.py index 44569df3..284d4a83 100644 --- a/generator/generator_aplat.py +++ b/generator/generator_aplat.py @@ -62,7 +62,7 @@ class AplatGenerator(object): generator.gener(objet_jdc,format) L'ecriture du fichier au format ini par appel de la methode - generator.writefile(nom_fichier) + generator.writeFile(nom_fichier) Ses caracteristiques principales sont exposees dans des attributs de classe : @@ -85,7 +85,7 @@ class AplatGenerator(object): # Le texte au format aplat est stocke dans l'attribut text self.text='' - def writefile(self,filename): + def writeFile(self,filename): fp=open(filename,'w') fp.write(self.text) fp.close()