From: pascale.noyret Date: Mon, 28 Jan 2019 09:36:23 +0000 (+0100) Subject: maj du 28/01 X-Git-Tag: avantMenage~55 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9519af373f3bbff98de48d9df12899aa1ef770f2;p=tools%2Feficas.git maj du 28/01 --- diff --git a/Extensions/translationQT5.py b/Extensions/translationQT5.py index e8116f5f..cc763f92 100644 --- a/Extensions/translationQT5.py +++ b/Extensions/translationQT5.py @@ -20,7 +20,6 @@ mechanism, in the ``Eficas`` application of EDF. Handles unformatted and formatted strings, according to all formatting schemes: via dictionaries, tuples, or atoms. -``PyQt4`` is currently supported. """ from __future__ import absolute_import try : @@ -30,13 +29,14 @@ try : except : pass from .eficas_exception import EficasException -#from Extensions.eficas_exception import EficasException + import re -from six.moves import map +regex=re.compile(r"% *[0-9]+") + import six +from six.moves import map from six.moves import range from six.moves import zip -regex=re.compile(r"% *[0-9]+") @@ -246,7 +246,11 @@ def tr(string, *args): string or Unicode object with formatting specifications, and, optionally, an iterable or an int or float. Lets Python do the string formatting.""" - from PyQt5.QtWidgets import QApplication + try : + from PyQt5.QtWidgets import QApplication + except : + return string + string = _preprocess_atom(string) if len(args) == 0: r = six.text_type(QApplication.translate("@default", string)) diff --git a/Ihm/I_ENTITE.py b/Ihm/I_ENTITE.py index 922f8796..48e9fb77 100644 --- a/Ihm/I_ENTITE.py +++ b/Ihm/I_ENTITE.py @@ -81,159 +81,159 @@ class ENTITE: # % (parent, tuple(mcs.intersection(mcbloc))) return mcs - def enregistreXML(self,root,catalogueXml): - import xml.etree.ElementTree as ET - import types - moi=ET.SubElement(root,str(self.__class__)) - nom=ET.SubElement(moi,'nom') - nom.text=self.nom - - if hasattr(self,'validators') and (self.validators != () and self.validators != None): - valid=ET.SubElement(moi,'validators') - valid.text= str(self.validators.__class__) - catalogueXml.validatorsUtilises.append(self.validators) - - if hasattr(self,'regles') and (self.regles !=() and self.regles != None): - for regle in self.regles: - regle.enregistreXML(moi,catalogueXml) - catalogueXml.reglesUtilisees.append(self.regles) - - if ((self.getDocu() !="" and self.getDocu() !=None) or \ - (self.fr != "" and self.fr != None) or \ - (self.ang != "" and self.ang != None) ): - dico={} - if self.getDocu() !=None : dico["docu"]=self.getDocu() - if self.fr != None : dico["fr"]=six.text_type(self.fr,"iso-8859-1") - if self.ang != None : dico["ang"]=self.ang - doc=ET.SubElement(moi,'doc') - doc.attrib=dico - - if ((self.getSug() !=None) or \ - (hasattr(self,'defaut') and (self.defaut != None) and (self.defaut != 'None'))) : - # il faut ajouter des sug dans le catalogue - # les attributs sont toujours du texte - dico={} - if (self.defaut != None) and (self.defaut != 'None') : - if isinstance(self.defaut,str ) : dico["defaut"]=six.text_type(self.defaut,"iso-8859-1") - else :dico["defaut"]=str(self.defaut) - if self.getSug() !=None: - if isinstance(self.getSug(),str ) : dico["sug"]=six.text_type(self.getSug(),"iso-8859-1") - else :dico["sug"]=str(self.getSug()) - - doc=ET.SubElement(moi,'ValeurDef') - doc.attrib=dico - - dico={} - if hasattr(self,'into') and self.into!=None: dico['into']=str(self.into) - if hasattr(self,'val_max') and self.val_max != "**" : dico['max']=str(self.val_max) - if hasattr(self,'val_min') and self.val_min != "**" : dico['min']=str(self.val_min) - if dico != {} : - PV=ET.SubElement(moi,'PlageValeur') - PV.attrib=dico - - dico={} - if hasattr(self,'max') and self.max != 1 : dico['max']=str(self.max) - if hasattr(self,'min') and self.min != 1 : dico['max']=str(self.min) - if dico != {} : - Card=ET.SubElement(moi,'Cardinalite') - Card.attrib=dico - - dico={} - if hasattr(self,'reentrant') and self.reentrant not in ('f','n') : dico['reentrant']=str(self.reentrant) - if hasattr(self,'position') and self.position != "local": dico['position']=str(self.position) - if hasattr(self,'homo') and self.homo != 1 : dico['homogene']=str(self.homo) - if hasattr(self,'statut') : dico['statut']=str(self.statut) - if hasattr(self,'repetable') : dico['repetable']=str(self.repetable) - if dico != {} : - pos=ET.SubElement(moi,'situation') - pos.attrib=dico - - if hasattr(self,'type') and self.type != (): - typeAttendu=ET.SubElement(moi,'typeAttendu') - l=[] - for t in self.type: - if type(t) == type : l.append(t.__name__) - else : l.append(t) - typeAttendu.text=str(l) - - if hasattr(self,'sd_prod') and self.sd_prod != () and self.sd_prod !=None: - typeCree=ET.SubElement(moi,'typeCree') - typeCree.text=str(self.sd_prod.__name__) - - if hasattr(self,'op') and self.op !=None : - subRoutine=ET.SubElement(moi,'subRoutine') - subRoutine.text=str(self.op) - - if hasattr(self,'proc') and self.proc != None : - construction=ET.SubElement(moi,'Construction') - construction.text=self.proc.uri - - for nomFils, fils in self.entites.items() : - fils.enregistreXML(moi,catalogueXml) - - def enregistreXMLStructure(self,root,catalogueXml): - import xml.etree.ElementTree as ET - import types - moi=ET.SubElement(root,str(self.__class__)) - - if hasattr(self,'into') and self.into!=None: - INTO=ET.SubElement(moi,'into') - INTO.text='into' - - dico={} - if hasattr(self,'val_max') and self.val_max != "**" : dico['max']=str(self.val_max) - if hasattr(self,'val_min') and self.val_min != "**" : dico['min']=str(self.val_min) - if dico != {} : - PV=ET.SubElement(moi,'maxOrMin') - PV.text='maxOrMin' - - dico={} - if hasattr(self,'max') and self.max != 1 : dico['max']=str(self.max) - if hasattr(self,'min') and self.min != 1 : dico['max']=str(self.min) - if dico != {} : - Card=ET.SubElement(moi,'liste') - Card.text="liste" - - dico={} - if hasattr(self,'statut') and self.statut=="f" : - statut=ET.SubElement(moi,'facultatif') - statut.text='facultatif' - if hasattr(self,'statut') and self.statut !="f" : - statut=ET.SubElement(moi,'obligatoire') - statut.text='obligatoire' - - if hasattr(self,'type') and self.type != (): - try : - if 'Fichier' in self.type : ty=ET.SubElement(moi,'Fichier') - ty.text='type' - except : - try : - if 'Repertoire' in self.type : ty=ET.SubElement(moi,'Repertoire') - ty.text='type' - except : - for t in self.type: - if t == "I" : ty=ET.SubElement(moi,'typeEntier') - elif t == "R" : ty=ET.SubElement(moi,'typeReel') - elif t == "TXM" : ty=ET.SubElement(moi,'typeTXM') - else : - try : - ty=ET.SubElement(moi,t.__name__) - except : - ty=ET.SubElement(moi,'autre') - ty.text='type' - - if hasattr(self,'sd_prod') and self.sd_prod != () and self.sd_prod !=None: - typeCree=ET.SubElement(moi,'typeCree') - typeCree.text='sd_prod' - - if hasattr(self,'op') and self.op !=None : - subRoutine=ET.SubElement(moi,'subRoutine') - subRoutine.text='op' - - if hasattr(self,'proc') and self.proc != None : - construction=ET.SubElement(moi,'Construction') - construction.text='proc' - - for nomFils, fils in self.entites.items() : - fils.enregistreXMLStructure(moi,catalogueXml) - +# def enregistreXML(self,root,catalogueXml): +# import xml.etree.ElementTree as ET +# import types +# moi=ET.SubElement(root,str(self.__class__)) +# nom=ET.SubElement(moi,'nom') +# nom.text=self.nom +# +# if hasattr(self,'validators') and (self.validators != () and self.validators != None): +# valid=ET.SubElement(moi,'validators') +# valid.text= str(self.validators.__class__) +# catalogueXml.validatorsUtilises.append(self.validators) +# +# if hasattr(self,'regles') and (self.regles !=() and self.regles != None): +# for regle in self.regles: +# regle.enregistreXML(moi,catalogueXml) +# catalogueXml.reglesUtilisees.append(self.regles) +# +# if ((self.getDocu() !="" and self.getDocu() !=None) or \ +# (self.fr != "" and self.fr != None) or \ +# (self.ang != "" and self.ang != None) ): +# dico={} +# if self.getDocu() !=None : dico["docu"]=self.getDocu() +# if self.fr != None : dico["fr"]=six.text_type(self.fr,"iso-8859-1") +# if self.ang != None : dico["ang"]=self.ang +# doc=ET.SubElement(moi,'doc') +# doc.attrib=dico +# +# if ((self.getSug() !=None) or \ +# (hasattr(self,'defaut') and (self.defaut != None) and (self.defaut != 'None'))) : +# # il faut ajouter des sug dans le catalogue +# # les attributs sont toujours du texte +# dico={} +# if (self.defaut != None) and (self.defaut != 'None') : +# if isinstance(self.defaut,str ) : dico["defaut"]=six.text_type(self.defaut,"iso-8859-1") +# else :dico["defaut"]=str(self.defaut) +# if self.getSug() !=None: +# if isinstance(self.getSug(),str ) : dico["sug"]=six.text_type(self.getSug(),"iso-8859-1") +# else :dico["sug"]=str(self.getSug()) +# +# doc=ET.SubElement(moi,'ValeurDef') +# doc.attrib=dico +# +# dico={} +# if hasattr(self,'into') and self.into!=None: dico['into']=str(self.into) +# if hasattr(self,'val_max') and self.val_max != "**" : dico['max']=str(self.val_max) +# if hasattr(self,'val_min') and self.val_min != "**" : dico['min']=str(self.val_min) +# if dico != {} : +# PV=ET.SubElement(moi,'PlageValeur') +# PV.attrib=dico +# +# dico={} +# if hasattr(self,'max') and self.max != 1 : dico['max']=str(self.max) +# if hasattr(self,'min') and self.min != 1 : dico['max']=str(self.min) +# if dico != {} : +# Card=ET.SubElement(moi,'Cardinalite') +# Card.attrib=dico +# +# dico={} +# if hasattr(self,'reentrant') and self.reentrant not in ('f','n') : dico['reentrant']=str(self.reentrant) +# if hasattr(self,'position') and self.position != "local": dico['position']=str(self.position) +# if hasattr(self,'homo') and self.homo != 1 : dico['homogene']=str(self.homo) +# if hasattr(self,'statut') : dico['statut']=str(self.statut) +# if hasattr(self,'repetable') : dico['repetable']=str(self.repetable) +# if dico != {} : +# pos=ET.SubElement(moi,'situation') +# pos.attrib=dico +# +# if hasattr(self,'type') and self.type != (): +# typeAttendu=ET.SubElement(moi,'typeAttendu') +# l=[] +# for t in self.type: +# if type(t) == type : l.append(t.__name__) +# else : l.append(t) +# typeAttendu.text=str(l) +# +# if hasattr(self,'sd_prod') and self.sd_prod != () and self.sd_prod !=None: +# typeCree=ET.SubElement(moi,'typeCree') +# typeCree.text=str(self.sd_prod.__name__) +# +# if hasattr(self,'op') and self.op !=None : +# subRoutine=ET.SubElement(moi,'subRoutine') +# subRoutine.text=str(self.op) +# +# if hasattr(self,'proc') and self.proc != None : +# construction=ET.SubElement(moi,'Construction') +# construction.text=self.proc.uri +# +# for nomFils, fils in self.entites.items() : +# fils.enregistreXML(moi,catalogueXml) +# +# def enregistreXMLStructure(self,root,catalogueXml): +# import xml.etree.ElementTree as ET +# import types +# moi=ET.SubElement(root,str(self.__class__)) +# +# if hasattr(self,'into') and self.into!=None: +# INTO=ET.SubElement(moi,'into') +# INTO.text='into' +# +# dico={} +# if hasattr(self,'val_max') and self.val_max != "**" : dico['max']=str(self.val_max) +# if hasattr(self,'val_min') and self.val_min != "**" : dico['min']=str(self.val_min) +# if dico != {} : +# PV=ET.SubElement(moi,'maxOrMin') +# PV.text='maxOrMin' +# +# dico={} +# if hasattr(self,'max') and self.max != 1 : dico['max']=str(self.max) +# if hasattr(self,'min') and self.min != 1 : dico['max']=str(self.min) +# if dico != {} : +# Card=ET.SubElement(moi,'liste') +# Card.text="liste" +# +# dico={} +# if hasattr(self,'statut') and self.statut=="f" : +# statut=ET.SubElement(moi,'facultatif') +# statut.text='facultatif' +# if hasattr(self,'statut') and self.statut !="f" : +# statut=ET.SubElement(moi,'obligatoire') +# statut.text='obligatoire' +# +# if hasattr(self,'type') and self.type != (): +# try : +# if 'Fichier' in self.type : ty=ET.SubElement(moi,'Fichier') +# ty.text='type' +# except : +# try : +# if 'Repertoire' in self.type : ty=ET.SubElement(moi,'Repertoire') +# ty.text='type' +# except : +# for t in self.type: +# if t == "I" : ty=ET.SubElement(moi,'typeEntier') +# elif t == "R" : ty=ET.SubElement(moi,'typeReel') +# elif t == "TXM" : ty=ET.SubElement(moi,'typeTXM') +# else : +# try : +# ty=ET.SubElement(moi,t.__name__) +# except : +# ty=ET.SubElement(moi,'autre') +# ty.text='type' +# +# if hasattr(self,'sd_prod') and self.sd_prod != () and self.sd_prod !=None: +# typeCree=ET.SubElement(moi,'typeCree') +# typeCree.text='sd_prod' +# +# if hasattr(self,'op') and self.op !=None : +# subRoutine=ET.SubElement(moi,'subRoutine') +# subRoutine.text='op' +# +# if hasattr(self,'proc') and self.proc != None : +# construction=ET.SubElement(moi,'Construction') +# construction.text='proc' +# +# for nomFils, fils in self.entites.items() : +# fils.enregistreXMLStructure(moi,catalogueXml) +# diff --git a/Ihm/I_JDC.py b/Ihm/I_JDC.py index d86c4b7c..aaf1bc0a 100644 --- a/Ihm/I_JDC.py +++ b/Ihm/I_JDC.py @@ -138,28 +138,32 @@ class JDC(I_OBJECT.OBJECT): Correlation.isValid() etapeTraitee.isValid() - def recalculeValiditeApresChangementGlobalJdc(self): - #print "je passe dans recalculeValiditeApresChangementGlobalJdc" + def recalculeValiditeApresChangementGlobalJdc(self, motClef): + print ("je passe dans recalculeValiditeApresChangementGlobalJdc") + #import traceback + #traceback.print_stack() try : - liste=self.getJdcRoot().cata.liste_condition + liste=self.getJdcRoot().cata.dict_condition[motClef.nom] except : liste=() for etapeTraitee in self.etapes : if etapeTraitee.nom not in liste: continue - self.forceRecalculBloc(etapeTraitee) + print ('me voila pour ', etapeTraitee.nom) + #self.forceRecalculBloc(etapeTraitee) etapeTraitee.state='arecalculer' + etapeTraitee.deepUpdateConditionBloc() etapeTraitee.isValid() - def forceRecalculBloc(self,objet): + #def forceRecalculBloc(self,objet): # Attention : certains objets deviennent None quand on recalcule # les conditions d existence des blocs - if objet != None: objet.state='arecalculer' - if hasattr(objet,'listeMcPresents'): - for childNom in objet.listeMcPresents(): - child=objet.getChild(childNom) - if hasattr(objet,'_updateConditionBloc'):objet._updateConditionBloc() - self.forceRecalculBloc(child) + # if objet != None: objet.state='arecalculer' + # if hasattr(objet,'listeMcPresents'): + # for childNom in objet.listeMcPresents(): + # child=objet.getChild(childNom) + # if hasattr(objet,'_updateConditionBloc'):objet._updateConditionBloc() + # self.forceRecalculBloc(child) def getSdAvantDuBonTypePourTypeDeBase(self,etape,type): @@ -639,9 +643,9 @@ class JDC(I_OBJECT.OBJECT): self.isValid() pass - def deepUpdateConditionBloc(self): + def deepUpdateConditionBloc(self,motClef=None): # pour le moment, on ne fait rien - self.getJdcRoot().recalculeValiditeApresChangementGlobalJdc() + self.getJdcRoot().recalculeValiditeApresChangementGlobalJdc(motClef) #raise EficasException(tr("Pas implemente")) def updateConditionBloc(self): diff --git a/Ihm/I_MCCOMPO.py b/Ihm/I_MCCOMPO.py index e88ae78c..a90d7ffb 100644 --- a/Ihm/I_MCCOMPO.py +++ b/Ihm/I_MCCOMPO.py @@ -225,6 +225,9 @@ class MCCOMPO(I_OBJECT.OBJECT): return 0 self.initModif() + print ('suppEntite MCCOMPO _____________________________________________________') + print ( objet.nom) + print ('_____________________________________________________') objet.delObjPyxb() self.mcListe.remove(objet) CONNECTOR.Emit(self,"supp",objet) diff --git a/Ihm/I_MCSIMP.py b/Ihm/I_MCSIMP.py index d80ed54a..7e421fd4 100644 --- a/Ihm/I_MCSIMP.py +++ b/Ihm/I_MCSIMP.py @@ -318,7 +318,7 @@ class MCSIMP(I_OBJECT.OBJECT): if self.definition.position == 'global' : self.etape.deepUpdateConditionBloc() elif self.definition.position == 'global_jdc' : - self.jdc.deepUpdateConditionBloc() + self.jdc.deepUpdateConditionBloc(self) else: self.parent.updateConditionBloc() diff --git a/Ihm/I_REGLE.py b/Ihm/I_REGLE.py index 56e1febf..b0f19adc 100644 --- a/Ihm/I_REGLE.py +++ b/Ihm/I_REGLE.py @@ -47,12 +47,12 @@ class REGLE: return [] - def enregistreXML(self,root,catalogueXml): - import xml.etree.ElementTree as ET - regleXml=ET.SubElement(root,'regles') - txt="" - for mot in self.getText().split('\n'): - mot.replace(' ','') - txt=txt + mot + " " - regleXml.text= txt +# def enregistreXML(self,root,catalogueXml): +# import xml.etree.ElementTree as ET +# regleXml=ET.SubElement(root,'regles') +# txt="" +# for mot in self.getText().split('\n'): +# mot.replace(' ','') +# txt=txt + mot + " " +# regleXml.text= txt diff --git a/InterfaceQT4/compocomm.py b/InterfaceQT4/compocomm.py index 8a83ce8f..39ee3602 100644 --- a/InterfaceQT4/compocomm.py +++ b/InterfaceQT4/compocomm.py @@ -20,7 +20,6 @@ from __future__ import absolute_import -from PyQt5.QtWidgets import QAction from Editeur import Objecttreeitem from . import browser @@ -38,6 +37,7 @@ class Node(browser.JDCNode,typeNode.PopUpMenuNodePartiel): def createPopUpMenu(self): typeNode.PopUpMenuNodePartiel.createPopUpMenu(self) + from PyQt5.QtWidgets import QAction self.Decommente = QAction(tr("decommenter"),self.tree) self.Decommente.triggered.connect(self.decommenter) self.Decommente.setStatusTip(tr("Decommente la commande ")) diff --git a/InterfaceQT4/compofact.py b/InterfaceQT4/compofact.py index 8a9d66fb..93385943 100644 --- a/InterfaceQT4/compofact.py +++ b/InterfaceQT4/compofact.py @@ -25,7 +25,6 @@ from Extensions.i18n import tr from Editeur import Objecttreeitem -import six import traceback @@ -138,7 +137,7 @@ class FACTTreeItem(Objecttreeitem.ObjectTreeItem): return (0, tr('Impossible de supprimer un mot-cle obligatoire ')) if self.object.suppEntite(itemobject): - message = tr("Mot-cle %s supprime")+ six.text_type(itemobject.nom) + message = tr("Mot-cle %s supprime")+ itemobject.nom return (1, message) else: return (0,tr('Pb interne : impossible de supprimer ce mot-cle')) diff --git a/InterfaceQT4/compomacro.py b/InterfaceQT4/compomacro.py index 64a9d63f..2398751d 100644 --- a/InterfaceQT4/compomacro.py +++ b/InterfaceQT4/compomacro.py @@ -30,9 +30,6 @@ from Extensions.i18n import tr from InterfaceQT4 import compooper from InterfaceQT4 import browser from InterfaceQT4 import typeNode -from PyQt5.QtWidgets import QAction -from PyQt5.QtCore import Qt - class MACRONode(browser.JDCNode,typeNode.PopUpMenuNode): @@ -44,20 +41,21 @@ class MACRONode(browser.JDCNode,typeNode.PopUpMenuNode): def createPopUpMenu(self): typeNode.PopUpMenuNode.createPopUpMenu(self) - if ("AFFE_CARA_ELEM" in self.item.getGenealogie()) and self.editor.salome: - self.ViewElt = QAction(tr('View3D'),self.tree) - self.ViewElt.triggered.connect(self.view3D) - self.ViewElt.setStatusTip(tr("affiche dans Geom les elements de structure")) - self.menu.addAction(self.ViewElt) - if self.item.isValid() : - self.ViewElt.setEnabled(1) - else: - self.ViewElt.setEnabled(0) - - def view3D(self) : - from Editeur import TroisDPal - troisD=TroisDPal.TroisDPilote(self.item,self.editor.appliEficas) - troisD.envoievisu() +# if ("AFFE_CARA_ELEM" in self.item.getGenealogie()) and self.editor.salome: +# from PyQt5.QtWidgets import QAction +# self.ViewElt = QAction(tr('View3D'),self.tree) +# self.ViewElt.triggered.connect(self.view3D) +# self.ViewElt.setStatusTip(tr("affiche dans Geom les elements de structure")) +# self.menu.addAction(self.ViewElt) +# if self.item.isValid() : +# self.ViewElt.setEnabled(1) +# else: +# self.ViewElt.setEnabled(0) + +# def view3D(self) : +# from Editeur import TroisDPal +# troisD=TroisDPal.TroisDPilote(self.item,self.editor.appliEficas) +# troisD.envoievisu() diff --git a/InterfaceQT4/compooper.py b/InterfaceQT4/compooper.py index c03704bf..d9326bee 100644 --- a/InterfaceQT4/compooper.py +++ b/InterfaceQT4/compooper.py @@ -24,9 +24,6 @@ except : pass import os import tempfile -from PyQt5.QtWidgets import QMessageBox, QAction, QApplication -from PyQt5.QtGui import QCursor -from PyQt5.QtCore import Qt from Extensions.i18n import tr from Extensions.eficas_exception import EficasException @@ -51,7 +48,7 @@ class Node(browser.JDCNode, typeNode.PopUpMenuNode): self.editor.initModif() test,mess = self.item.nommeSd(nom) if (test== 0): - self.editor.afficheInfos(mess,Qt.red) + self.editor.afficheInfos(mess,'red') old=self.item.getText() self.monWidgetNom.setText(old) else : @@ -69,59 +66,61 @@ class Node(browser.JDCNode, typeNode.PopUpMenuNode): def createPopUpMenu(self): typeNode.PopUpMenuNode.createPopUpMenu(self) - if ("AFFE_CARA_ELEM" in self.item.getGenealogie()) and self.editor.salome: - self.ViewElt = QAction(tr('View3D'),self.tree) - self.tree.connect(self.ViewElt,SIGNAL("triggered()"),self.view3D) - self.ViewElt.setStatusTip(tr("affiche dans Geom les elements de structure")) - self.menu.addAction(self.ViewElt) - if self.item.isValid() : - self.ViewElt.setEnabled(1) - else: - self.ViewElt.setEnabled(0) - if self.item.getNom() == "DISTRIBUTION" : - self.Graphe = QAction(tr('Graphique'),self.tree) - self.Graphe.triggered.connect(self.viewPng) - self.Graphe.setStatusTip(tr("affiche la distribution ")) - self.menu.addAction(self.Graphe) - if self.item.isValid() : - self.Graphe.setEnabled(1) - else: - self.Graphe.setEnabled(0) - - def view3D(self) : - from Editeur import TroisDPal - troisD=TroisDPal.TroisDPilote(self.item,self.editor.appliEficas) - troisD.envoievisu() - - def viewPng(self) : - from monPixmap import MonLabelPixmap - import generator - try: - QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) - g = generator.plugins[self.appliEficas.format_fichier]() - g.gener(self.item.object, format='beautifie') - stdGener = g.getGenerateur() - loi = list(g.dictMCLois.keys())[0] - nomLoi = loi.getName() - (fd, fichier) = tempfile.mkstemp(prefix = "openturns_graph_", suffix = ".png") - os.close(fd) - chemin = os.path.dirname(fichier) - base = os.path.splitext(os.path.basename(fichier))[0] - script = stdGener.GraphiquePDF(loi, chemin, base) +# if ("AFFE_CARA_ELEM" in self.item.getGenealogie()) and self.editor.salome: +# self.ViewElt = QAction(tr('View3D'),self.tree) +# self.tree.connect(self.ViewElt,SIGNAL("triggered()"),self.view3D) +# self.ViewElt.setStatusTip(tr("affiche dans Geom les elements de structure")) +# self.menu.addAction(self.ViewElt) +# if self.item.isValid() : +# self.ViewElt.setEnabled(1) +# else: +# self.ViewElt.setEnabled(0) +# if self.item.getNom() == "DISTRIBUTION" : +# self.Graphe = QAction(tr('Graphique'),self.tree) +# self.Graphe.triggered.connect(self.viewPng) +# self.Graphe.setStatusTip(tr("affiche la distribution ")) +# self.menu.addAction(self.Graphe) +# if self.item.isValid() : +# self.Graphe.setEnabled(1) +# else: +# self.Graphe.setEnabled(0) + +# def view3D(self) : +# from Editeur import TroisDPal +# troisD=TroisDPal.TroisDPilote(self.item,self.editor.appliEficas) +# troisD.envoievisu() + +# def viewPng(self) : +# from monPixmap import MonLabelPixmap +# import generator +# try: +# from PyQt5.QtCore import Qt +# from PyQt5.QtWidgets import QMessageBox, QAction, QApplication +# QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) +# g = generator.plugins[self.appliEficas.format_fichier]() +# g.gener(self.item.object, format='beautifie') +# stdGener = g.getGenerateur() +# loi = list(g.dictMCLois.keys())[0] +# nomLoi = loi.getName() +# (fd, fichier) = tempfile.mkstemp(prefix = "openturns_graph_", suffix = ".png") +# os.close(fd) +# chemin = os.path.dirname(fichier) +# base = os.path.splitext(os.path.basename(fichier))[0] +# script = stdGener.GraphiquePDF(loi, chemin, base) #print script - d = {} - exec(script, d) - widgetPng=MonLabelPixmap(self.appliEficas,fichier,nomLoi) - os.remove(fichier) - QApplication.restoreOverrideCursor() - widgetPng.show() - except: - QApplication.restoreOverrideCursor() - QMessageBox.warning( - self.appliEficas, - tr("Erreur interne"), - tr("La PDF de la loi ne peut pas etre affichee."), - tr("&Annuler")) +# d = {} +# exec(script, d) +# widgetPng=MonLabelPixmap(self.appliEficas,fichier,nomLoi) +# os.remove(fichier) +# QApplication.restoreOverrideCursor() +# widgetPng.show() +# except: +# QApplication.restoreOverrideCursor() +# QMessageBox.warning( +# self.appliEficas, +# tr("Erreur interne"), +# tr("La PDF de la loi ne peut pas etre affichee."), +# tr("&Annuler")) class EtapeTreeItem(Objecttreeitem.ObjectTreeItem): """ La classe EtapeTreeItem est un adaptateur des objets ETAPE du noyau diff --git a/InterfaceQT4/configuration.py b/InterfaceQT4/configuration.py index 9871a752..334be9c2 100644 --- a/InterfaceQT4/configuration.py +++ b/InterfaceQT4/configuration.py @@ -30,7 +30,6 @@ except : pass import os, sys, types, re import traceback -from PyQt5.QtWidgets import QMessageBox from Editeur.Eficas_utils import read_file from Extensions.i18n import tr @@ -144,7 +143,11 @@ class configBase(object): #-------------------------------------- name='prefs_'+self.appli.code - prefsCode=__import__(name) + try : + prefsCode=__import__(name) + except : + print ('pas de fichier de prefs') + return for k in dir(prefsCode): if (k[0:1] != "__" and k[-1:-2] !='__'): valeur=getattr(prefsCode,k) @@ -170,8 +173,12 @@ class configBase(object): try: exec(txt, d) except : - QMessageBox.critical( None, tr("Import du fichier de Configuration"), + try : + from PyQt5.QtWidgets import QMessageBox + QMessageBox.critical( None, tr("Import du fichier de Configuration"), tr("Erreur a la lecture du fichier de configuration %s " , str(fic_ini_integrateur))) + except : + print("Erreur a la lecture du fichier de configuration %s " , str(fic_ini_integrateur)) return self.labels_eficas.append('rep_aide') for k in self.labels_eficas : @@ -199,8 +206,12 @@ class configBase(object): exec(txt, d) except : l=traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) - QMessageBox.critical( None, tr("Import du fichier de Configuration"), + try : + from PyQt5.QtWidgets import QMessageBox + QMessageBox.critical( None, tr("Import du fichier de Configuration"), tr("Erreur a la lecture du fichier de configuration %s " , str(fic_ini_integrateur))) + except : + print ("Erreur a la lecture du fichier de configuration %s " , str(fic_ini_integrateur)) for k in self.labels_user : try : setattr(self,k,d[k]) diff --git a/InterfaceQT4/editor.py b/InterfaceQT4/editor.py index 5805019a..5cad4b4c 100755 --- a/InterfaceQT4/editor.py +++ b/InterfaceQT4/editor.py @@ -83,6 +83,10 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget): self.QWParent=QWParent JDCEditorSsIhm. __init__ (self,appli,fichier, jdc,units,include) + if self.jdc: + comploader.chargerComposants() + self.jdc_item=Objecttreeitem.makeObjecttreeitem( self, "nom", self.jdc ) + # Particularites IHM : met la fenetre a jour @@ -844,8 +848,8 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget): self.tree.racine.item.getObject().nom=os.path.basename(newName) self.tree.racine.updateNodeLabel() - #print ('sortie du XML') - self.jdc.toXml() + print ('sortie du XML') + if self.jdc.cata.modeleMetier : self.jdc.toXml(self.fichier) if self.jdc.isValid() != 0 and hasattr(self.generator, "writeDefault"): #if hasattr(self.generator, "writeDefault"): diff --git a/InterfaceQT4/editorSsIhm.py b/InterfaceQT4/editorSsIhm.py index 58c1ecd0..3d251ae8 100755 --- a/InterfaceQT4/editorSsIhm.py +++ b/InterfaceQT4/editorSsIhm.py @@ -172,9 +172,9 @@ class JDCEditorSsIhm : if txt_exception : self.jdc = None self.informe('pb chargement jdc',txt_exception) - else: - comploader.chargerComposants() - self.jdc_item=Objecttreeitem.makeObjecttreeitem( self, "nom", self.jdc ) + #else: + #comploader.chargerComposants() + #self.jdc_item=Objecttreeitem.makeObjecttreeitem( self, "nom", self.jdc ) #-------------------------------# def readFile(self, fn): @@ -429,7 +429,8 @@ class JDCEditorSsIhm : f.close() return 1 except IOError as why: - self.afficheInfos('Sauvegarde du Fichier', 'Le fichier'+str(fn) + 'n a pas pu etre sauvegarde :' + str(why)) + print('Sauvegarde du Fichier', 'Le fichier'+str(fn) + 'n a pas pu etre sauvegarde :' , str(why)) + self.afficheInfos('Le fichier'+str(fn) + 'n a pas pu etre sauvegarde ' , 'red') return 0 #-----------------------------------------------------------# @@ -496,7 +497,7 @@ class JDCEditorSsIhm : dico=self.generator.Dico return dico else : - self.afficheInfos(tr("Format %s non reconnu" , self.format),Qt.red) + self.afficheInfos(tr("Format %s non reconnu" , self.format),'red') return "" #-----------------------------------------# diff --git a/InterfaceQT4/eficas_go.py b/InterfaceQT4/eficas_go.py index d7aea420..9fa073cc 100755 --- a/InterfaceQT4/eficas_go.py +++ b/InterfaceQT4/eficas_go.py @@ -26,7 +26,6 @@ try : from builtins import str except : pass -from PyQt5.QtWidgets import QApplication import sys,os repIni=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"..")) @@ -51,6 +50,7 @@ def lanceEficas(code=None,fichier=None,ssCode=None,multi=False,langue='en'): """ Lance l'appli EFICAS """ + from PyQt5.QtWidgets import QApplication # Analyse des arguments de la ligne de commande from Editeur import session options=session.parse(sys.argv) @@ -154,8 +154,6 @@ def lanceEficas_param(code='Adao',fichier=None,version='V0',macro='ASSIMILATION_ options=session.parse(sys.argv) from .qtEficas import Appli - #app = QApplication(sys.argv) - #Eficas=Appli(code=code,ssCode=None,salome=0) from .ssIhm import QWParentSSIhm Eficas=QWParentSSIhm(code,version) diff --git a/InterfaceQT4/getVersion.py b/InterfaceQT4/getVersion.py index 8620b54c..9044feb1 100644 --- a/InterfaceQT4/getVersion.py +++ b/InterfaceQT4/getVersion.py @@ -22,7 +22,7 @@ __version = { 'major': 9, - 'minor': 0 + 'minor': 3 } def getEficasVersion(): diff --git a/InterfaceQT4/qtEficas.py b/InterfaceQT4/qtEficas.py index 79d10798..c5708cee 100755 --- a/InterfaceQT4/qtEficas.py +++ b/InterfaceQT4/qtEficas.py @@ -150,11 +150,11 @@ class Appli(AppliSsIhm,Ui_Eficas,QMainWindow): self.setWindowTitle(self.VERSION_EFICAS) try : #if 1 : - # print ('attention try devient if 1') + #print ('attention try devient if 1') self.ouvreFichiers() except EficasException as exc: #except: - # print "je suis dans le except" + print ("je suis dans le except") if self.salome == 0 : exit() #self.adjustSize() diff --git a/InterfaceQT4/qtEficasSsIhm.py b/InterfaceQT4/qtEficasSsIhm.py index 2e97dc9a..963c678d 100755 --- a/InterfaceQT4/qtEficasSsIhm.py +++ b/InterfaceQT4/qtEficasSsIhm.py @@ -32,7 +32,6 @@ from Extensions import param2 from InterfaceQT4.getVersion import getEficasVersion from InterfaceQT4.viewManagerSsIhm import MyViewManagerSsIhm -#from editorSsIhm import JDCEditorSsIhm class AppliSsIhm: @@ -92,10 +91,14 @@ class AppliSsIhm: self.ssCode=ssCode if self.code == None:return # pour le cancel de la fenetre choix code - name='prefs_'+self.code - prefsCode=__import__(name) + try : + name='prefs_'+self.code + prefsCode=__import__(name) + self.repIni=prefsCode.repIni + except : + self.repIni=os.path.dirname(os.path.abspath(__file__)) + - self.repIni=prefsCode.repIni if ssCode != None : self.format_fichier= ssCode #par defaut prefsCode.NAME_SCHEME=ssCode @@ -107,8 +110,9 @@ class AppliSsIhm: configuration=__import__(nameConf) self.maConfiguration = configuration.make_config(self,self.repIni) except : - configuration = __import__('configuration') - self.maConfiguration = configuration.makeConfig(self,prefsCode.repIni) + from InterfaceQT4.configuration import makeConfig + #self.maConfiguration = configuration.makeConfig(self,prefsCode.repIni) + self.maConfiguration = makeConfig(self,self.repIni) if hasattr (self,'maConfiguration') and self.maConfiguration.translatorFichier : from Extensions import localisation diff --git a/InterfaceQT4/readercata.py b/InterfaceQT4/readercata.py index 801ea86e..ede63e4e 100644 --- a/InterfaceQT4/readercata.py +++ b/InterfaceQT4/readercata.py @@ -30,12 +30,8 @@ try : from builtins import object except : pass -import time -import os,sys,py_compile -import traceback -import six.moves.cPickle -import re -import types +#import os,sys,py_compile +import os, sys # Modules Eficas from Noyau.N_CR import CR @@ -45,11 +41,9 @@ import analyse_catalogue import analyse_catalogue_initial import autre_analyse_cata import uiinfo -from InterfaceQT4.monChoixCata import MonChoixCata from Extensions.i18n import tr from Extensions.eficas_exception import EficasException -from PyQt5.QtWidgets import QMessageBox, QApplication, QDialog #------------------------------- class ReaderCataCommun(object): @@ -61,12 +55,19 @@ class ReaderCataCommun(object): Ouvre une fenetre de selection du catalogue dans le cas où plusieurs ont ete definis dans Accas/editeur.ini """ + try : + from PyQt5.QtWidgets import QDialog + except : + print ('Pas de choix interactif sans qt') + return + code = getattr(self.appliEficas.maConfiguration, "code", None) if code != None : title=tr("Choix d une version du code ")+str(code) else : title=tr("Choix d une version ") + from InterfaceQT4.monChoixCata import MonChoixCata widgetChoix = MonChoixCata(self.appliEficas, [cata.user_name for cata in cata_choice_list], title) ret=widgetChoix.exec_() @@ -92,6 +93,8 @@ class ReaderCataCommun(object): def choisitCata(self): # ____________________ + + liste_cata_possibles=[] self.Commandes_Ordre_Catalogue=[] @@ -109,8 +112,12 @@ class ReaderCataCommun(object): if catalogue.code == self.code and catalogue.file_format == self.ssCode: liste_cata_possibles.append(catalogue) if len(liste_cata_possibles)==0: - QMessageBox.critical(self.QWParent, tr("Import du catalogue"), + try : + from PyQt5.QtWidgets import QMessageBox, QDialog + 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) self.appliEficas.close() if self.appliEficas.salome == 0 : sys.exit(1) return @@ -131,8 +138,12 @@ class ReaderCataCommun(object): else : cata_choice_list.append(cata) if len(cata_choice_list) == 0: - QMessageBox.critical(self.QWParent, tr("Import du catalogue"), + try : + from PyQt5.QtWidgets import QMessageBox + QMessageBox.critical(self.QWParent, tr("Import du catalogue"), tr("Aucun catalogue trouve")) + except : + print ("Pas de catalogue defini pour le code " + self.code) self.appliEficas.close() if self.appliEficas.salome == 0 : sys.exit(1) @@ -191,11 +202,10 @@ class ReaderCata (ReaderCataCommun): if self.appliEficas.maConfiguration.withXSD : try : - #import raw.Telemac2d as modeleMetier - #import raw.cata_genere_fact as modeleMetier - import raw.cata_genere as modeleMetier - #import raw.cata_bloc as modeleMetier - #print ('import raw.cata_lbm_genere as modeleMetier') + nomCataXsd = os.path.splitext(os.path.basename(self.fic_cata))[0]+'_genere' + pathCata = os.path.dirname(self.fic_cata)+'/raw/'+nomCataXsd+'.py' + import imp + modeleMetier= imp.load_source(nomCataXsd,pathCata) except : print ('______________ poum import cata_genere ') modeleMetier = None @@ -205,7 +215,11 @@ 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) + try: + from PyQt5.QtWidgets import QMessageBox, QDialog + QMessageBox.critical( self.QWParent, tr("Import du catalogue"),tr("Impossible d'importer le catalogue ")+ self.fic_cata) + except : + print ("Impossible d'importer le catalogue "+ self.fic_cata) self.appliEficas.close() if self.appliEficas.salome == 0 : sys.exit(1) @@ -276,6 +290,7 @@ class ReaderCata (ReaderCataCommun): o=__import__(nom_cata) return o except Exception as e: + import traceback traceback.print_exc() return 0 diff --git a/InterfaceQT4/viewManagerSsIhm.py b/InterfaceQT4/viewManagerSsIhm.py index a588c792..c04e2b0f 100644 --- a/InterfaceQT4/viewManagerSsIhm.py +++ b/InterfaceQT4/viewManagerSsIhm.py @@ -26,9 +26,6 @@ except : pass import os from Extensions.i18n import tr -import six -from PyQt5.QtWidgets import QFileDialog, QMessageBox -from PyQt5.QtCore import QFileInfo # -------------------------------- class JdcSsIhmHandler(object): diff --git a/UiQT5/desChoixCode.ui b/UiQT5/desChoixCode.ui index 69b9c248..76f9de74 100644 --- a/UiQT5/desChoixCode.ui +++ b/UiQT5/desChoixCode.ui @@ -11,22 +11,13 @@ - Coix du Code + Choix du Code 0 - - 0 - - - 0 - - - 0 - - + 0 @@ -41,16 +32,7 @@ - - 0 - - - 0 - - - 0 - - + 0 diff --git a/UiQT5/desPBOptionnelMT.ui b/UiQT5/desPBOptionnelMT.ui index 5bdd3224..66881fca 100644 --- a/UiQT5/desPBOptionnelMT.ui +++ b/UiQT5/desPBOptionnelMT.ui @@ -48,9 +48,7 @@ - /*background-color : rgb(168, 227, 142);rgb(57, 146, 228)*/ -background-color : rgb(66, 165, 238); -/*border-style : outset;*/ + background-color : rgb(66, 165, 238); border-radius : 10px; border-width : 30 px; border-color : beige; diff --git a/UiQT5/desWidgetBloc.ui b/UiQT5/desWidgetBloc.ui index 439dd60f..9094f6a9 100644 --- a/UiQT5/desWidgetBloc.ui +++ b/UiQT5/desWidgetBloc.ui @@ -17,7 +17,7 @@ QGroupBox { border: 1px solid gray; border-radius: 5px; - margin-top: 1ex; /* leave space at the top for the title */ + margin-top: 1ex; } QGroupBox::title { diff --git a/UiQT5/desWidgetCommande.ui b/UiQT5/desWidgetCommande.ui index cb31ccb2..9d4bfd03 100644 --- a/UiQT5/desWidgetCommande.ui +++ b/UiQT5/desWidgetCommande.ui @@ -29,8 +29,7 @@ - background-color : rgb(224,223,222); -font : 'times' 9px + @@ -200,14 +199,12 @@ font : 'times' 9px border-radius: 10px; padding: 0 8px; background: darkgray; - /* selection-background-color: darkgray;*/ } QLineEdit:disabled { background: lightgray; } -/*read-only { - background: lightblue;*/ + false diff --git a/UiQT5/desWidgetFactPlie.ui b/UiQT5/desWidgetFactPlie.ui index 766ca93b..c2c2d878 100644 --- a/UiQT5/desWidgetFactPlie.ui +++ b/UiQT5/desWidgetFactPlie.ui @@ -17,7 +17,7 @@ QGroupBox { border: 1px solid gray; border-radius: 5px; - margin-top: 1ex; /* leave space at the top for the title */ + margin-top: 1ex; } QGroupBox::title { diff --git a/UiQT5/desWidgetPlusieursBase.ui b/UiQT5/desWidgetPlusieursBase.ui index 8d7d5a9d..d9457a40 100644 --- a/UiQT5/desWidgetPlusieursBase.ui +++ b/UiQT5/desWidgetPlusieursBase.ui @@ -26,10 +26,7 @@ Form - /* QFrame { -border: 1px solid gray; -}*/ - + @@ -212,7 +209,7 @@ border: 1px solid gray; 0 0 300 - 101 + 111 @@ -282,11 +279,7 @@ border: 1px solid gray; - background : rgb(247,247,247); -border: 1px solid gray; -/* QFrame { -border: 1px solid gray; -}*/ + diff --git a/UiQT5/desWidgetPlusieursInto.ui b/UiQT5/desWidgetPlusieursInto.ui index fdddf0fa..a7793239 100644 --- a/UiQT5/desWidgetPlusieursInto.ui +++ b/UiQT5/desWidgetPlusieursInto.ui @@ -11,7 +11,7 @@ - + 0 0 @@ -262,7 +262,8 @@ - .. + + @@ -356,23 +357,14 @@ 0 0 300 - 125 + 129 - - 0 - - - 0 - - - 0 - - + 0 - + 0 @@ -460,16 +452,7 @@ 0 - - 0 - - - 0 - - - 0 - - + 0 @@ -480,7 +463,7 @@ 20 - 40 + 400 diff --git a/generator/generator_aplat.py b/generator/generator_aplat.py index c0170358..2bbdaade 100644 --- a/generator/generator_aplat.py +++ b/generator/generator_aplat.py @@ -212,7 +212,7 @@ class AplatGenerator(object): Cette methode convertit un PARAMETRE en une chaine de caracteres a la syntaxe aplat """ - if type(obj.valeur) == bytes: + if type(obj.valeur) == bytes or type(obj.valeur) == str: # PN pour corriger le bug a='3+4' au lieu de a= 3+4 #return obj.nom + " = '" + obj.valeur + "';\n" return obj.nom + " = " + obj.valeur + ";\n" @@ -239,7 +239,7 @@ class AplatGenerator(object): en une chaine de caracteres a la syntaxe aplat """ text='' - for v in obj.mc_liste: + for v in obj.mcListe: text=text + self.generator(v) if text=='': return self.init+'\n' @@ -310,12 +310,14 @@ class AplatGenerator(object): # On est en presence d'une liste de valeur rep = '(' for val in obj.valeur: - if type(val) == types.InstanceType : + #if type(val) == types.InstanceType : + if isinstance(val,object): rep = rep + self.generator(val) +',' else: rep = rep + repr(val)+',' rep = rep + ')' - elif type(obj.valeur) == types.InstanceType : + #elif type(obj.valeur) == types.InstanceType : + elif type(obj.valeur) == object : # On est en presence d'une valeur unique de type instance rep = self.generator(obj.valeur) else : @@ -331,7 +333,7 @@ class AplatGenerator(object): text = '' old_init=self.init self.init = self.init + self.sep + obj.nom - for mocle in obj.mc_liste : + for mocle in obj.mcListe : text = text + self.generator(mocle) self.init=old_init return text diff --git a/generator/generator_dico.py b/generator/generator_dico.py index 408ba954..20cba9eb 100644 --- a/generator/generator_dico.py +++ b/generator/generator_dico.py @@ -91,9 +91,6 @@ class DicoGenerator(PythonGenerator): def generMCSIMP(self,obj) : """recuperation de l objet MCSIMP""" s=PythonGenerator.generMCSIMP(self,obj) - print ('jjjjjjjjjj') - print (obj.nom) - print (s) courant=self.Dico for p in obj.getGenealogiePrecise()[0:-1]: if not (p in courant.keys()) : courant[p]={}