X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=InterfaceQT4%2Freadercata.py;h=fc85ae5e8a15854eb93b6c1146b6e922c50a9b58;hb=85a54835fdf72846be5f2df5bff13cbb5234b7a3;hp=d94400835c73d43b88a48c47317941512ca006e0;hpb=42895950e564e837c445896b5bac263370bdf37b;p=tools%2Feficas.git diff --git a/InterfaceQT4/readercata.py b/InterfaceQT4/readercata.py index d9440083..fc85ae5e 100644 --- a/InterfaceQT4/readercata.py +++ b/InterfaceQT4/readercata.py @@ -44,7 +44,7 @@ from Extensions.eficas_exception import EficasException from determine import monEnvQT5 if monEnvQT5 : - from PyQt5.QtWidgets import QMessageBox + from PyQt5.QtWidgets import QMessageBox, QApplication, QDialog else : from PyQt4.QtGui import * @@ -65,7 +65,14 @@ class READERCATA: self.fic_cata=None self.OpenCata() self.cataitem=None - if self.code=="TELEMAC": self.cree_dico_inverse() + self.cree_dico_inverse() + if self.code=="TELEMAC": self.cree_dico_CasToCata() + #for k in self.dicoInverse.keys(): + # genea= self.dicoInverse[k] + # for t in genea : + # print t[0] + # print "\n" + def OpenCata(self): """ @@ -222,13 +229,13 @@ class READERCATA: self.appliEficas.rep_scripts=os.path.join(rep_cata,nom_cata) sys.path[:0] = [self.appliEficas.rep_scripts] try : - self.appliEficas.mesScripts=__import__(mesScriptsNomFichier) + self.appliEficas.mesScripts[self.code]=__import__(mesScriptsNomFichier) except: pass sys.path=sys.path[1:] else : try : - self.appliEficas.mesScripts=__import__(mesScriptsNomFichier) + self.appliEficas.mesScripts[self.code]=__import__(mesScriptsNomFichier) except: pass @@ -275,9 +282,9 @@ class READERCATA: widgetChoix = MonChoixCata(self.appliEficas, [cata.user_name for cata in cata_choice_list], title) ret=widgetChoix.exec_() - lab=QString(self.VERSION_EFICAS)+" " + lab=str(self.VERSION_EFICAS)+" " lab+=tr(" pour ") - lab+=QString(self.code) + lab+=str(self.code) lab+=tr(" avec le catalogue ") if ret == QDialog.Accepted: cata = cata_choice_list[widgetChoix.CBChoixCata.currentIndex()] @@ -312,22 +319,42 @@ class READERCATA: if dict_clef_docu.has_key(oper.nom): oper.docu=dict_clef_docu[oper.nom] - def cree_dico_inverse(self): self.dicoInverse={} - self.dico={} + self.dicoMC={} listeEtapes=self.cata[0].JdC.commandes for e in self.cata[0].JdC.commandes: self.traite_entite(e) - #print self.dicoInverse.keys() - #for e in self.cata[0].JdC.commandes: - # print "___________", e. nom , '__________________' - # self.cree_rubrique(e,self.dico,0) + #self.dicoFrancaisAnglais={} + #self.dicoAnglaisFrancais={} + #for k in self.dicoInverse.keys(): + # listefr=[] + # for nom, obj in self.dicoInverse[k] : + # listefr.append((tr(nom),obj)) + # self.dicoFrancaisAnglais[tr(nom)]=nom + # self.dicoAnglaisFrancais[nom]=tr(nom) + # self.dicoInverseFrancais[tr(k)]=listefr + # #print tr(k),listefr + + + def cree_dico_CasToCata(self): + if self.appliEficas.langue=="ang" : + from dicoCasEnToCata import dicoCasEnToCata as dicoCasToCata + else : + from dicoCasFrToCata import dicoCasFrToCata as dicoCasToCata + self.dicoCasToCata=dicoCasToCata + + + def traite_entite(self,e): + #print "_______________" + #print e + #print e.nom boolIn=0 for (nomFils, fils) in e.entites.items() : + self.dicoMC[nomFils]=fils self.traite_entite(fils) boolIn=1 if boolIn==0 : @@ -338,18 +365,17 @@ class READERCATA: moi=moi.pere liste.append((moi.nom,moi)) self.dicoInverse[e.nom]=liste + self.dicoInverse[tr(e.nom)]=liste def cree_rubrique(self,e,dico, niveau): from Accas import A_BLOC decale=niveau*" " - if niveau != 0 : - if isinstance(e,A_BLOC.BLOC): print decale, e.condition - else : print decale, e. nom + #if niveau != 0 : + # if isinstance(e,A_BLOC.BLOC): print decale, e.condition + # else : print decale, e. nom for (nom, fils) in e.entites.items() : if fils.entites.items() != [] : self.cree_rubrique(fils,dico,niveau+1) - else : print (niveau+1)*" ", nom + #else : print (niveau+1)*" ", nom - -