from PyQt5.QtWidgets import QTreeWidget , QTreeWidgetItem, QApplication, QMessageBox
-from PyQt5.QtGui import QIcon
-from PyQt5.QtCore import Qt
-from Extensions.i18n import tr
-from .gereRegles import GereRegles
+from PyQt5.QtGui import QIcon
+from PyQt5.QtCore import Qt
+
+from Extensions.i18n import tr
+from .gereRegles import GereRegles
from .monChoixCommande import MonChoixCommande
#------------------------------------------
#------------------------------------------
def __init__( self, jdc_item, QWParent):
- #if hasattr(QWParent,'widgetTree') :
+ #----------------------------------------
self.editor = QWParent
self.plie=False
if self.editor.widgetTree !=None :
QTreeWidget.__init__(self, self.editor.widgetTree )
self.editor.verticalLayout_2.addWidget(self)
if self.editor.enteteQTree=='complet':
- self.headerItem().setText(0, "Commande ")
+ self.headerItem().setText(0, "Commande ")
self.headerItem().setText(1, "Concept/Valeur")
else :
- self.headerItem().setText(0, "Commande ")
+ self.headerItem().setText(0, "Commande ")
self.setColumnWidth(0,200)
self.setExpandsOnDoubleClick(False)
self.setSelectionMode(3)
self.itemCollapsed.connect(self.handleCollapsedItem)
self.itemExpanded.connect(self.handleExpandedItem)
- #PNPNPN verifier dans quel cas on se trouve : affiche l arbre ou la commande
- self.node_selected=self.racine
- self.inhibeExpand=True
+ self.node_selected = self.racine
+ self.inhibeExpand = True
self.expandItem(self.racine)
- self.inhibeExpand=False
- #print ("self.editor.maConfiguration.afficheCommandesPliees", self.editor.maConfiguration.afficheCommandesPliees)
+ self.inhibeExpand = False
if self.racine.children !=[] :
- #self.editor.initSplitterSizes(3)
if self.editor.maConfiguration.afficheCommandesPliees : self.racine.children[0].plieToutEtReaffiche()
- else : self.racine.children[0].deplieToutEtReaffiche()
+ else : self.racine.children[0].deplieToutEtReaffiche()
self.racine.children[0].fenetre.donnePremier()
else :
- #self.editor.initSplitterSizes(2)
self.racine.affichePanneau()
- #print self.editor.splitter.sizes()
- #PNPNPN
- #pdb.set_trace()
def contextMenuEvent(self,event) :
- #print "contextMenuEvent"
- coord=event.globalPos()
- item= self.currentItem()
+ #---------------------------------
+ coord = event.globalPos()
+ item = self.currentItem()
self.handleContextMenu(item,coord)
def handleContextMenu(self,item,coord):
+ #-------------------------------------
"""
Private slot to show the context menu of the listview.
@param coord the position of the mouse pointer (QPoint)
Attention : existeMenu permet de savoir si un menu est associe a cet item
"""
- #print "handleContextMenu"
+ #print ("handleContextMenu")
if item == None : return
- self.itemCourant=item
+ self.itemCourant = item
if item.existeMenu == 0 : return
+
if item.menu == None:
item.createPopUpMenu()
+ # PNPN reflechir a qqchose de generique pour remplacer cette fonctionnalite
if item.menu != None:
if item.item.getNom() == "DISTRIBUTION" and item.item.isValid() :
item.Graphe.setEnabled(1)
def handleCollapsedItem(self,item):
- #print "dans CollapsedItem", self.inhibeExpand
+ #----------------------------------
+ #print ("dans CollapsedItem", self.inhibeExpand )
if self.inhibeExpand == True : return
- self.itemCourant=item
+
# On traite le cas de l item non selectionne
- itemParent=item
- while not (hasattr (itemParent,'getPanel')) :
- itemParent=itemParent.treeParent
+ self.itemCourant = item
+ while not (hasattr (itemParent,'getPanel')) : itemParent=itemParent.treeParent
if self.tree.node_selected != itemParent :
item.setExpanded(False)
return
- itemParent=item
+ itemParent = item
item.setPlie()
item.plieToutEtReaffiche()
item.select()
def handleExpandedItem(self,item):
+ #----------------------------------
#print ("handleExpandedItem pour ", item.item.nom, self.inhibeExpand)
#import traceback
#traceback.print_stack()
if self.inhibeExpand == True : return
- self.itemCourant=item
+
+ self.itemCourant = item
self.inhibeExpand = True
- itemParent=item
+ itemParent = item
while not (hasattr (itemParent,'getPanel')) :
if itemParent.plie==True : itemParent.setDeplie()
itemParent=itemParent.treeParent
def handleOnItem(self,item,int):
+ #----------------------------------
#print ("je passe dans handleOnItem pour ",self, item.item.nom, item, item.item, item.item.getLabelText())
from InterfaceQT4 import composimp
self.inhibeExpand = True
- self.itemCourant=item
- itemParent=item
+ self.itemCourant = item
+ itemParent = item
while not (hasattr (itemParent,'getPanel')) :
if itemParent.plie==True : itemParent.setDeplie()
if itemParent.fenetre != self.editor.fenetreCentraleAffichee :
estUneFeuille=(isinstance(item,composimp.Node))
- # il faut afficher le parent
+ # il faut afficher le parent
+ # Attention - Specification particuliere pour MT qui permet de nn afficher qu 1 niveau
+ # le catalogue contient cette indication dans fenetreIhm
if estUneFeuille and itemParent.fenetreIhm=='deplie1Niveau' :
itemAvant.afficheCeNiveau()
return
elif (isinstance(item,composimp.Node)) and item.fenetre : item.fenetre.rendVisible()
- elif itemParent!=item:
- self.tree.handleExpandedItem(item)
- #item.fenetre.donnePremier()
- #item.fenetre.rendActif()
- #print 'il faut afficher le 1er'
+ elif itemParent!=item: self.tree.handleExpandedItem(item)
+ # aide
try :
fr = item.item.getFr()
chaineDecoupee= fr.split('\n')
if len(chaineDecoupee) > 3 :
txt='\n'.join(chaineDecoupee[0:2])+'...\nfull help : double clicked on validity chip of '+ str(item.item.nom)+ ' in central widget'
else : txt=fr
-
- if self.editor:
- self.editor.afficheCommentaire(str(txt))
+ if self.editor: self.editor.afficheCommentaire(str(txt))
except:
pass
+
item.select()
self.inhibeExpand = False
- #print "je mets inhibeExpand a false handleOnItem"
def choisitPremier(self,name):
+ #----------------------------
self.editor.layoutJDCCHOIX.removeWidget(self.racine.fenetre)
self.racine.fenetre.close()
new_node=self.racine.appendBrother(name,'after')
class JDCNode(QTreeWidgetItem,GereRegles):
#------------------------------------------
def __init__( self, treeParent, item, itemExpand=False, ancien=False ):
+ #----------------------------------------------------------------------
#print ("creation d'un noeud : ", item, " ",item.nom,"", treeParent, self)
#self.a=0
self.tree = self.treeParent.tree
self.editor = self.treeParent.editor
self.appliEficas = treeParent.appliEficas
- self.JESUISOFF=0
+ self.JESUISOFF = 0
self.firstAffiche = True
self.childrenComplete=[]
from InterfaceQT4 import compocomm
from InterfaceQT4 import compoparam
from InterfaceQT4 import composimp
- if (isinstance(self.item,compocomm.COMMTreeItem)) : name=tr("Commentaire")
- elif (isinstance(self.item,compoparam.PARAMTreeItem)) : name=tr(str(item.getLabelText()[0]))
- #else: name = tr(str(tr(item.getLabelText()[0]))+" :")
- else: name = tr(item.getLabelText()[0])
- if item.nom != tr(item.nom) : name = str(tr(item.nom)+" :")
- value = tr(str( item.getText() ) )
+ if (isinstance(self.item,compocomm.COMMTreeItem)) : name = tr("Commentaire")
+ elif (isinstance(self.item,compoparam.PARAMTreeItem)) : name = tr(str(item.getLabelText()[0]))
+ else : name = tr(item.getLabelText()[0])
+ if item.nom != tr(item.nom) : name = str(tr(item.nom)+" :")
+ value = tr(str(item.getText() ) )
# si specialisation de la fenetre
if self.item.object.definition == None : self.fenetreIhm = None
else : mesColonnes=(name,)
if self.treeParent.plie==True :
- self.plie = True
- self.appartientAUnNoeudPlie=True
+ self.plie = True
+ self.appartientAUnNoeudPlie = True
if self.treeParent.item.isMCList() : self.appartientAUnNoeudPlie = self.treeParent.appartientAUnNoeudPlie
else :
- self.plie = False
+ self.plie = False
self.appartientAUnNoeudPlie = False
#if item.nom == "POUTRE" :print "creation d'un noeud : ", item, " ",item.nom,"", self.treeParent, self.appartientAUnNoeudPlie , self.plie
def buildChildren(self,posInsertion=10000):
+ #------------------------------------------
""" Construit la liste des enfants de self """
""" Se charge de remettre les noeuds Expanded dans le meme etat """
#print ("*********** buildChildren ",self,self.item, self.item.nom)
else : self.listeItemExpanded.append(enfant.item)
for enfant in self.childrenComplete :
- parent=enfant.treeParent
+ parent = enfant.treeParent
parent.removeChild(enfant)
enfant.JESUISOFF=1
def chercheNoeudCorrespondant(self,objSimp):
+ #-------------------------------------------
sublist = self.item._getSubList()
for node in self.childrenComplete:
if node.item.object==objSimp : return node
def afficheCeNiveau(self):
+ #-------------------------
#print ('afficheCeNiveau pour ', self.item.nom, self.item.getLabelText())
for indiceWidget in range(self.editor.widgetCentraleLayout.count()):
widget=self.editor.widgetCentraleLayout.itemAt(indiceWidget)
self.editor.fenetreCentraleAffichee.deleteLater()
from monWidgetNiveauFact import MonWidgetNiveauFact, MonWidgetNiveauFactTableau
- maDefinition=self.item.get_definition()
- monObjet=self.item.object
+ maDefinition = self.item.get_definition()
+ monObjet = self.item.object
if maDefinition.fenetreIhm=='Tableau' : self.maFenetreCadre=MonWidgetNiveauFactTableau(self,self.editor,maDefinition,monObjet)
else : self.maFenetreCadre=MonWidgetNiveauFact(self,self.editor,maDefinition,monObjet)
- self.fenetre=self.maFenetreCadre
+ self.fenetre = self.maFenetreCadre
self.editor.widgetCentraleLayout.addWidget(self.maFenetreCadre)
self.editor.fenetreCentraleAffichee=self.maFenetreCadre
self.select()
def getPanelModifie(self):
+ #-------------------------
if self.fenetreIhm == None : return None
- if self.fenetreIhm=='deplie1Niveau':
+ if self.fenetreIhm =='deplie1Niveau':
from InterfaceQT4.monWidgetCommandeDeplie1Niveau import MonWidgetCommandeDeplie1Niveau
return MonWidgetCommandeDeplie1Niveau (self,self.editor ,self.item.object)
return None
def affichePanneau(self) :
- #if self.editor.code == 'ASTER' and not(self.item.isActif()) :
- # posera des pb si un code decide d appeler FIN un mot clef
- # on resoudera a ce moment la
- # pour l pas de poussiere sous le tapis
+ #-------------------------
#print ('_________________ds affichePanneau pour', self.item.nom)
+ # pour l instant pas d inactif
if not(self.item.isActif()) :
from .monWidgetInactif import MonWidgetInactif
self.fenetre = MonWidgetInactif(self,self.editor)
else:
itemParent=self
while not (hasattr (itemParent,'getPanel')) : itemParent=itemParent.treeParent
- if itemParent!=self :
+ if itemParent != self :
#print ('j appelle affichePanneau pour ', itemParent.item.nom , 'par', self.item.nom)
itemParent.affichePanneau()
#print ('fin _________________ds affichePanneau pour', self.item.nom)
return
- self.fenetre=self.getPanelModifie()
+
+ self.fenetre = self.getPanelModifie()
if self.fenetre == None : self.fenetre=self.getPanel()
self.editor.restoreSplitterSizes()
for indiceWidget in range(self.editor.widgetCentraleLayout.count()):
- widget=self.editor.widgetCentraleLayout.itemAt(indiceWidget)
+ widget = self.editor.widgetCentraleLayout.itemAt(indiceWidget)
self.editor.widgetCentraleLayout.removeItem(widget)
+
# ceinture et bretelle
#print 'old fenetre = ',self.editor.fenetreCentraleAffichee
if self.editor.fenetreCentraleAffichee != None :
def createPopUpMenu(self):
+ #-------------------------
#implemente dans les noeuds derives si necessaire
self.existeMenu = 0
def commentIt(self):
+ #-------------------------
"""
Cette methode a pour but de commentariser la commande pointee par self
"""
QMessageBox.critical( self.editor, "TOO BAD",str(e))
def unCommentIt(self):
+ #-------------------------
"""
Realise la decommentarisation de self
"""
QMessageBox.critical( self.editor, "Erreur !",str(e))
def addComment( self, after=True ):
+ #-----------------------------------
"""
Ajoute un commentaire a l'interieur du JDC :
"""
return self.appendBrother( COMMENT, pos )
def addParameters( self, after=True ):
+ #-------------------------------------
"""
Ajoute un parametre a l'interieur du JDC :
"""
def select( self ):
+ #------------------
"""
Rend le noeud courant (self) selectionne et deselectionne
tous les autres
#------------------------------------------------------------------
# Methodes de creation et destruction de noeuds
- # Certaines de ces methodes peuvent etre appelees depuis l'externe
#------------------------------------------------------------------
+
def appendBrother(self,name,pos='after',plier=False):
+ #----------------------------------------------------
"""
Permet d'ajouter un objet frere a l'objet associe au noeud self
par defaut on l'ajoute immediatement apres
if self.treeParent != self.vraiParent :
index = self.vraiParent.children.index(self)
- if pos == 'before': index = index
- elif pos == 'after': index = index +1
+ if pos == 'before' : index = index
+ elif pos == 'after' : index = index +1
return self.vraiParent.appendChild(name,pos=index,plier=plier)
else :
index = self.treeParent.children.index(self)
if pos == 'before': index = index
- elif pos == 'after': index = index +1
+ elif pos == 'after' : index = index +1
else:
print(six.text_type(pos), tr(" n'est pas un index valide pour appendBrother"))
return 0
return self.treeParent.appendChild(name,pos=index,plier=plier)
def verifiePosition(self,name,pos,aLaRacine=False):
+ #----------------------------------------------------
if name not in self.editor.readercata.Classement_Commandes_Ds_Arbre : return True
indexName=self.editor.readercata.Classement_Commandes_Ds_Arbre.index(name)
return True
def appendChild(self,name,pos=None,plier=False):
+ #------------------------------------------------
"""
Methode pour ajouter un objet fils a l'objet associe au noeud self.
On peut l'ajouter en debut de liste (pos='first'), en fin (pos='last')
self.editor.initModif()
- if pos == 'first':
- index = 0
- elif pos == 'last':
- index = len(self.children)
- elif type(pos) == int :
- # position fixee
- index = pos
- elif type(pos) == object:
- #elif type(pos) == types.InstanceType:
- # pos est un item. Il faut inserer name apres pos
- index = self.item.getIndex(pos) +1
- #elif type(name) == types.InstanceType:
- elif type(name) == object:
- index = self.item.getIndexChild(name.nom)
- else:
- index = self.item.getIndexChild(name)
+ if pos == 'first' : index = 0
+ elif pos == 'last' : index = len(self.children)
+ elif type(pos) == int : index = pos # position fixee
+ elif type(pos) == object : index = self.item.getIndex(pos) +1 # pos est un item. Il faut inserer name apres pos
+ elif type(name) == object : index = self.item.getIndexChild(name.nom)
+ else : index = self.item.getIndexChild(name)
# si on essaye d inserer a la racine
if (isinstance(self.treeParent,JDCTree) and index==0) :
verifiePosition=self.verifiePosition(name,'first',aLaRacine=True)
if not verifiePosition : return 0
- self.tree.inhibeExpand=True
- obj=self.item.addItem(name,index) # emet le signal 'add'
- if obj is None:obj=0
- if obj == 0:return 0
+ self.tree.inhibeExpand = True
+ obj = self.item.addItem(name,index) # emet le signal 'add'
+ if obj is None : obj=0
+ if obj == 0 :return 0
+
try :
#if 1 :
- child=self.children[index]
+ child = self.children[index]
if plier == True : child.setPlie()
else : child.setDeplie()
except :
child=self.children[index]
+
try :
if len(obj) > 1 : self.buildChildren()
except : pass
+
self.tree.inhibeExpand=False
#print (" fin append child")
return child
def deplace(self):
+ #-----------------
self.editor.initModif()
index = self.treeParent.children.index(self) - 1
if index < 0 : index =0
ret=self.treeParent.item.deplaceEntite(self.item.getObject())
def delete(self):
+ #----------------
"""
Methode externe pour la destruction de l'objet associe au noeud
"""
self.editor.initModif()
index = self.vraiParent.children.index(self) - 1
if index < 0 : index =0
+
recalcule=0
if self.item.nom == "VARIABLE" :
recalcule=1
jdc=self.item.jdc
+
ret,commentaire=self.vraiParent.item.suppItem(self.item)
- if ret==0 :
- self.editor.afficheInfos(commentaire,Qt.red)
- else :
- self.editor.afficheInfos(commentaire)
+ if ret==0 : self.editor.afficheInfos(commentaire,Qt.red)
+ else : self.editor.afficheInfos(commentaire)
self.treeParent.buildChildren()
if self.treeParent.childrenComplete : toselect=self.treeParent.childrenComplete[index]
- else: toselect=self.treeParent
+ else : toselect=self.treeParent
+
if recalcule : jdc.recalculeEtatCorrelation()
if ret==0 :
if self.treeParent.childrenComplete :
notdeleted.select()
else :
toselect.select()
+
from InterfaceQT4 import compojdc
# cas ou on detruit dans l arbre sans affichage
if isinstance(self.treeParent,compojdc.Node) :
self.treeParent.fenetre.reaffiche(toselect)
def deleteMultiple(self,liste=()):
+ #--------------------------------
"""
Methode externe pour la destruction d une liste de noeud
"""
toselect.select()
toselect.affichePanneau()
#
-# #------------------------------------------------------------------
- def onValid(self):
+# ------------------------------------------------------------------
+ def onValid(self):
+ #-----------------
#print ("onValid pour ", self.item.nom)
if self.JESUISOFF==1 : return
+
if hasattr(self,'fenetre') and self.fenetre:
- try :
- self.fenetre.setValide()
- except :
- # print "onValid pour ", self.item.nom, self,'pb'
- pass
+ try : self.fenetre.setValide()
+ except : pass
+ # PNPN lignes suivantes a repenser
if (self.item.nom == "VARIABLE" or self.item.nom == "DISTRIBUTION") and self.item.isValid():
- self.item.jdc.recalculeEtatCorrelation()
- if hasattr(self.item,'forceRecalcul'):
- self.forceRecalculChildren(self.item.forceRecalcul)
+ self.item.jdc.recalculeEtatCorrelation()
+ if hasattr(self.item,'forceRecalcul') : self.forceRecalculChildren(self.item.forceRecalcul)
self.editor.initModif()
self.updateNodeValid()
self.updateNodeLabel()
self.updateNodeTexte()
- def onReconstruit(self):
- print ("onReconstruire pour ", self.item.nom)
def onAdd(self,object):
- if self.JESUISOFF==1 : return
+ #----------------------
#print ("onAdd pour ", self.item.nom, object)
+ if self.JESUISOFF == 1 : return
self.editor.initModif()
self.updateNodes()
- # PN -- non necessaire si item=jdc
if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
def onSupp(self,object):
- if self.JESUISOFF==1 : return
+ #-----------------------
#print "onSup pour ", self.item.nom, object
+ if self.JESUISOFF==1 : return
self.editor.initModif()
self.updateNodes()
- # PN -- non necessaire si item=jdc
if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
def updateNodeValid(self):
+ #-----------------------
"""Cette methode remet a jour la validite du noeud (icone)
Elle appelle isValid
"""
- repIcon=self.appliEficas.repIcon
- couleur=self.item.getIconName()
+ repIcon = self.appliEficas.repIcon
+ couleur = self.item.getIconName()
monIcone = QIcon(repIcon+"/" + couleur + ".png")
self.setIcon(0,monIcone)
def updateNodeLabel(self):
+ #-------------------------
""" Met a jour le label du noeud """
#print "NODE updateNodeLabel", self.item.getLabelText()
labeltext,fonte,couleur = self.item.getLabelText()
self.setText(0, tr(labeltext))
def updateNodeLabelInBlack(self):
+ #-------------------------------
if hasattr(self.appliEficas,'noeudColore'):
self.appliEficas.noeudColore.setForeground(0,Qt.black)
self.appliEficas.noeudColore.updateNodeLabel
def updateNodeLabelInBlue(self):
+ #-------------------------------
if hasattr(self.appliEficas,'noeudColore'): self.appliEficas.noeudColore.setForeground(0,Qt.black)
self.setForeground(0,Qt.blue)
labeltext,fonte,couleur = self.item.getLabelText()
self.appliEficas.noeudColore=self
def updatePlusieursNodeLabelInBlue(self,liste):
+ #----------------------------------------------
if hasattr(self.appliEficas,'listeNoeudsColores'):
for noeud in self.appliEficas.listeNoeudsColores:
noeud.setTextColor( 0,Qt.black)
self.appliEficas.listeNoeudsColores.append(noeud)
def updateNodeTexteInBlack(self):
+ #--------------------------------
""" Met a jour les noms des SD et valeurs des mots-cles """
self.setTextColor( 1,Qt.black )
value = self.item.getText()
self.setText(1, value)
def updateNodeTexte(self):
+ #----------------------------
""" Met a jour les noms des SD et valeurs des mots-cles """
value = self.item.getText()
self.setText(1, value)
def updateNodeTexteInBlue(self):
+ #--------------------------------
self.setTextColor( 1,Qt.blue )
value = self.item.getText()
self.setText(1, value)
def updateNodes(self):
+ #--------------------------------
#print 'NODE updateNodes', self.item.getLabelText()
self.buildChildren()
def updateValid(self) :
+ #----------------------
"""Cette methode a pour but de mettre a jour la validite du noeud
et de propager la demande de mise a jour a son parent
"""
#print "NODE updateValid", self.item.getLabelText()
self.updateNodeValid()
- try :
- self.treeParent.updateValid()
- except:
- pass
+ try : self.treeParent.updateValid()
+ except: pass
def updateTexte(self):
+ #----------------------
""" Met a jour les noms des SD et valeurs des mots-cles """
#print "NODE updateTexte", self.item.getLabelText()
- self.updateNodeVexte()
+ self.updateNodeTexte()
if self.isExpanded() :
for child in self.children:
if child.isHidden() == false : child.updateTexte()
def forceRecalculChildren(self,niveau):
- if self.state=='recalcule' :
- self.state=""
+ #--------------------------------------
+ if self.state == 'recalcule' :
+ self.state = ""
return
self.state='recalcule'
if hasattr(self.item,'object'):
def doPaste(self,node_selected,pos='after'):
+ #--------------------------------------------
"""
Declenche la copie de l'objet item avec pour cible
l'objet passe en argument : node_selected
return child
def doPasteCommande(self,objet_a_copier,pos='after'):
+ #-----------------------------------------------------
"""
Realise la copie de l'objet passe en argument qui est necessairement
un onjet
return child
def doPastePremier(self,objet_a_copier):
+ #---------------------------------------
"""
Realise la copie de l'objet passe en argument (objet_a_copier)
"""
return child
def plieToutEtReafficheSaufItem(self, itemADeplier):
+ #---------------------------------------------------
self.inhibeExpand=True
from InterfaceQT4 import compojdc
if (isinstance(self, compojdc.Node)) :
self.inhibeExpand=False
def plieToutEtReaffiche(self):
+ #-----------------------------
#print ('plieToutEtReaffiche', self.item.getNom())
from InterfaceQT4 import compojdc
if (isinstance(self, compojdc.Node)) : self.affichePanneau(); return
#print ("fin plieToutEtReaffiche", self.item.getNom())
def deplieToutEtReaffiche(self):
+ #-----------------------------
self.editor.deplier = True
for item in self.children :
item.setDeplie()
self.affichePanneau()
def setPlie(self):
+ #-----------------
#print "je mets inhibeExpand a true dans setPlie"
#print ("je suis dans plieTout", self.item.getNom())
from . import compojdc
# item.appartientAUnNoeudPlie=False
def setPlieChildren(self):
+ #-----------------------------
self.plie=True
from InterfaceQT4 import composimp
if isinstance(self,composimp.Node) : return
def setDeplie(self):
+ #-----------------------------
#print "dans setPlieChildren pour", self.item.nom
#print "je mets inhibeExpand a true dans setDeplie"
self.tree.inhibeExpand=True
#print "je mets inhibeExpand a false dans setDePlie"
def setDeplieChildren(self):
+ #-----------------------------
#print "dans setDeplieChildren appartientAUnNoeudPlie=False ", self.item.getLabelText()
for c in self.children :
c.setDeplieChildren()
c.plie=False
def selectAvant(self):
+ #-----------------------------
i=self.item.jdc.etapes.index(self.item.object)
- try :
- cherche=self.item.jdc.etapes[i-1]
- except :
- cherche=self.item.jdc.etapes[-1]
+ try : cherche=self.item.jdc.etapes[i-1]
+ except : cherche=self.item.jdc.etapes[-1]
node=None
for i in self.tree.racine.children :
if i.item.object== cherche :
node.select()
def selectApres(self):
+ #---------------------
i=self.item.jdc.etapes.index(self.item.object)
- try :
- cherche=self.item.jdc.etapes[i+1]
- except :
- cherche=self.item.jdc.etapes[0]
+ try : cherche=self.item.jdc.etapes[i+1]
+ except : cherche=self.item.jdc.etapes[0]
node=None
for i in self.tree.racine.children :
if i.item.object== cherche :
node.affichePanneau()
node.select()
- def ouvreLesNoeudsDsLArbre(self):
- return
- self.inhibeExpand = True
- for i in range(self.childCount()):
- self.child(i).inhibeExpand=True
- self.child(i).setExpanded(True)
- self.child(i).ouvreLesNoeudsDsLArbre()
- self.child(i).inhibeExpand=False
- self.inhibeExpand = False
dicoTechnicalUse = {}
dicoEquations = {}
+dicoConstantesArrhenius = {}
+dicoConstantesNonArrhenius = {}
dicoEquationsParTechnicalUseParModelePartypeDEquation={}
for technicalUse in dicoInfoGenerales['Modele_TechnicalUse'] :
dicoTechnicalUse[technicalUse] = filtre_calculation_mechanistic(database, technicalUse)
dicoEquations[technicalUse] = filtre_data_model(database, 'mechanistic_models',technicalUse)
+#print ('dicoEquations', 'cable', dicoEquations['cable']['radio_oxydation_PE_tetra_stabilization']['equa_diff']['stabilization_PO2_POOBAH2__POO2AH2'].keys())
-#print (dicoEquations)
+import pprint
+#pprint.pprint (dicoEquations)
#print (1,dicoTechnicalUse)
-print (dicoEquations.keys())
+#print (dicoEquations.keys())
#print (dicoEquations['pipes'])
-#print (dicoEquations['cable']['base']['initiation'])
+#pprint.pprint (dicoEquations['cable']['base']['initiation'])
#print (dicoTechnicalUse.keys())
# --------------------------- blocPourCalculationForMechanisticSelonModeleTechnicalUse ------------
v=dicoEquations[technicalUse][modelName]['class'].coef[0][constante]
if len(v) == 2 :
dicoArgsArrhenius [constante] = SIMP(statut ="o",typ=Tuple(2),validators = VerifTypeTuple(('R','R')),defaut =v )
+ dicoConstantesArrhenius[constante ] =v
else :
dicoArgs [constante] = SIMP(statut ="o",typ='R',defaut =v[0] )
+ dicoConstantesNonArrhenius[constante ] =v[0]
ConstantesNonArrhenius = FACT(statut = 'o',**dicoArgs)
ConstantesArrhenius = FACT(statut = 'o',**dicoArgsArrhenius)
Constantes = FACT(statut = 'o',ConstantesNonArrhenius = ConstantesNonArrhenius, ConstantesArrhenius=ConstantesArrhenius)
return FACT(statut = 'o',Equations = Equations, Constantes=Constantes)
def calculAgingParameters():
- Time = SIMP(statut='o',typ='R',)
- Temperature = SIMP(statut='o',typ='R',)
- DoseRate = SIMP(statut='o',typ='R',)
- Thickness = SIMP(statut='o',typ='R',)
+ Time = SIMP(statut='o',typ='R')
+ Temperature = SIMP(statut='o',typ='R')
+ DoseRate = SIMP(statut='o',typ='R')
+ Thickness = SIMP(statut='o',typ='R')
return FACT(statut='o', Time=Time, Temperature=Temperature,DoseRate=DoseRate,Thickness=Thickness)
#dicoArgs['Dicretization'] = SIMP(statut='o',typ='R',)
condition = "TechnicalUse == '" + technicalUse + "'"
ModelName = SIMP(statut='o',typ='TXM', into = dicoTechnicalUse[technicalUse].keys(),)
- SimulationName = SIMP(statut='o',typ='TXM')
- OutPutFolder = SIMP(statut='o',typ = "Repertoire")
+ SimulationName = SIMP(statut='o',typ='TXM' )
+ OutPutFolder = SIMP(statut='o',typ = "Repertoire", defaut ='/tmp')
for modeleName in dicoTechnicalUse[technicalUse].keys() :
# modeleName est le modele par exmple radio_oxydation_PE_tetra_stabilization
for constituant in laClasse.constituants :
monIndex=laClasse.constituants.index(constituant)
valdefaut=laClasse.equation[monIndex]
- monSimp=SIMP(statut = 'o', typ = bool, defaut=True)
- lesArgs[constituant]=monSimp
-
- lesArgsBloc={}
- nomEquation = ' differentiel_'+constituant
- monSimp2 = SIMP(statut= 'o',typ= 'TXM', defaut = valdefaut)
- laCondition= constituant+' == True'
- lesArgsBloc['condition']=laCondition
- lesArgsBloc[nomEquation]=monSimp2
- nomBloc = 'b_'+constituant
- leBloc = BLOC(**lesArgsBloc)
- lesArgs[nomBloc]=BLOC(**lesArgsBloc)
- return FACT(**lesArgs)
+ #monSimp=SIMP(statut = 'o', typ = bool, defaut=True)
+ #lesArgs[constituant]=monSimp
+
+ #lesArgsBloc={}
+ #nomEquation = ' differentiel_'+constituant
+ #monSimp2 = SIMP(statut= 'o',typ= 'TXM', defaut = valdefaut)
+ #laCondition= constituant+' == True'
+ #lesArgsBloc['condition']=laCondition
+ #lesArgsBloc[nomEquation]=monSimp2
+ #nomBloc = 'b_'+constituant
+ #leBloc = BLOC(**lesArgsBloc)
+ #lesArgs[nomBloc]=BLOC(**lesArgsBloc)
+ #return FACT(**lesArgs)
+chercheConstituant(monMechanisticEquation)
def chercheConstantes(laClasse):
lesArgs={}
lesArgs[constante]=monSimp
return FACT(**lesArgs)
-
def calculBlocAnalyticalEquationsForModification():
+ typeReaction = SIMP (statut='o', typ='TXM', into = dicoInfoGenerales['Type_D_Equation'])
+ monDicoEquation = filtre_data_model(database,'mechanistic_models', 'cable')['base']
+ dicoEquation = {}
+ for typeDeLaReaction in dicoInfoGenerales['Type_D_Equation']:
+ dicoEquationParReaction = {}
+ laCondition = "typeReaction == '" + typeDeLaReaction + "'"
+ dicoParUse = monDicoEquation[typeDeLaReaction]
+ # duplication pour ordre
+ listeAModifier = []
+ for equationComplete in dicoParUse.keys():
+ nom,params = dicoParUse[equationComplete].split("\t\t")
+ listeAModifier.append(nom)
+ toModify = SIMP (statut='o', typ='TXM', homo = 'SansOrdreNiDoublon', into=listeAModifier)
+
+ for equationComplete in dicoParUse.keys():
+ nom, params = dicoParUse[equationComplete].split("\t\t")
+ laConditionEquation = "ToModify == '" + nom + "'"
+ name = SIMP(statut='o', typ='TXM',defaut=nom)
+ params = params[1:-1]
+ lesParams = params.split(',')
+ dicoArgsPourCst = {}
+ for p in lesParams :
+ p1 = p[1:-1]
+ while p1[0] in ("'"," ") : p1=p1[1:]
+ nomConstante = SIMP(statut ="o", typ ='TXM', defaut = p1)
+ if p1 in dicoConstantesArrhenius.keys() : dejaArrhenius = True
+ else : dejaArrhenius = False
+ arrhenius = SIMP(statut ="o", typ =bool, defaut = dejaArrhenius)
+ if p1 in dicoConstantesArrhenius.keys() :
+ monBlocArrhenius=BLOC(condition = "arrhenius == True", value = SIMP(statut ="o",typ=Tuple(2),validators = VerifTypeTuple(('R','R')),defaut = dicoConstantesArrhenius[p1] ))
+ monBlocNonArrhenius=BLOC(condition = "arrhenius == False", value = SIMP(statut ="o",typ='R' ))
+ elif p1 in dicoConstantesNonArrhenius.keys() :
+ monBlocArrhenius=BLOC(condition = "arrhenius == True", value = SIMP(statut ="o",typ=Tuple(2),validators = VerifTypeTuple(('R','R'))))
+ monBlocNonArrhenius=BLOC(condition = "arrhenius == False", value = SIMP(statut ="o",typ='R',defaut = dicoConstantesNonArrhenius[p1] ))
+ else :
+ dicoArgsPourCst[p1]=FACT(statut ='o', nomConstante = nomConstante, arrhenius=arrhenius, b_arrhenus=monBlocArrhenius,b_nonArrhenius=monBlocNonArrhenius)
+
+ dicoEquationParReaction[nom]=BLOC(condition=laConditionEquation, name=name,**dicoArgsPourCst)
+ dicoEquation['b_'+typeDeLaReaction]=BLOC(condition=laCondition, ToModify=toModify, **dicoEquationParReaction)
+ return FACT(statut='o', typeReaction = typeReaction, **dicoEquation)
+
+
+def OldcalculBlocAnalyticalEquationsForModification():
# PN refaire l algo
# print (dicoEquations['cable']['base']['initiation'])
#for technicalUse in dicoInfoGenerales['Modele_TechnicalUse']:
def blocCreationEquation():
- ChemicalFormulation = SIMP(statut='o', typ='TXM', defaut = monMechanisticEquation.representation )
- Aging_Type = SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('All', 'thermo', 'radio'), defaut = monMechanisticEquation.type_vieil[0])
- Reaction_Type = SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=dicoInfoGenerales['Type_D_Equation'], defaut = monMechanisticEquation.type_react)
- print (Reaction_Type)
- print (dicoEquationsParTechnicalUseParModelePartypeDEquation)
- return FACT(statut = 'o', ChemicalFormulation=ChemicalFormulation, Aging_Type=Aging_Type, Reaction_Type=Reaction_Type)
+ Aging_Type = SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('All', 'thermo', 'radio'), )
+ typeReaction = SIMP (statut='o', typ='TXM', into = dicoInfoGenerales['Type_D_Equation'])
+ lesArgsBloc={}
+
+ for typeDeLaReaction in dicoInfoGenerales['Type_D_Equation']:
+ laConditionBloc = "TypeReaction == '" + typeDeLaReaction + "'"
+ dicoListeEquation=dicoEquations['cable']['base'][typeDeLaReaction]
+ ListeEquation = []
+ for l in dicoListeEquation.keys() : ListeEquation.append(l.split('_')[1])
+ equationsAModifier=SIMP (statut='o', typ='TXM', max="**", homo = 'SansOrdreNiDoublon', into=ListeEquation)
+ lesArgsBloc['b_create_'+typeDeLaReaction]=BLOC(condition=laConditionBloc, equationsAModifier=equationsAModifier)
+ #print (lesArgsBloc)
+
+ return FACT(statut = 'o', Aging_Type=Aging_Type, TypeReaction=typeReaction, **lesArgsBloc)
+
+
+#import pprint
+#pprint.pprint (filtre_data_model(database,'mechanistic_models', 'cable'))
# ------------------------------------------------------------------------
- Type_chgt = SIMP (statut= 'o',typ= 'TXM',into=('modify equation', 'create equation', 'modify model', 'create model'),),
-
- b_creation_equation = BLOC (condition = 'Type_chgt == "create equation"',
- # toutes les valeurs sont par defaut class_data.Equation
- # generer le catalogue avec un fact
- # Aging_Type type_vieil,
- Creation_Equation = blocCreationEquation(),
- #Creation_Equation = FACT ( statut = 'o',
- # ChemicalFormulation = SIMP(statut='o', typ='TXM', defaut = monMechanisticEquation.representation ),
- # Aging_Type = SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('All', 'thermo', 'radio'), defaut = monMechanisticEquation.type_vieil[0]),
- # blocCreationEquation = blocCreationEquation()
-# Reaction_Type = SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=dicoInfoGenerales['Type_D_Equation'], defaut = monMechanisticEquation.type_react),
-# Constituants = chercheConstituant(monMechanisticEquation),
-# New = SIMP (statut = 'o', typ = bool, defaut=False),
-# b_new = BLOC(condition = " New == True" ,
-# Constituant = FACT ( statut = 'o', min=1, max='**',
-# Name = SIMP(statut= 'o',typ= 'TXM'),
-# Differential_Equation = SIMP(statut= 'o',typ= 'TXM'),
-# ),
-# ), # b new
-#
-# Constantes = chercheConstantes(monMechanisticEquation),
-# New_Cst = SIMP (statut = 'o', typ = bool, defaut=False),
-# b_new_cst = BLOC(condition = " New_Cst == True" ,
-# Constante = FACT ( statut = 'o', min=1, max='**',
-# Name = SIMP (statut = 'o', typ = 'TXM'),
-# ), # fin constante
-# ), #fin b_new
-#
-# Arrhenius = SIMP (statut = 'o', typ = bool, defaut=monMechanisticEquation.arrhenius),
-# Comment = SIMP(statut= 'o',typ= 'TXM', defaut = monMechanisticEquation.comment),
-# ), # fin creation mechanistic model
+ Manage_Database = SIMP (statut= 'o',typ= 'TXM',into=('modify equation', 'create equation', 'modify model', 'create model'),),
+
+ b_creation_equation = BLOC (condition = 'Manage_Database == "create equation"',
+ Creation_Equation = FACT ( statut = 'o',
+ Aging_Type = SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('All', 'thermo', 'radio'),),
+ typeReaction = SIMP (statut='o', typ='TXM', into = dicoInfoGenerales['Type_D_Equation']),
+ ChemicalFormulation = SIMP(statut='o', typ='TXM', ),
+ Constante = FACT (statut ='o', min=1, max = "**",
+ Name = SIMP (statut = 'o', typ = 'TXM'),
+ Arrhenius = SIMP (statut = 'o', typ = bool),
+ b_Arrhenius = BLOC (condition = 'Arrhenius == True',
+ A = SIMP (statut = 'o', typ = 'R'),
+ EA = SIMP (statut = 'o', typ = 'R'),
+ ),
+ b_Non_Arrhenius = BLOC (condition = 'Arrhenius == False',
+ k = SIMP (statut = 'o', typ = 'R'),
+ ),
+ ),
+ ),
), # fin b_create_equation
-
- b_modify_equation = BLOC (condition = 'Type_chgt == "modify equation"',
-# les valeurs par defaut seront lues dans la base de données
- Filtre = calculBlocAnalyticalEquationsForModification(),
-
- #ChemicalFormulation = SIMP(statut='o', typ='TXM', defaut = 'POOH -> 2P'),
- Modification = FACT (statut='o',
- ChemicalFormulation = SIMP(statut='o', typ='TXM', ), # classe.representation
- Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=dicoInfoGenerales['Type_D_Equation']), # classe.type_react
- Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('All', 'thermo', 'radio'),), # classe.type_vieil
-
- Constituants = FACT ( statut = 'o', # classe.constituants --> liste de nom. les equations sont dans le meme ordre self.equation
- POOH = SIMP (statut = 'o', typ = bool, defaut=False),
- b_pooh = BLOC(condition = " POOH == True" ,
- Differential_Equation_POOH = SIMP(statut= 'o',typ= 'TXM', defaut = '-ku1*POOH'),
- ), # Fin b_pooh
- PO = SIMP (statut = 'o', typ = bool, defaut=False),
- b_po = BLOC(condition = " PO == True" ,
- Differential_Equation_PO = SIMP(statut= 'o',typ= 'TXM', defaut = '-ku1*POOH'),
- ), # Fin b_po
- New = SIMP (statut = 'o', typ = bool, defaut=False),
- b_new = BLOC(condition = " New == True" ,
- Constituant = FACT ( statut = 'o', min=1, max='**',
- Name = SIMP (statut = 'o', typ = 'TXM'),
- Differential_Equation = SIMP(statut= 'o',typ= 'TXM'),
- ), # Fin Constituant
- ), # Fin b_new
- ),# Fin Constituants
-
- Constantes = FACT ( statut = 'o', # self.const_cine_nom
- KU1 = SIMP (statut = 'o', typ = bool, defaut=False),
- New = SIMP (statut = 'o', typ = bool, defaut=False),
- b_new = BLOC(condition = " New == True" ,
- Constante = FACT ( statut = 'o', min=1, max='**',
- Name = SIMP (statut = 'o', typ = 'TXM'),
- ), # fin constante
- ), #fin b_new
- ), # fin constantes
- Arrhenius = SIMP (statut = 'o', typ = bool, ), # classe.arrhenius[0]
- Comment = SIMP(statut= 'o',typ= 'TXM',), # classe.comment
- ), # fin modification
+ b_modify_equation = BLOC (condition = 'Manage_Database == "modify equation"',
+ Modification = calculBlocAnalyticalEquationsForModification(),
+ #Constantes = FACT ( statut = 'o', # self.const_cine_nom
+ # New = SIMP (statut = 'o', typ = bool, defaut=False),
+ # b_new = BLOC(condition = " New == True" ,
+ # Constante = FACT ( statut = 'o', min=1, max='**',
+ # Name = SIMP (statut = 'o', typ = 'TXM'),
+ # ), # fin constante
+ # ), #fin b_new
+ # ), # fin constantes
), # fin b_modify_equation
# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2017 EDF R&D
+# Copyright (C) 2007-2019 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
self.cata=self.appliEficas.readercata.cata
self.initDico()
self.text=PythonGenerator.gener(self,obj,format)
- self.textePourRun =''
- if obj.isValid() :self.genereExeMap()
+ if obj.isValid() :self.genereTexte(obj)
return self.text
+ def initDico(self) :
+ self.texteInput = ""
+ self.dictParam={}
+ self.dictValeur={}
+ self.listeEquations=[]
+ self.typeEtude = ""
+
- def genereExeMap(self) :
+ def genereTexte(self,obj) :
+ print ('genereTexte', self.typeEtude)
+ if self.typeEtude == "Calculation" : self.genereCalculation()
+
+
+ def generPROC_ETAPE(self,obj):
+ s=PythonGenerator.generPROC_ETAPE(self,obj)
+ if obj.nom == "Calculation_for_Mechanistic" : print ('hjkhjkh');self.typeEtude="Calculation"
+ return s
+
+ def genereCalculation(self) :
'''
Prepare le contenu du fichier de parametres python
'''
- self.texteEXE = ""
- self.texteEXE += self.genereCsv()
- self.texteEXE += self.genereCalc()
- self.texteEXE += self.txtNomCst
- self.texteEXE += self.txtVal
- self.texteEXE += self.txtValAct
- self.texteEXE += self.txtNomCstNA
- self.texteEXE += self.txtValNA
- self.texteEXE += self.txtInitName
- self.texteEXE += self.txtInitVal
- self.texteEXE += self.genereEquations()
- self.textePourRun = self.texteEXE
- #print (self.texteEXE)
+ self.texteInput = ""
+ self.texteInput += self.genereCsv()
+ self.texteInput += self.genereCalculationParams()
+ self.texteInput += self.txtNomCst
+ self.texteInput += self.txtVal
+ self.texteInput += self.txtValAct
+ self.texteInput += self.txtNomCstNA
+ self.texteInput += self.txtValNA
+ self.texteInput += self.txtInitName
+ self.texteInput += self.txtInitVal
+ self.texteInput += self.genereEquations()
+ print (self.texteInput)
+ def writeDefault(self, fn):
+ # normalement c_solver_polymer_kinetics_myStudy.input ou myStudy est le nom de l etude
+ fileInput = fn[:fn.rfind(".")] + '.input'
+ f = open( str(fileInput), 'wb')
+ f.write( self.texteInput )
+ f.close()
- def genereCalc(self) :
+ def genereCalculationParams(self) :
txtNom = "calculation_parameter_names = [ "
txtVal = "calculation_parameters = [ "
for param in ('Time' , 'Temperature', 'DoseRate', 'Thickness') :
if param in self.dictValeur.keys() :
txtNom += "'"+param + "', "
txtVal += str(self.dictValeur[param]) + ", "
+ # on enleve les dernieres , et on ferme
+ txtNom = txtNom[0:-2]
txtNom += "]\n"
+ txtVal = txtVal[0:-2]
txtVal += "]\n"
txt = txtNom + txtVal
return txt
def genereEquations(self) :
txt="equation =["
index=0
+ TechnicalUse = self.dictValeur['TechnicalUse']
+ ModelName = self.dictValeur['ModelName']
for param in self.listInitialParameters:
- print (param)
- txt+= 'Dy[j*5 + '+str(index)+ '] = '
- txt+=","
- #if obj.nom in( 'initiation','propagation','termination','stabilization') :
- # for objFils in obj.data:
- # for mc in objFils.mcListe :
- # self.txtEquations += "'" + mc.nom + "', "
- txt=txt[0:-1]
+ print ('*******************************************')
+ print (' je traite ', param , 'index : ', index)
+ trouveParam=False
+
+ if index != 0 : txtParam = 'Dy[j*5 + '+str(index)+ '] = '
+ else : txtParam = 'Dy[j*5] = '
+
+ for equation in self.listeEquations :
+ if param in (self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation].keys()):
+ print ('____________ trouve : ', param , 'in ', equation, ' ', self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param])
+ trouveParam = True
+ if self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param][0] == '-' :
+ txtParam += ' ' + self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param]
+ else :
+ if index != 0 :
+ txtParam += ' + ' + self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param]
+ else :
+ txtParam += self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param]
+ print (' txtParam intermediaire ', txtParam)
+
+ if trouveParam :
+ txtParam = txtParam + ", "
+ txt += txtParam
+ index = index+1
+ print (txtParam)
+ print ('fin param', param, 'trouve ', trouveParam, '___________________________')
+ print ('*************************************************')
+ print (' ')
+ print ('_________________fin for')
+ txt=txt[0:-3]
txt+="]\n"
return txt
txt += 'csv_output_file_name = ' + self.dictValeur['OutPutFolder'] + '/c_solver_stiff_ode_1d_' + self.dictValeur['SimulationName']+ '.csv\n'
return txt
- def initDico(self) :
- if not hasattr(self,'schema') : self.schema=""
- self.dictParam={}
- self.dictValeur={}
-
- def writeDefault(self, fn):
- fileEXE = fn[:fn.rfind(".")] + '.py'
- f = open( str(fileEXE), 'wb')
- f.write( self.texteEXE )
- f.close()
def generMCList(self,obj):
s=PythonGenerator.generMCList(self,obj)
self.txtNomCst += "'" + mc.nom + "', "
self.txtVal += str(mc.valeur[0]) + ", "
self.txtValAct += str(mc.valeur[1]) + ", "
+ self.txtNomCst = self.txtNomCst[0:-2]
+ self.txtVal = self.txtVal[0:-2]
+ self.txtValAct = self.txtValAct [0:-2]
self.txtNomCst += ']\n'
self.txtVal += ']\n'
self.txtValAct += ']\n'
for mc in objFils.mcListe :
self.txtNomCstNA += "'" + mc.nom + "', "
self.txtValNA += str(mc.valeur) + ", "
+ self.txtNomCstNA = self.txtNomCstNA[0:-2]
+ self.txtValNA = self.txtValNA[0:-2]
self.txtNomCstNA += ']\n'
self.txtValNA += ']\n'
self.txtInitName += "'" + mc.nom + "', "
self.txtInitVal += str(mc.valeur) + ", "
self.listInitialParameters.append(mc.nom)
+ self.txtInitName = self.txtInitName[0:-2]
+ self.txtInitVal = self.txtInitVal[0:-2]
self.txtInitName += ']\n'
self.txtInitVal += ']\n'
+ if obj.nom in( 'initiation','propagation','termination','stabilization') :
+ for o in obj :
+ for mc in o.mcListe :
+ nom=mc.nom.replace (' ','').replace ('+','_').replace ('-','_').replace ('>','_').replace('(','').replace(')','').replace('*','').replace('[','').replace(']','')
+ nom=obj.nom+'_'+nom
+ self.listeEquations.append(nom )
return s
def generMCSIMP(self,obj) :
self.dictValeur[obj.nom]=obj.valeur
return s
-
- def generRUN(self,obj,schema):
- if not(obj.isValid()) :
- print ("TODO TODO TODO")
- self.texteEXE=""
- self.schema=schema
- textComm=self.gener(obj)
- return self.texteEXE