formatted strings, according to all formatting schemes: via dictionaries,
tuples, or atoms.
-``PyQt4`` is currently supported.
"""
from __future__ import absolute_import
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]+")
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))
# % (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)
+#
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):
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):
return 0
self.initModif()
+ print ('suppEntite MCCOMPO _____________________________________________________')
+ print ( objet.nom)
+ print ('_____________________________________________________')
objet.delObjPyxb()
self.mcListe.remove(objet)
CONNECTOR.Emit(self,"supp",objet)
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()
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
from __future__ import absolute_import
-from PyQt5.QtWidgets import QAction
from Editeur import Objecttreeitem
from . import browser
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 "))
from Editeur import Objecttreeitem
-import six
import traceback
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'))
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):
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()
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
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 :
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
import os, sys, types, re
import traceback
-from PyQt5.QtWidgets import QMessageBox
from Editeur.Eficas_utils import read_file
from Extensions.i18n import tr
#--------------------------------------
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)
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 :
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])
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
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"):
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):
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
#-----------------------------------------------------------#
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 ""
#-----------------------------------------#
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__)),".."))
"""
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)
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)
__version = {
'major': 9,
- 'minor': 0
+ 'minor': 3
}
def getEficasVersion():
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()
from InterfaceQT4.getVersion import getEficasVersion
from InterfaceQT4.viewManagerSsIhm import MyViewManagerSsIhm
-#from editorSsIhm import JDCEditorSsIhm
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
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
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
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):
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_()
def choisitCata(self):
# ____________________
+
+
liste_cata_possibles=[]
self.Commandes_Ordre_Catalogue=[]
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
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)
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
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)
o=__import__(nom_cata)
return o
except Exception as e:
+ import traceback
traceback.print_exc()
return 0
import os
from Extensions.i18n import tr
-import six
-from PyQt5.QtWidgets import QFileDialog, QMessageBox
-from PyQt5.QtCore import QFileInfo
# --------------------------------
class JdcSsIhmHandler(object):
</rect>
</property>
<property name="windowTitle">
- <string>Coix du Code</string>
+ <string>Choix du Code</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
+ <property name="margin">
<number>0</number>
</property>
<item>
<string/>
</property>
<layout class="QVBoxLayout" name="vlBouton">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
+ <property name="margin">
<number>0</number>
</property>
<item>
</size>
</property>
<property name="styleSheet">
- <string notr="true">/*background-color : rgb(168, 227, 142);rgb(57, 146, 228)*/
-background-color : rgb(66, 165, 238);
-/*border-style : outset;*/
+ <string notr="true">background-color : rgb(66, 165, 238);
border-radius : 10px;
border-width : 30 px;
border-color : beige;
<string notr="true"> QGroupBox {
border: 1px solid gray;
border-radius: 5px;
- margin-top: 1ex; /* leave space at the top for the title */
+ margin-top: 1ex;
}
QGroupBox::title {
<string/>
</property>
<property name="styleSheet">
- <string notr="true">background-color : rgb(224,223,222);
-font : 'times' 9px</string>
+ <string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing">
border-radius: 10px;
padding: 0 8px;
background: darkgray;
- /* selection-background-color: darkgray;*/
}
QLineEdit:disabled
{
background: lightgray;
}
-/*read-only {
- background: lightblue;*/</string>
+</string>
</property>
<property name="readOnly">
<bool>false</bool>
<string notr="true"> QGroupBox {
border: 1px solid gray;
border-radius: 5px;
- margin-top: 1ex; /* leave space at the top for the title */
+ margin-top: 1ex;
}
QGroupBox::title {
<string>Form</string>
</property>
<property name="styleSheet">
- <string notr="true">/* QFrame {
-border: 1px solid gray;
-}*/
-</string>
+ <string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<x>0</x>
<y>0</y>
<width>300</width>
- <height>101</height>
+ <height>111</height>
</rect>
</property>
<property name="sizePolicy">
</size>
</property>
<property name="styleSheet">
- <string notr="true">background : rgb(247,247,247);
-border: 1px solid gray;
-/* QFrame {
-border: 1px solid gray;
-}*/
+ <string notr="true">
</string>
</property>
</rect>
</property>
<property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="icon">
<iconset theme="find">
- <normaloff>.</normaloff>.</iconset>
+ <normaloff/>
+ </iconset>
</property>
<property name="iconSize">
<size>
<x>0</x>
<y>0</y>
<width>300</width>
- <height>125</height>
+ <height>129</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
+ <property name="horizontalSpacing">
<number>0</number>
</property>
- <property name="horizontalSpacing">
+ <property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<property name="spacing">
<number>0</number>
</property>
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
+ <property name="margin">
<number>0</number>
</property>
<item>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
- <height>40</height>
+ <height>400</height>
</size>
</property>
</spacer>
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"
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'
# 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 :
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
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]={}