if self.inhibeExpand == True : return
# On traite le cas de l item non selectionne
itemParent=item
- while not (hasattr (itemParent,'getPanel2')) :
+ while not (hasattr (itemParent,'getPanel')) :
itemParent=itemParent.treeParent
if self.tree.node_selected != itemParent :
item.setExpanded(False)
if self.inhibeExpand == True : return
#print "apres if"
itemParent=item
- while not (hasattr (itemParent,'getPanel2')) :
+ while not (hasattr (itemParent,'getPanel')) :
if itemParent.plie==True : itemParent.setDeplie()
itemParent=itemParent.treeParent
#print "apres if"
self.itemCourrant=item
itemParent=item
#print self.itemCourrant
- while not (hasattr (itemParent,'getPanel2')) :
+ while not (hasattr (itemParent,'getPanel')) :
if itemParent.plie==True : itemParent.setDeplie()
itemParent=itemParent.treeParent
#print itemParent.item.nom
PARAMETERS = "PARAMETRE"
class JDCNode(QTreeWidgetItem,GereRegles):
- def __init__( self, treeParent, item):
+ def __init__( self, treeParent, item, itemExpand=False, ancien=False ):
#print "creation d'un noeud : ", item, " ",item.nom,"", treeParent, self
- self.a=0
+ #self.a=0
self.item = item
self.vraiParent = treeParent
self.treeParent = treeParent
else :
self.plie = False
self.appartientAUnNoeudPlie = False
+ if ancien and itemExpand : self.plie = False
+ if ancien and not itemExpand : self.plie = True
+
from InterfaceQT4 import compobloc
from InterfaceQT4 import compomclist
""" Se charge de remettre les noeuds Expanded dans le meme etat """
#print "*********** build_children ",self,self.item, self.item.nom
- listeExpanded=[]
+ self.listeItemExpanded=[]
+ self.listeItemPlie=[]
for enfant in self.childrenComplete :
- #if enfant.isExpanded():
- # if self.childrenComplete.index(item) < posInsertion :
- # listeExpanded.append(self.childrenComplete.index(item))
- # print dir(item.item )
- # else :
- # listeExpanded.append( self.childrenComplete.index(item) +1)
-
+ if enfant.isExpanded() : self.listeItemExpanded.append(enfant.item)
+ if not(enfant.isExpanded()) : self.listeItemPlie.append(enfant.item)
+ for enfant in self.childrenComplete :
p=enfant.vraiParent
parent=enfant.treeParent
parent.removeChild(enfant)
-
enfant.JESUISOFF=1
+
- #print listeExpanded
self.children = []
self.childrenComplete = []
sublist = self.item._GetSubList()
ind=0
+
for item in sublist :
- nouvelItem=item.itemNode(self,item)
+ itemExpand=False
+ ancien=False
+ if item in self.listeItemExpanded : itemExpand=True; ancien=True
+ if item in self.listeItemPlie : itemExpand=False; ancien=True
+ nouvelItem=item.itemNode(self,item,itemExpand,ancien)
self.children.append(nouvelItem)
+ #print "fin *********** build_children ",self,self.item, self.item.nom
+
def chercheNoeudCorrespondant(self,objSimp):
sublist = self.item._GetSubList()
def affichePanneau(self) :
+ #print " affichePanneau " , self.item.nom
if self.item.isactif():
itemParent=self
- while not (hasattr (itemParent,'getPanel2')) :
- itemParent=itemParent.treeParent
+ while not (hasattr (itemParent,'getPanel')) : itemParent=itemParent.treeParent
if itemParent!=self :
itemParent.affichePanneau()
return
- self.fenetre=self.getPanel2()
+ self.fenetre=self.getPanel()
else:
from monInactifPanel import PanelInactif
self.fenetre = PanelInactif(self,self.editor)
obj=self.item.additem(name,index) #CS_pbruno emet le signal 'add'
if obj is None:obj=0
if obj == 0:return 0
- #try :
- # old_obj = self.item.object.get_child(name.nom,restreint = 'oui')
- # child=old_obj[-1]
- # if plier : child.plieToutEtReaffiche()
- # else : child.affichePanneau()
- # print "dans le 1er Try"
- #else :
- #except:
- # Souci pour gerer les copies des AFFE d'une commande à l autre
- # try :
- # child=self.children[index]
- # if plier == True : child.setPlie()
- # else : child.setDeplie()
- # print "dans le 2nd Try"
- # except :
- # child=self.children[index]
- # print "dans le except"
try :
- #if 1:
child=self.children[index]
if plier == True : child.setPlie()
else : child.setDeplie()
except :
child=self.children[index]
- #print "dans le except"
self.tree.inhibeExpand=False
+ #print " fin append child"
return child
def deplace(self):
# item.appartientAUnNoeudPlie=False
def setPlieChildren(self):
+ #print "dans setPlieChildren pour", self.item.nom
self.plie=True
for c in self.children :
c.setPlieChildren()
#print "dans setPlieChildren appartientAUnNoeudPlie=True ", c, c.item.GetLabelText()[0]
c.appartientAUnNoeudPlie=True
c.plie=True
+ #print "dans setPlieChildren plie", c.item.nom
c.setExpanded(False)
# Pour les blocs et les motcles list
# c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
def setDeplie(self):
+ #print "dans setPlieChildren pour", self.item.nom
#print "je mets inhibeExpand a true dans setDeplie"
self.tree.inhibeExpand=True
self.plie=False
#print "dans setDeplieChildren appartientAUnNoeudPlie=False ", self.item.GetLabelText()
for c in self.children :
c.setDeplieChildren()
- #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", c.item.GetLabelText()
+ #print "dans setDeplieChildren ", c.item.nom
c.appartientAUnNoeudPlie=False
c.setExpanded(True)
c.plie=False
class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal):
- def getPanel(self):
- """
- """
- from monMCFactPanel import MonMCFactPanel
- return MonMCFactPanel(self,parent=self.editor)
def createPopUpMenu(self):
typeNode.PopUpMenuNodeMinimal.createPopUpMenu(self)
class Node(browser.JDCNode,typeNode.PopUpMenuNodePartiel):
- def getPanel2( self ):
+ def getPanel( self ):
"""
"""
from monWidgetCommentaire import MonWidgetCommentaire
class Node(browser.JDCNode,typeNode.PopUpMenuNodePartiel):
- def getPanel(self):
- """
- """
- from monMCFactPanel import MonMCFactPanel
- return MonMCFactPanel(self,parent=self.editor)
def getPanelGroupe(self,parentQt,commande):
maDefinition=self.item.get_definition()
maCommande=commande
if hasattr(parentQt,'niveau'): self.niveau=parentQt.niveau+1
else : self.niveau=1
+ if hasattr(self,'plie') :print self.item.nom, self.plie
if hasattr(self,'plie') and self.plie==True :
from monWidgetFactPlie import MonWidgetFactPlie
widget=MonWidgetFactPlie(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande)
"""
itemobject=item.getObject()
if itemobject.isoblig() :
- self.editor.affiche_infos(tr('Impossible de supprimer un mot-cle obligatoire '),Qt.red)
- return 0
+ #self.editor.affiche_infos(tr('Impossible de supprimer un mot-cle obligatoire '),Qt.red)
+ return (0, tr('Impossible de supprimer un mot-cle obligatoire '))
if self.object.suppentite(itemobject):
message = tr("Mot-cle %s supprime")+ unicode(itemobject.nom)
- self.editor.affiche_commentaire(message)
- return 1
+ #self.editor.affiche_commentaire(message)
+ return (1, message)
else:
- self.editor.affiche_infos(tr('Pb interne : impossible de supprimer ce mot-cle'),Qt.red)
- return 0
+ #self.editor.affiche_infos(tr('Pb interne : impossible de supprimer ce mot-cle'),Qt.red)
+ return (0,tr('Pb interne : impossible de supprimer ce mot-cle'))
import Accas
objet = Accas.MCFACT
class Node(browser.JDCNode,typeNode.PopUpMenuRacine):
+
def getPanel(self):
- """
- """
- #if self.affichage_onglet==1 :
- # from monRacinePanel_onglet import MonRacinePanel
- # return MonRacinePanel(self,parent=self.editor)
- from monRacinePanel import MonRacinePanel
- return MonRacinePanel(self,parent=self.editor)
-
- def getPanel2(self):
from monChoixCommande import MonChoixCommande
return MonChoixCommande(self,self.item, self.editor)
class MACRONode(browser.JDCNode,typeNode.PopUpMenuNode):
- def getPanel(self):
- from monMacroPanel import MonMacroPanel
- return MonMacroPanel (self,parent=self.editor )
- def getPanel2(self):
+ def getPanel(self):
from monWidgetCommande import MonWidgetCommande
return MonWidgetCommande (self,self.editor ,self.item.object)
class INCLUDENode(browser.JDCNode,typeNode.PopUpMenuNode):
- def getPanel(self):
- from monIncludePanel import MonIncludePanel
- return MonIncludePanel (self,parent=self.editor )
- def getPanel2(self):
+ def getPanel(self):
from monWidgetCommande import MonWidgetCommande
return MonWidgetCommande (self,self.editor ,self.item.object)
# ------------------------------------
class POURSUITENode(browser.JDCNode, typeNode.PopUpMenuNode):
- def getPanel(self):
- from monPoursuitePanel import MonPoursuitePanel
- return MonPoursuitePanel (self,parent=self.editor )
- def getPanel2(self):
+ def getPanel(self):
from monWidgetCommande import MonWidgetCommande
return MonWidgetCommande (self,self.editor ,self.item.object)
class MATERIAUNode(MACRONode):
def getPanel(self):
- from monMacroPanel import MonMacroPanel
- return MonMacroPanel (self,parent=self.editor )
+ from monWidgetCommande import MonWidgetCommande
+ return MonWidgetCommande (self,self.editor ,self.item.object)
def createPopUpMenu(self):
typeNode.PopUpMenuNode.createPopUpMenu(self)
class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal):
- def getPanel(self):
- """
- """
- if self.item.isMCList() :
- if self.item.ajout_possible():
- from monMCListAjoutPanel import MonMCListAjoutPanel
- return MonMCListAjoutPanel(self,parent=self.editor)
- else :
- print "MCList"
- elif self.item.isMCFact() :
- from monMCFactPanel import MonMCFactPanel
- return MonMCFactPanel(self,parent=self.editor)
- else :
- print "MCList"
def createPopUpMenu(self):
typeNode.PopUpMenuNodeMinimal.createPopUpMenu(self)
monObjet=self.item.object
monNom=self.item.nom
maCommande=commande
+ #print "ds getPanelGroupe" , self.item.nom
+ #if hasattr(self,'plie'): print "self.plie", self.plie
+ # if self.item.nom == "BackgroundError" and not(self.plie): print i
#print parentQt
if hasattr(parentQt,'niveau'): self.niveau=parentQt.niveau+1
else : self.niveau=1
if self.object.suppentite(obj):
if len(self._object) == 1: self.updateDelegate()
message = "Mot-clef " + obj.nom + " supprime"
- self.editor.affiche_commentaire(message)
- return 1
+ #self.editor.affiche_commentaire(message)
+ return (1,message)
else:
- self.editor.affiche_infos(tr('Impossible de supprimer ce mot-clef'),Qt.red)
- return 0
+ return (0,tr('Impossible de supprimer ce mot-clef'))
import Accas
except :
pass
- def getPanel( self ):
- """
- """
- from monCommandePanel import MonCommandePanel
- return MonCommandePanel(self,parent=self.editor)
- def getPanel2(self):
+ def getPanel(self):
from monWidgetCommande import MonWidgetCommande
return MonWidgetCommande(self,self.editor,self.item.object)
# item.getObject() = MCSIMP, MCFACT, MCBLOC ou MCList
itemobject=item.getObject()
if itemobject.isoblig() :
- self.editor.affiche_infos(tr('Impossible de supprimer un mot-clef obligatoire '),Qt.red)
- return 0
+ #self.editor.affiche_infos(tr('Impossible de supprimer un mot-clef obligatoire '),Qt.red)
+ return (0,tr('Impossible de supprimer un mot-clef obligatoire '))
if self.object.suppentite(itemobject):
message = tr("Mot-clef %s supprime " , itemobject.nom)
- self.editor.affiche_commentaire(message)
- return 1
+ #self.editor.affiche_commentaire(message)
+ return (1,message)
else :
- self.editor.affiche_commentaire(tr('Pb interne : impossible de supprimer ce mot-clef'),Qt.red)
- return 0
+ #self.editor.affiche_commentaire(tr('Pb interne : impossible de supprimer ce mot-clef'),Qt.red)
+ return (0,tr('Pb interne : impossible de supprimer ce mot-clef'))
def GetText(self):
try:
class Node(browser.JDCNode,typeNode.PopUpMenuNodePartiel):
- def getPanel2(self):
+ def getPanel(self):
"""
"""
from monWidgetParam import MonWidgetParam
class Node(browser.JDCNode,typeNode.PopUpMenuNode):
- def getPanel(self):
- from monMacroPanel import MonMacroPanel
- return MonMacroPanel(self,parent=self.editor)
- def getPanel2(self):
- #print "getPanel2 de compoproc"
+ def getPanel(self):
+ #print "getPanel de compoproc"
from monWidgetCommande import MonWidgetCommande
return MonWidgetCommande(self,self.editor,self.item.object)
from Accas import SalomeEntry
class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal):
- def getPanel(self):
- """
- """
- klass = None
- # Attention l ordre des if est important
-
- if self.item.wait_matrice ():
- from monMatricePanel import MonMatricePanel
- klass=MonMatricePanel
- # l'objet prend sa (ses) valeur(s) dans un ensemble discret de valeurs
- elif self.item.has_into():
- if self.item.is_list() :
- from monPlusieursIntoPanel import MonPlusieursIntoPanel
- klass = MonPlusieursIntoPanel
- else:
- from monUniqueIntoPanel import MonUniqueIntoPanel
- klass = MonUniqueIntoPanel
-
- # l'objet prend une ou des valeurs a priori quelconques
- else:
- # on attend une liste de valeurs
- if self.item.is_list() :
- # on attend une liste de SD
- if self.item.wait_tuple() :
- from monFonctionPanel import MonFonctionPanel
- klass = MonFonctionPanel
- elif self.item.wait_assd():
- from monPlusieursASSDPanel import MonPlusieursASSDPanel
- klass = MonPlusieursASSDPanel
- else:
- # on attend une liste de valeurs de types debase (entiers, réels,...)
- from monPlusieursBasePanel import MonPlusieursBasePanel
- klass = MonPlusieursBasePanel
- # on n'attend qu'une seule valeur
- else:
- # on attend une SD ou un objet de la classe CO (qui n'existe pas encore)
- if self.item.wait_co():
- if len(self.item.get_sd_avant_du_bon_type()) != 0 :
- from monUniqueSDCOIntoPanel import MonUniqueSDCOIntoPanel
- klass = MonUniqueSDCOIntoPanel
- else :
- from monUniqueSDCOPanel import MonUniqueSDCOPanel
- klass = MonUniqueSDCOPanel
-
- # on attend une SD
- elif self.item.wait_assd():
- if 'R' in self.item.GetType():
- from monUniqueASSDPanel import MonUniqueASSDReelPanel
- klass = MonUniqueASSDReelPanel
- else :
- from monUniqueASSDPanel import MonUniqueASSDPanel
- klass = MonUniqueASSDPanel
-
- # on attend une valeur d'un type de base (entier,reel,...)
- else:
- # on attend un complexe
- if self.item.wait_complex():
- from monUniqueCompPanel import MonUniqueCompPanel
- klass = MonUniqueCompPanel
- elif self.item.wait_bool() :
- from monUniqueBoolPanel import MonUniqueBoolPanel
- klass = MonUniqueBoolPanel
- else :
- from monUniqueBasePanel import MonUniqueBasePanel
- klass = MonUniqueBasePanel
-
- # cas particulier des fonctions
- genea = self.item.get_genealogie()
- if "VALE" in genea or "VALE_C" in genea:
- if "DEFI_FONCTION" in genea :
- from monFonctionPanel import MonFonctionPanel
- klass = MonFonctionPanel
-
- if not klass:
- return None
- return klass( self, self.editor )
-
def createPopUpMenu(self):
typeNode.PopUpMenuNodeMinimal.createPopUpMenu(self)
#-------------------# Pour execution avec output et error dans le bash
def runPSEN(self):
#-------------------#
- if self.modified or self.fichier==None :
- QMessageBox.critical( self, tr( "Execution impossible "),tr("Sauvegarder SVP avant l'execution "))
- return
+ if self.modified or self.fichier==None : self.saveFile()
#lancement avec le .bat
path1 = os.path.abspath(os.path.join(os.path.abspath(__file__), '../','../','PSEN_Eficas','PSEN'))
#---------------------#
def handleDeplier(self):
#---------------------#
- print "je passe ici"
if self.tree == None : return
#self.tree.collapseAll()
if self.deplier :
def afficheMots(self):
#print "ds afficheMots ",self.node.item.nom
for node in self.node.children:
- #print "afficheMots ",node," " ,node.item.nom, " ",node.plie ," ", node.appartientAUnNoeudPlie
+ #if node.item.nom == "Background" :print "afficheMots ",node," " ,node.item.nom, " ",node.plie ," ", node.appartientAUnNoeudPlie,node.getPanelGroupe
+ #if node.item.nom == "BackgroundError" :print "afficheMots ",node," " ,node.item.nom, " ",node.plie ," ", node.appartientAUnNoeudPlie,node.getPanelGroupe
# non return mais continue car il faut tenir compte des blocs
if node.appartientAUnNoeudPlie==True : continue
#print "je suis apres le if pour ",node.item.nom
# c est juste la taille des differents widgets de base qui change
def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
- print "MonWidgetSimpTxt", nom
MonWidgetSimpBase.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande)