From 11b50bf9936897c6e7844588c1947d544d0902a1 Mon Sep 17 00:00:00 2001 From: Yoann Audouin Date: Wed, 7 Jul 2021 08:22:01 +0200 Subject: [PATCH] Further corrections for Telemac --- Editeur/catadesc.py | 29 +++++++++++++++++++---------- InterfaceQT4/editorSsIhm.py | 7 ++++--- InterfaceQT4/readercata.py | 22 +++++++++++++--------- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/Editeur/catadesc.py b/Editeur/catadesc.py index d99e1c3b..2f43cc37 100644 --- a/Editeur/catadesc.py +++ b/Editeur/catadesc.py @@ -65,6 +65,7 @@ class CatalogDescription(object): self.file_format = file_format self.default = default self.code = code + self.ssCode = ss_code if user_name is None: self.user_name = identifier else: @@ -76,14 +77,22 @@ class CatalogDescription(object): def create_from_tuple(cata_tuple): #print "Warning: Describing a catalog with a tuple is deprecated. " \ # "Please create a CatalogDescription instance directly." - desc = CatalogDescription(code = cata_tuple[0], - identifier = cata_tuple[1], - cata_file_path = cata_tuple[2], - file_format = cata_tuple[3]) - - if len(cata_tuple) == 5: - if cata_tuple[4] == "defaut": - desc.default = True - else: - desc.file_format_in = cata_tuple[4] + if cata_tuple[0] == 'TELEMAC': + desc = CatalogDescription(code = cata_tuple[0], + ss_code = cata_tuple[1], + identifier = cata_tuple[0]+cata_tuple[1], + cata_file_path = cata_tuple[2], + file_format = cata_tuple[3], + file_format_in = cata_tuple[4]) + else: + desc = CatalogDescription(code = cata_tuple[0], + identifier = cata_tuple[1], + cata_file_path = cata_tuple[2], + file_format = cata_tuple[3]) + + if len(cata_tuple) == 5: + if cata_tuple[4] == "defaut": + desc.default = True + else: + desc.file_format_in = cata_tuple[4] return desc diff --git a/InterfaceQT4/editorSsIhm.py b/InterfaceQT4/editorSsIhm.py index d6b507c0..84ec478f 100644 --- a/InterfaceQT4/editorSsIhm.py +++ b/InterfaceQT4/editorSsIhm.py @@ -636,9 +636,10 @@ class JDCEditorSsIhm : except : ok=0 if not ok : - QMessageBox.information( self, - tr("Import texte"), - tr("Impossible d importer le texte")) + self.afficheInfos("Impossible d importer le texte") + #QMessageBox.information( self, + # tr("Import texte"), + # tr("Impossible d importer le texte")) self.tree.racine.build_children() return ok diff --git a/InterfaceQT4/readercata.py b/InterfaceQT4/readercata.py index 14b3811a..ba8ea4bb 100644 --- a/InterfaceQT4/readercata.py +++ b/InterfaceQT4/readercata.py @@ -106,12 +106,14 @@ class ReaderCataCommun(object): if self.ssCode is None: liste_cata_possibles = all_cata_list else: for catalogue in all_cata_list: - if catalogue.code == self.code and catalogue.file_format == self.ssCode: liste_cata_possibles.append(catalogue) + if catalogue.code == self.code and catalogue.ssCode == self.ssCode: + liste_cata_possibles.append(catalogue) if len(liste_cata_possibles)==0: - QMessageBox.critical(self.QWParent, tr("Import du catalogue"), - tr("Pas de catalogue defini pour le code ") + self.code) - self.appliEficas.close() + print("Pas de catalogue defini pour le code " + self.code) + #QMessageBox.critical(self.QWParent, tr("Import du catalogue"), + # tr("Pas de catalogue defini pour le code ") + self.code) + #self.appliEficas.close() if self.appliEficas.salome == 0 : sys.exit(1) return @@ -131,9 +133,10 @@ class ReaderCataCommun(object): else : cata_choice_list.append(cata) if len(cata_choice_list) == 0: - QMessageBox.critical(self.QWParent, tr("Import du catalogue"), - tr("Aucun catalogue trouve")) - self.appliEficas.close() + print("Aucun catalogue trouve") + #QMessageBox.critical(self.QWParent, tr("Import du catalogue"), + # tr("Aucun catalogue trouve")) + #self.appliEficas.close() if self.appliEficas.salome == 0 : sys.exit(1) elif len(cata_choice_list) == 1: @@ -153,7 +156,7 @@ class ReaderCataCommun(object): print(("Pas de catalogue pour code %s, version %s" %(self.code,self.versionCode))) sys.exit(1) else : - self.appliEficas.close() + #self.appliEficas.close() return @@ -204,7 +207,8 @@ class ReaderCata (ReaderCataCommun): self.cata = self.importCata(self.fic_cata) self.cata.modeleMetier = modeleMetier if not self.cata : - QMessageBox.critical( self.QWParent, tr("Import du catalogue"),tr("Impossible d'importer le catalogue ")+ self.fic_cata) + print("Impossible d'importer le catalogue "+ self.fic_cata) + #QMessageBox.critical( self.QWParent, tr("Import du catalogue"),tr("Impossible d'importer le catalogue ")+ self.fic_cata) self.appliEficas.close() if self.appliEficas.salome == 0 : sys.exit(1) -- 2.39.2