import types,sys,os
import traceback
import typeNode
+import pdb
from PyQt4 import *
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from Extensions.i18n import tr
+from gereRegles import GereRegles
from monChoixCommande import MonChoixCommande
-class JDCTree( QTreeWidget ):
+class JDCTree( QTreeWidget,GereRegles ):
def __init__( self, jdc_item, QWParent):
#if hasattr(QWParent,'widgetTree') :
- if QWParent.widgetTree !=None :
- QTreeWidget.__init__(self, QWParent.widgetTree )
- QWParent.verticalLayout_2.addWidget(self)
- self.headerItem().setText(0, "Commande ")
- self.headerItem().setText(1, "Concept/Valeur")
+ 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(1, "Concept/Valeur")
+ else :
+ self.headerItem().setText(0, "Commande ")
self.setColumnWidth(0,200)
self.setExpandsOnDoubleClick(False)
self.setSelectionMode(3)
QTreeWidget.__init__(self, None )
self.item = jdc_item
self.tree = self
- self.editor = QWParent
- self.editor.fenetreAffichee=None
self.appliEficas = self.editor.appliEficas
self.childrenComplete=[]
- self.childrenIssusDesBlocs=[]
self.racine=self.item.itemNode(self,self.item)
self.itemCourrant=None
self.connect(self, SIGNAL("itemClicked ( QTreeWidgetItem * ,int) "), self.handleOnItem)
- self.connect(self, SIGNAL("itemDoubleClicked ( QTreeWidgetItem * ,int) "), self.handleDoubleClickedOnItem)
+ self.connect(self, SIGNAL("itemCollapsed ( QTreeWidgetItem *) "), self.handleCollapsedItem)
+ self.connect(self, SIGNAL("itemExpanded ( QTreeWidgetItem *) "), 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.expandItem(self.racine)
- if self.racine.children !=[] : self.racine.children[0].affichePanneau()
- else : self.racine.affichePanneau()
+ self.inhibeExpand=False
+ #print "self.editor.afficheCommandesPliees", self.editor.afficheCommandesPliees
+ if self.racine.children !=[] :
+
+ if self.editor.afficheCommandesPliees : self.racine.children[0].plieToutEtReaffiche()
+ else : self.racine.children[0].deplieToutEtReaffiche()
+
+
+ self.racine.children[0].fenetre.donnePremier()
+ else : self.racine.affichePanneau()
+ #PNPNPN
+ #pdb.set_trace()
def contextMenuEvent(self,event) :
- print "contextMenuEvent"
+ #print "contextMenuEvent"
coord=event.globalPos()
item= self.currentItem()
self.handleContextMenu(item,coord)
@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
if item.existeMenu == 0 : return
if item.menu == None:
item.menu.exec_(coord)
+ def handleCollapsedItem(self,item):
+ #print "dans CollapsedItem", self.inhibeExpand
+ if self.inhibeExpand == True : return
+ # On traite le cas de l item non selectionne
+ itemParent=item
+ while not (hasattr (itemParent,'getPanel')) :
+ itemParent=itemParent.treeParent
+ if self.tree.node_selected != itemParent :
+ item.setExpanded(False)
+ return
+
+ itemParent=item
+ item.setPlie()
+ item.plieToutEtReaffiche()
+ item.select()
+
+ def handleExpandedItem(self,item):
+ #print "handleExpandedItem pour ", item.item.nom, self.inhibeExpand
+ if self.inhibeExpand == True : return
+ itemParent=item
+ while not (hasattr (itemParent,'getPanel')) :
+ if itemParent.plie==True : itemParent.setDeplie()
+ itemParent=itemParent.treeParent
+ if self.tree.node_selected != itemParent :
+ item.setExpanded(True)
+ return
+ item.deplieToutEtReaffiche()
+
+
def handleOnItem(self,item,int):
- if (len(self.selectedIndexes())!=2): return
+ #print "je passe dans handleOnItem pour ",self, item.item.nom, item, item.item
+ self.inhibeExpand == True
self.itemCourrant=item
- #try :
- if 1:
+ itemParent=item
+ while not (hasattr (itemParent,'getPanel')) :
+ if itemParent.plie==True : itemParent.setDeplie()
+ itemParent=itemParent.treeParent
+ if itemParent.fenetre != self.editor.fenetreCentraleAffichee :
+ # il faut afficher le parent
+ if self.editor.afficheCommandesPliees : itemParent.plieToutEtReafficheSaufItem(item)
+ else : itemParent.affichePanneau()
+
+
+ from InterfaceQT4 import composimp
+ if (isinstance(item,composimp.Node)) : item.fenetre.rendVisible()
+ elif itemParent!=item:
+ #self.tree.handleExpandedItem(item)
+ #item.fenetre.donnePremier()
+ print 'il faut afficher le 1er'
+ try :
fr = item.item.get_fr()
if self.editor: self.editor.labelCommentaire.setText(unicode(fr))
- #except:
- else :
+ except:
pass
+ item.select()
+ self.inhibeExpand == False
+ #print "je mets inhibeExpand a false handleOnItem"
- def handleDoubleClickedOnItem(self,item,int):
- #if item.fenetre == None :
- # while not (hasattr (item,'getPanel2')) : item=item.treeParent
- # item.affichePanneau()
- # self.expandItem(item)
- #else:
- # item.fenetre.rendVisible()
- itemParent=item
- while not (hasattr (itemParent,'getPanel2')) : itemParent=item.treeParent
- itemParent.affichePanneau()
- if itemParent!=item:
- item.fenetre.rendVisible()
def choisitPremier(self,name):
self.editor.layoutJDCCHOIX.removeWidget(self.racine.fenetre)
COMMENT = "COMMENTAIRE"
PARAMETERS = "PARAMETRE"
-class JDCNode(QTreeWidgetItem):
- def __init__( self, treeParent, item):
- #print "creation d'un noeud : ", item, " ",item.nom,"", treeParent
+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.item = item
self.vraiParent = treeParent
self.treeParent = treeParent
self.tree = self.treeParent.tree
self.editor = self.treeParent.editor
self.appliEficas = treeParent.appliEficas
- self.treeParent.childrenIssusDesBlocs=[]
+ self.JESUISOFF=0
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=self.appliEficas.trUtf8(str(item.GetLabelText()[0]))
else: name = self.appliEficas.trUtf8(str(tr( item.nom))+" :")
value = self.appliEficas.trUtf8(str( item.GetText() ) )
+
mesColonnes=QStringList()
- mesColonnes << name << value
+ if self.editor.enteteQTree=='complet': mesColonnes << name << value
+ else : mesColonnes << name
+
+ if self.treeParent.plie==True :
+ self.plie = True
+ self.appartientAUnNoeudPlie=True
+ else :
+ self.plie = False
+ self.appartientAUnNoeudPlie = False
+
+ if ancien and itemExpand : self.plie = False
+ if ancien and not itemExpand : self.plie = True
+ if (isinstance(self.item,composimp.SIMPTreeItem)) : self.plie=False
- ajoutAuParentduNoeud=0
from InterfaceQT4 import compobloc
- while (isinstance(self.treeParent,compobloc.Node)) :
- self.treeParent=self.treeParent.treeParent
- ajoutAuParentduNoeud=1
- if ajoutAuParentduNoeud :
- treeParent.childrenComplete.append(self)
- self.treeParent.childrenIssusDesBlocs.append(self)
- while (isinstance(self.treeParent,compobloc.Node)) : self.treeParent=self.treeParent.treeParent
-
- if isinstance(self,compobloc.Node) :
+ from InterfaceQT4 import compomclist
+
+ ajoutAuParentduNoeud=0
+ self.treeParent=treeParent
+ while (isinstance(self.treeParent,compobloc.Node) or ( isinstance(self.treeParent,compomclist.Node) and self.treeParent.item.isMCList())) :
+ self.treeParent.childrenComplete.append(self)
+ self.treeParent=self.treeParent.vraiParent
+ self.treeParent.childrenComplete.append(self)
+ if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
QTreeWidgetItem.__init__(self,None,mesColonnes)
else :
QTreeWidgetItem.__init__(self,self.treeParent,mesColonnes)
- self.treeParent.childrenComplete.append(self)
self.setToolTip(0,QString(self.item.get_fr()))
self.setToolTip(1,QString(self.item.get_fr()))
self.item.connect("valid",self.onValid,())
self.item.connect("supp" ,self.onSupp,())
self.item.connect("add" ,self.onAdd,())
+
self.state=""
self.fenetre=None
try :
- if self.item.getObject().isBLOC() : self.setExpanded(True)
+ if self.item.getObject().isBLOC() :
+ self.setExpanded(True)
+ self.plie=False
except :
pass
def build_children(self,posInsertion=10000):
""" Construit la liste des enfants de self """
""" Se charge de remettre les noeuds Expanded dans le meme etat """
- #print "*********** build_children ",self.item, self.item.GetLabelText()
+ #print "*********** build_children ",self,self.item, self.item.nom
+
+ self.listeItemExpanded=[]
+ self.listeItemPlie=[]
+
+ for enfant in self.childrenComplete :
+ if enfant.plie : self.listeItemPlie.append(enfant.item)
+ else : self.listeItemExpanded.append(enfant.item)
+
+ for enfant in self.childrenComplete :
+ p=enfant.vraiParent
+ parent=enfant.treeParent
+ parent.removeChild(enfant)
+ enfant.JESUISOFF=1
+
- listeExpanded=[]
- for item in self.childrenComplete :
- #try :
- # print " je detruis ", item.item.GetLabelText() ," parent : ", item.treeParent.item.GetLabelText()
- #except :
- # print "mot clef fact"
- if item.isExpanded():
- if self.childrenComplete.index(item) < posInsertion :
- listeExpanded.append(self.childrenComplete.index(item))
- else :
- listeExpanded.append( self.childrenComplete.index(item) +1)
- self.detruit_les_noeuds_issus_de_blocs(item)
- parent=item.treeParent
- parent.removeChild(item)
-
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 " J ajoute ", nouvelItem ,nouvelItem.item.GetLabelText(),"dans" ,self.item.GetLabelText()
- if ind in listeExpanded : nouvelItem.setExpanded(1)
- ind=ind+1
- #print "*********** fin build_children ",self.item, self.item.GetLabelText()
+
+ #print "fin *********** build_children ",self,self.item, self.item.nom
+
+ def chercheNoeudCorrespondant(self,objSimp):
+ sublist = self.item._GetSubList()
+ for node in self.childrenComplete:
+ if node.item.object==objSimp : return node
+ return None
+
def affichePanneau(self) :
- #print "dans affichePanneau", self.item.GetLabelText()
- #if self.item.GetLabelText()[0]=='VCUT : ' : print y
- if self.item.isactif():
- panel=self.getPanel2()
+ #print " affichePanneau " , self.item.nom
+ if self.item.isactif():
+ itemParent=self
+ while not (hasattr (itemParent,'getPanel')) : itemParent=itemParent.treeParent
+ if itemParent!=self :
+ itemParent.affichePanneau()
+ return
+ self.fenetre=self.getPanel()
else:
from monInactifPanel import PanelInactif
- panel = PanelInactif(self,self.editor)
- if hasattr(self,'fenetre') and self.fenetre:
- self.fenetre.close()
- self.fenetre=panel
+ self.fenetre = PanelInactif(self,self.editor)
+
+ for indiceWidget in range(self.editor.widgetCentraleLayout.count()):
+ 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 :
- self.editor.fenetreCentraleAffichee.close()
- self.editor.fenetreCentraleAffichee=panel
- if self.editor.widgetTree !=None : index=1
- else : index=0
+ #print "j enleve ", self.editor.fenetreCentraleAffichee, self.editor.fenetreCentraleAffichee.node.item.nom
+ self.editor.widgetCentraleLayout.removeWidget(self.editor.fenetreCentraleAffichee)
+ self.editor.fenetreCentraleAffichee.close()
+
self.editor.widgetCentraleLayout.addWidget(self.fenetre)
+ #print "j ajoute ", self.fenetre, self.fenetre.node.item.nom
+ self.editor.fenetreCentraleAffichee=self.fenetre
+ self.tree.node_selected= self
if self.editor.first :
self.editor.splitter.setSizes((400,1400,400))
if not(isinstance(self.fenetre,MonChoixCommande)): self.editor.first=False
+ self.tree.inhibeExpand=True
self.tree.expandItem(self)
self.select()
+ self.tree.inhibeExpand=False
+ #print "fin de affichePanneau", self.item.nom
+ #print "______________________________"
def createPopUpMenu(self):
Ajoute un parametre a l'interieur du JDC :
"""
self.editor.init_modif()
- if after:
- pos = 'after'
- else:
- pos = 'before'
- return self.append_brother( PARAMETERS, pos )
+ if after: pos = 'after'
+ else: pos = 'before'
+ child=self.append_brother( PARAMETERS, pos )
+ return child
def select( self ):
for item in self.tree.selectedItems() :
item.setSelected(0)
self.setSelected( True )
- self.setExpanded( True )
self.tree.setCurrentItem( self )
- self.tree.node_selected= self
#------------------------------------------------------------------
# Methodes de creation et destruction de noeuds
# Certaines de ces methodes peuvent etre appelees depuis l'externe
#------------------------------------------------------------------
- def append_brother(self,name,pos='after'):
+ def append_brother(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
Methode externe
"""
- #print "*********** append_brother ", self.item.GetLabelText()
self.editor.init_modif()
+
+ from InterfaceQT4 import compojdc
+ if (isinstance(self.treeParent, compojdc.Node)) and not self.verifiePosition(name,pos) : return 0
+
index = self.treeParent.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
else:
print unicode(pos), tr(" n'est pas un index valide pour append_brother")
return 0
- return self.treeParent.append_child(name,pos=index)
-
- def append_child(self,name,pos=None):
+ return self.treeParent.append_child(name,pos=index,plier=plier)
+
+ def verifiePosition(self,name,pos,aLaRacine=False):
+ if name not in self.editor.Classement_Commandes_Ds_Arbre : return True
+ indexName=self.editor.Classement_Commandes_Ds_Arbre.index(name)
+
+ etapes=self.item.get_jdc().etapes
+ if etapes == [] : return True
+
+ if aLaRacine == False :indexOu=etapes.index(self.item.object)
+ else : indexOu=0
+
+ if pos=="after" : indexOu = indexOu+1
+ for e in etapes[:indexOu] :
+ nom=e.nom
+ if nom not in self.editor.Classement_Commandes_Ds_Arbre : continue
+ indexEtape=self.editor.Classement_Commandes_Ds_Arbre.index(nom)
+ if indexEtape > indexName :
+ comment=tr('le mot clef ')+name+tr(' doit etre insere avant ')+nom
+ QMessageBox.information( None,tr('insertion impossible'),comment, )
+ return False
+ for e in etapes[indexOu:] :
+ nom=e.nom
+ if nom not in self.editor.Classement_Commandes_Ds_Arbre : continue
+ indexEtape=self.editor.Classement_Commandes_Ds_Arbre.index(nom)
+ if indexEtape < indexName :
+ comment=tr('le mot clef ')+name+tr(' doit etre insere apres ')+nom
+ QMessageBox.information( None,tr('insertion impossible'),comment, )
+ return False
+ return True
+
+ def append_child(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')
ou en position intermediaire.
Si pos vaut None, on le place a la position du catalogue.
"""
- #print "************** append_child ",self.item.GetLabelText()
+ #print "************** append_child ",self.item.GetLabelText(), plier
+
+
self.editor.init_modif()
if pos == 'first':
index = 0
index = self.item.get_index_child(name.nom)
else:
index = self.item.get_index_child(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) #CS_pbruno emet le signal 'add'
if obj is None:obj=0
if obj == 0:return 0
- ## PNPNPN : cas de Map nouvelle version
- #if 1 :
try :
- #print "1er Try"
- old_obj = self.item.object.get_child(name.nom,restreint = 'oui')
- child=old_obj[-1]
- child.affichePanneau()
- #else :
- except:
- # Souci pour gerer les copies des AFFE d'une commande à l autre
- try :
- child=self.children[index]
- child.affichePanneau()
- except :
- child=self.children[index]
- pass
+ child=self.children[index]
+ if plier == True : child.setPlie()
+ else : child.setDeplie()
+ except :
+ child=self.children[index]
+ self.tree.inhibeExpand=False
+ #print " fin append child"
return child
def deplace(self):
if self.item.nom == "VARIABLE" :
recalcule=1
jdc=self.item.jdc
- ret=self.vraiParent.item.suppitem(self.item)
+ ret,commentaire=self.vraiParent.item.suppitem(self.item)
+ if ret==0 :
+ self.editor.affiche_infos(commentaire,Qt.red)
+ else :
+ self.editor.affiche_infos(commentaire)
self.treeParent.build_children()
if self.treeParent.childrenComplete : toselect=self.treeParent.childrenComplete[index]
else: toselect=self.treeParent
toselect.affichePanneau()
else :
if self.treeParent.fenetre== None : return
+ #print "J appelle reaffiche de browser apres delete"
self.treeParent.fenetre.reaffiche(toselect)
def deleteMultiple(self,liste=()):
# #------------------------------------------------------------------
def onValid(self):
- if hasattr(self,'fenetre') and self.fenetre:
- self.fenetre.setValide()
- if self.item.nom == "VARIABLE" and self.item.isvalid():
+ #print "onValid pour ", self.item.nom
+ if hasattr(self,'fenetre') and self.fenetre: self.fenetre.setValide()
+ if (self.item.nom == "VARIABLE" or self.item.nom == "DISTRIBUTION") and self.item.isvalid():
self.item.jdc.recalcule_etat_correlation()
if hasattr(self.item,'forceRecalcul'):
self.forceRecalculChildren(self.item.forceRecalcul)
self.update_node_texte()
def onAdd(self,object):
- #print "___________________________ onAdd", object
+ if self.JESUISOFF==1 : return
+ #print "onAdd pour ", self.item.nom, object.nom
self.editor.init_modif()
self.update_nodes()
+ # PN -- non necessaire si item=jdc
+ if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
def onSupp(self,object):
- #print "___________________________ onSupp", self.item, self.item.GetLabelText()
+ if self.JESUISOFF==1 : return
+ #print "onSup pour ", self.item.nom, object.nom
self.editor.init_modif()
self.update_nodes()
+ # PN -- non necessaire si item=jdc
+ if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
- def detruit_les_noeuds_issus_de_blocs(self,bloc):
- from InterfaceQT4 import compobloc
- if (isinstance(bloc,compobloc.Node)) :
- for node in bloc.childrenComplete :
- self.detruit_les_noeuds_issus_de_blocs(node)
- parent=node.treeParent
- #print "je detruit " , node.item.GetLabelText()
- parent.removeChild(node)
+
+
def update_node_valid(self):
"""Cette methode remet a jour la validite du noeud (icone)
""" Met a jour les noms des SD et valeurs des mots-cles """
value = self.item.GetText()
self.setText(1, value)
+
def update_node_texte_in_blue(self):
self.setTextColor( 1,Qt.blue )
child = self.append_child(objet,pos='first')
return child
+ def plieToutEtReafficheSaufItem(self, itemADeplier):
+ #print "je suis dans plieToutEtReaffiche", self.item.get_nom()
+ self.editor.deplier = False
+ for item in self.children :
+ # il ne faut pas plier les blocs
+ from InterfaceQT4 import compobloc
+ if (isinstance(item,compobloc.Node)) : continue
+ item.setPlie()
+ if item==itemADeplier :
+ print itemADeplier.item.nom
+ itemADeplier.setDeplie()
+
+ self.affichePanneau()
+
+ def plieToutEtReaffiche(self):
+ #print "je suis dans plieToutEtReaffiche", self.item.get_nom()
+ self.editor.deplier = False
+ for item in self.children :
+ # il ne faut pas plier les blocs
+ from InterfaceQT4 import compobloc
+ if (isinstance(item,compobloc.Node)) : continue
+ item.setPlie()
+ self.affichePanneau()
+
+ def deplieToutEtReaffiche(self):
+ self.editor.deplier = True
+ for item in self.children :
+ item.setDeplie()
+ self.affichePanneau()
+
def setPlie(self):
- self.plie=True
+ #print "je mets inhibeExpand a true dans setPlie"
+ #print "je suis dans plieTout", self.item.get_nom()
+ import compojdc
+ if self.fenetre == self.editor.fenetreCentraleAffichee and isinstance(self.treeParent,compojdc.Node):
+ return
+ self.tree.inhibeExpand=True
+ self.tree.collapseItem(self)
self.setPlieChildren()
+ self.tree.inhibeExpand=False
+ #print "je mets inhibeExpand a false dans setPlie"
+
+
+ # on ne plie pas au niveau 1
+ # self.plie=False
+ # for item in self.children :
+ # item.appartientAUnNoeudPlie=False
def setPlieChildren(self):
- self.appartientAUnNoeudPlie=True
- for item in self.children :
- item.setPlieChildren()
-
+ #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
+ # on affiche un niveau de plus
+ from InterfaceQT4 import compobloc
+ from InterfaceQT4 import compomclist
+ if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
+ niveauPere=self.treeParent
+ while (isinstance(niveauPere,compobloc.Node) or (isinstance(niveauPere,compomclist.Node) and niveauPere.item.isMCList())) :
+ niveauPere=niveauPere.treeParent
+ for c in self.children :
+ c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
+ c.setExpanded(False)
+
+ # on affiche un niveau de plus
+ #if isinstance(self,compomclist.Node) :
+ #if isinstance(self,compobloc.Node) :
+ # niveauPere=self.treeParent
+ # while (isinstance(niveauPere,compobloc.Node)):
+ # niveauPere=niveauPere.treeParent
+ # for c in self.children :
+ # 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
+ self.tree.expandItem(self)
self.setDeplieChildren()
+ self.tree.inhibeExpand=False
+ #print "je mets inhibeExpand a false dans setDePlie"
def setDeplieChildren(self):
- self.appartientAUnNoeudPlie=False
- for item in self.children :
- item.setDeplieChildren()
-
-
+ #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", self.item.GetLabelText()
+ for c in self.children :
+ c.setDeplieChildren()
+ #print "dans setDeplieChildren ", c.item.nom
+ c.appartientAUnNoeudPlie=False
+ c.setExpanded(True)
+ 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]
+ node=None
+ for i in self.tree.racine.children :
+ if i.item.object== cherche :
+ node=i
+ break
+ if node : node.affichePanneau()
+
+ 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]
+ node=None
+ for i in self.tree.racine.children :
+ if i.item.object== cherche :
+ node=i
+ break
+ if node : node.affichePanneau()