1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2013 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
27 from PyQt4.QtGui import *
28 from PyQt4.QtCore import *
29 from Extensions.i18n import tr
30 from gereRegles import GereRegles
31 from monChoixCommande import MonChoixCommande
33 class JDCTree( QTreeWidget,GereRegles ):
34 def __init__( self, jdc_item, QWParent):
35 #if hasattr(QWParent,'widgetTree') :
36 self.editor = QWParent
38 if self.editor.widgetTree !=None :
39 QTreeWidget.__init__(self, self.editor.widgetTree )
40 self.editor.verticalLayout_2.addWidget(self)
41 if self.editor.enteteQTree=='complet':
42 self.headerItem().setText(0, "Commande ")
43 self.headerItem().setText(1, "Concept/Valeur")
45 self.headerItem().setText(0, "Commande ")
46 self.setColumnWidth(0,200)
47 self.setExpandsOnDoubleClick(False)
48 self.setSelectionMode(3)
50 QTreeWidget.__init__(self, None )
53 self.appliEficas = self.editor.appliEficas
54 self.childrenComplete=[]
55 self.racine=self.item.itemNode(self,self.item)
57 self.itemCourrant=None
59 self.connect(self, SIGNAL("itemClicked ( QTreeWidgetItem * ,int) "), self.handleOnItem)
60 self.connect(self, SIGNAL("itemCollapsed ( QTreeWidgetItem *) "), self.handleCollapsedItem)
61 self.connect(self, SIGNAL("itemExpanded ( QTreeWidgetItem *) "), self.handleExpandedItem)
63 #PNPNPN verifier dans quel cas on se trouve : affiche l arbre ou la commande
64 self.node_selected=self.racine
65 self.inhibeExpand=True
66 self.expandItem(self.racine)
67 self.inhibeExpand=False
68 #print "self.editor.afficheCommandesPliees", self.editor.afficheCommandesPliees
69 if self.racine.children !=[] :
72 if self.editor.afficheCommandesPliees : self.racine.children[0].plieToutEtReaffiche()
73 else : self.racine.children[0].deplieToutEtReaffiche()
76 self.racine.children[0].fenetre.donnePremier()
77 else : self.racine.affichePanneau()
81 def contextMenuEvent(self,event) :
82 #print "contextMenuEvent"
83 coord=event.globalPos()
84 item= self.currentItem()
85 self.handleContextMenu(item,coord)
87 def handleContextMenu(self,item,coord):
89 Private slot to show the context menu of the listview.
91 @param itm the selected listview item (QListWidgetItem)
92 @param coord the position of the mouse pointer (QPoint)
93 Attention : existeMenu permet de savoir si un menu est associe a cet item
95 #print "handleContextMenu"
96 if item == None : return
97 if item.existeMenu == 0 : return
99 item.createPopUpMenu()
100 if item.menu != None:
101 if item.item.get_nom() == "DISTRIBUTION" and item.item.isvalid() :
102 item.Graphe.setEnabled(1)
103 item.menu.exec_(coord)
106 def handleCollapsedItem(self,item):
107 #print "dans CollapsedItem", self.inhibeExpand
108 if self.inhibeExpand == True : return
109 # On traite le cas de l item non selectionne
111 while not (hasattr (itemParent,'getPanel')) :
112 itemParent=itemParent.treeParent
113 if self.tree.node_selected != itemParent :
114 item.setExpanded(False)
119 item.plieToutEtReaffiche()
121 def handleExpandedItem(self,item):
122 #print "dans ExpandItem", self.inhibeExpand
123 if self.inhibeExpand == True : return
126 while not (hasattr (itemParent,'getPanel')) :
127 if itemParent.plie==True : itemParent.setDeplie()
128 itemParent=itemParent.treeParent
130 if self.tree.node_selected != itemParent :
131 item.setExpanded(True)
134 item.deplieToutEtReaffiche()
137 def handleOnItem(self,item,int):
138 if (len(self.selectedIndexes())!=2): return
139 #print "je passe dans handleOnItem pour ",self, item.item.nom, item, item.item
140 self.inhibeExpand == True
141 self.itemCourrant=item
143 while not (hasattr (itemParent,'getPanel')) :
144 if itemParent.plie==True : itemParent.setDeplie()
145 itemParent=itemParent.treeParent
146 if itemParent.fenetre != self.editor.fenetreCentraleAffichee :
147 if self.editor.afficheCommandesPliees : itemParent.plieToutEtReaffiche()
148 else : itemParent.affichePanneau()
149 if itemParent!=item and item.fenetre != None: item.fenetre.rendVisible()
151 fr = item.item.get_fr()
152 if self.editor: self.editor.labelCommentaire.setText(unicode(fr))
155 self.inhibeExpand == False
156 #print "je mets inhibeExpand a false handleOnItem"
159 def choisitPremier(self,name):
160 self.editor.layoutJDCCHOIX.removeWidget(self.racine.fenetre)
161 self.racine.fenetre.close()
162 new_node=self.racine.append_brother(name,'after')
165 COMMENT = "COMMENTAIRE"
166 PARAMETERS = "PARAMETRE"
168 class JDCNode(QTreeWidgetItem,GereRegles):
169 def __init__( self, treeParent, item, itemExpand=False, ancien=False ):
170 #print "creation d'un noeud : ", item, " ",item.nom,"", treeParent, self
173 self.vraiParent = treeParent
174 self.treeParent = treeParent
175 self.tree = self.treeParent.tree
176 self.editor = self.treeParent.editor
177 self.appliEficas = treeParent.appliEficas
179 self.childrenComplete=[]
181 from InterfaceQT4 import compocomm
182 from InterfaceQT4 import compoparam
183 from InterfaceQT4 import composimp
184 if (isinstance(self.item,compocomm.COMMTreeItem)) : name=tr("Commentaire")
185 elif (isinstance(self.item,compoparam.PARAMTreeItem)) : name=self.appliEficas.trUtf8(str(item.GetLabelText()[0]))
186 else: name = self.appliEficas.trUtf8(str(tr( item.nom))+" :")
187 value = self.appliEficas.trUtf8(str( item.GetText() ) )
190 mesColonnes=QStringList()
191 if self.editor.enteteQTree=='complet': mesColonnes << name << value
192 else : mesColonnes << name
194 if self.treeParent.plie==True :
196 self.appartientAUnNoeudPlie=True
199 self.appartientAUnNoeudPlie = False
201 if ancien and itemExpand : self.plie = False
202 if ancien and not itemExpand : self.plie = True
203 if (isinstance(self.item,composimp.SIMPTreeItem)) : self.plie=False
205 from InterfaceQT4 import compobloc
206 from InterfaceQT4 import compomclist
208 ajoutAuParentduNoeud=0
209 self.treeParent=treeParent
210 while (isinstance(self.treeParent,compobloc.Node) or ( isinstance(self.treeParent,compomclist.Node) and self.treeParent.item.isMCList())) :
211 self.treeParent.childrenComplete.append(self)
212 self.treeParent=self.treeParent.vraiParent
213 self.treeParent.childrenComplete.append(self)
214 if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
215 QTreeWidgetItem.__init__(self,None,mesColonnes)
217 QTreeWidgetItem.__init__(self,self.treeParent,mesColonnes)
219 self.setToolTip(0,QString(self.item.get_fr()))
220 self.setToolTip(1,QString(self.item.get_fr()))
222 repIcon=QString(self.appliEficas.repIcon)
223 monIcone = QIcon(repIcon+"/" +self.item.GetIconName() + ".png")
224 self.setIcon(0,monIcone)
227 self.build_children()
231 self.item.connect("valid",self.onValid,())
232 self.item.connect("supp" ,self.onSupp,())
233 self.item.connect("add" ,self.onAdd,())
238 if self.item.getObject().isBLOC() :
239 self.setExpanded(True)
245 def build_children(self,posInsertion=10000):
246 """ Construit la liste des enfants de self """
247 """ Se charge de remettre les noeuds Expanded dans le meme etat """
248 #print "*********** build_children ",self,self.item, self.item.nom
250 self.listeItemExpanded=[]
251 self.listeItemPlie=[]
253 for enfant in self.childrenComplete :
254 if enfant.plie : self.listeItemPlie.append(enfant.item)
255 else : self.listeItemExpanded.append(enfant.item)
257 for enfant in self.childrenComplete :
259 parent=enfant.treeParent
260 parent.removeChild(enfant)
265 self.childrenComplete = []
266 sublist = self.item._GetSubList()
269 for item in sublist :
272 if item in self.listeItemExpanded : itemExpand=True; ancien=True
273 if item in self.listeItemPlie : itemExpand=False; ancien=True
274 nouvelItem=item.itemNode(self,item,itemExpand,ancien)
275 self.children.append(nouvelItem)
277 #print "fin *********** build_children ",self,self.item, self.item.nom
280 def chercheNoeudCorrespondant(self,objSimp):
281 sublist = self.item._GetSubList()
282 for node in self.childrenComplete:
283 if node.item.object==objSimp : return node
287 def affichePanneau(self) :
288 #print " affichePanneau " , self.item.nom
289 if self.item.isactif():
291 while not (hasattr (itemParent,'getPanel')) : itemParent=itemParent.treeParent
292 if itemParent!=self :
293 itemParent.affichePanneau()
295 self.fenetre=self.getPanel()
297 from monInactifPanel import PanelInactif
298 self.fenetre = PanelInactif(self,self.editor)
300 self.editor.widgetCentraleLayout.addWidget(self.fenetre)
302 self.editor.anciennefenetre=self.editor.fenetreCentraleAffichee
303 self.editor.fenetreCentraleAffichee=self.fenetre
304 self.tree.node_selected= self
306 if self.editor.anciennefenetre != None :
307 a=self.editor.anciennefenetre.close()
309 if self.editor.widgetTree !=None : index=1
312 if self.editor.first :
313 self.editor.splitter.setSizes((400,1400,400))
314 if not(isinstance(self.fenetre,MonChoixCommande)): self.editor.first=False
315 self.tree.inhibeExpand=True
316 self.tree.expandItem(self)
318 self.tree.inhibeExpand=False
319 #print "fin de affichePanneau"
320 #print "______________________________"
323 def createPopUpMenu(self):
324 #implemente dans les noeuds derives si necessaire
329 Cette methode a pour but de commentariser la commande pointee par self
331 # On traite par une exception le cas ou l'utilisateur final cherche a désactiver
332 # (commentariser) un commentaire.
334 pos=self.treeParent.children.index(self)
335 commande_comment = self.item.get_objet_commentarise()
336 # On signale a l editeur du panel (le JDCDisplay) une modification
337 self.editor.init_modif()
338 self.treeParent.build_children()
339 self.treeParent.children[pos].select()
340 self.treeParent.children[pos].affichePanneau()
342 traceback.print_exc()
343 QMessageBox.critical( self.editor, "TOO BAD",str(e))
345 def unCommentIt(self):
347 Realise la decommentarisation de self
350 pos=self.treeParent.children.index(self)
351 commande,nom = self.item.uncomment()
352 self.editor.init_modif()
353 self.treeParent.build_children()
354 self.treeParent.children[pos].select()
355 self.treeParent.children[pos].affichePanneau()
357 QMessageBox.critical( self.editor, "Erreur !",str(e))
359 def addComment( self, after=True ):
361 Ajoute un commentaire a l'interieur du JDC :
363 self.editor.init_modif()
368 return self.append_brother( COMMENT, pos )
370 def addParameters( self, after=True ):
372 Ajoute un parametre a l'interieur du JDC :
374 self.editor.init_modif()
375 if after: pos = 'after'
377 child=self.append_brother( PARAMETERS, pos )
383 Rend le noeud courant (self) selectionne et deselectionne
386 for item in self.tree.selectedItems() :
388 self.setSelected( True )
389 #self.setExpanded( True )
390 self.tree.setCurrentItem( self )
391 self.tree.node_selected= self
393 #------------------------------------------------------------------
394 # Methodes de creation et destruction de noeuds
395 # Certaines de ces methodes peuvent etre appelees depuis l'externe
396 #------------------------------------------------------------------
397 def append_brother(self,name,pos='after',plier=False):
399 Permet d'ajouter un objet frere a l'objet associe au noeud self
400 par defaut on l'ajoute immediatement apres
403 self.editor.init_modif()
405 from InterfaceQT4 import compojdc
406 if (isinstance(self.treeParent, compojdc.Node)) and not self.verifiePosition(name,pos) : return 0
408 index = self.treeParent.children.index(self)
409 if pos == 'before': index = index
410 elif pos == 'after': index = index +1
412 print unicode(pos), tr(" n'est pas un index valide pour append_brother")
414 return self.treeParent.append_child(name,pos=index,plier=plier)
416 def verifiePosition(self,name,pos,aLaRacine=False):
417 if name not in self.editor.Classement_Commandes_Ds_Arbre : return True
418 indexName=self.editor.Classement_Commandes_Ds_Arbre.index(name)
420 etapes=self.item.get_jdc().etapes
421 if etapes == [] : return True
423 if aLaRacine == False :indexOu=etapes.index(self.item.object)
426 if pos=="after" : indexOu = indexOu+1
427 for e in etapes[:indexOu] :
429 if nom not in self.editor.Classement_Commandes_Ds_Arbre : continue
430 indexEtape=self.editor.Classement_Commandes_Ds_Arbre.index(nom)
431 if indexEtape > indexName :
432 comment=tr('le mot clef ')+name+tr(' doit etre insere avant ')+nom
433 QMessageBox.information( None,tr('insertion impossible'),comment, )
435 for e in etapes[indexOu:] :
437 if nom not in self.editor.Classement_Commandes_Ds_Arbre : continue
438 indexEtape=self.editor.Classement_Commandes_Ds_Arbre.index(nom)
439 if indexEtape < indexName :
440 comment=tr('le mot clef ')+name+tr(' doit etre insere apres ')+nom
441 QMessageBox.information( None,tr('insertion impossible'),comment, )
445 def append_child(self,name,pos=None,plier=False):
447 Methode pour ajouter un objet fils a l'objet associe au noeud self.
448 On peut l'ajouter en debut de liste (pos='first'), en fin (pos='last')
449 ou en position intermediaire.
450 Si pos vaut None, on le place a la position du catalogue.
452 #print "************** append_child ",self.item.GetLabelText(), plier
455 self.editor.init_modif()
459 index = len(self.children)
460 elif type(pos) == types.IntType :
463 elif type(pos) == types.InstanceType:
464 # pos est un item. Il faut inserer name apres pos
465 index = self.item.get_index(pos) +1
466 elif type(name) == types.InstanceType:
467 index = self.item.get_index_child(name.nom)
469 index = self.item.get_index_child(name)
471 # si on essaye d inserer a la racine
472 if (isinstance(self.treeParent,JDCTree) and index==0) :
473 verifiePosition=self.verifiePosition(name,'first',aLaRacine=True)
474 if not verifiePosition : return 0
476 self.tree.inhibeExpand=True
477 obj=self.item.additem(name,index) #CS_pbruno emet le signal 'add'
481 child=self.children[index]
482 if plier == True : child.setPlie()
483 else : child.setDeplie()
485 child=self.children[index]
486 self.tree.inhibeExpand=False
487 #print " fin append child"
491 self.editor.init_modif()
492 index = self.treeParent.children.index(self) - 1
493 if index < 0 : index =0
494 ret=self.treeParent.item.deplaceEntite(self.item.getObject())
498 Methode externe pour la destruction de l'objet associe au noeud
500 self.editor.init_modif()
501 index = self.vraiParent.children.index(self) - 1
502 if index < 0 : index =0
504 if self.item.nom == "VARIABLE" :
507 ret,commentaire=self.vraiParent.item.suppitem(self.item)
509 self.editor.affiche_infos(commentaire,Qt.red)
511 self.editor.affiche_infos(commentaire)
512 self.treeParent.build_children()
513 if self.treeParent.childrenComplete : toselect=self.treeParent.childrenComplete[index]
514 else: toselect=self.treeParent
515 if recalcule : jdc.recalcule_etat_correlation()
516 from InterfaceQT4 import compojdc
517 # cas ou on detruit dans l arbre sans affichage
518 if isinstance(self.treeParent,compojdc.Node) :
519 toselect.affichePanneau()
521 if self.treeParent.fenetre== None : return
522 #print "J appelle reaffiche de browser apres delete"
523 self.treeParent.fenetre.reaffiche(toselect)
525 def deleteMultiple(self,liste=()):
527 Methode externe pour la destruction d une liste de noeud
529 from InterfaceQT4 import compojdc
530 self.editor.init_modif()
535 while not(isinstance(jdc,compojdc.Node)):
538 if not( isinstance(noeud.treeParent, compojdc.Node)): continue
539 if noeud.item.nom == "VARIABLE" : recalcule=1
540 if noeud.treeParent.children.index(noeud) < index : index=noeud.treeParent.children.index(noeud)
541 if index < 0 : index =0
543 # Cas ou on détruit dans une ETape
545 parentPosition=self.treeParent
546 while not(isinstance(parentPosition, compojdc.Node)):
547 index=parentPosition.treeParent.children.index(parentPosition)
548 parentPosition=parentPosition.treeParent
551 noeud.treeParent.item.suppitem(noeud.item)
554 if recalcule : jdc.recalcule_etat_correlation()
555 try : toselect=parentPosition.children[index]
556 except : toselect=jdc
558 toselect.affichePanneau()
560 # #------------------------------------------------------------------
563 #print "onValid pour ", self.item.nom
564 if hasattr(self,'fenetre') and self.fenetre: self.fenetre.setValide()
565 if (self.item.nom == "VARIABLE" or self.item.nom == "DISTRIBUTION") and self.item.isvalid():
566 self.item.jdc.recalcule_etat_correlation()
567 if hasattr(self.item,'forceRecalcul'):
568 self.forceRecalculChildren(self.item.forceRecalcul)
569 self.editor.init_modif()
571 self.update_node_valid()
572 self.update_node_label()
573 self.update_node_texte()
575 def onAdd(self,object):
576 if self.JESUISOFF==1 : return
577 print "onAdd pour ", self.item.nom, object.nom
578 self.editor.init_modif()
580 # PN -- non necessaire si item=jdc
581 if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
583 def onSupp(self,object):
584 if self.JESUISOFF==1 : return
585 print "onSup pour ", self.item.nom, object.nom
586 self.editor.init_modif()
588 # PN -- non necessaire si item=jdc
589 if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
594 def update_node_valid(self):
595 """Cette methode remet a jour la validite du noeud (icone)
598 repIcon=QString(self.appliEficas.repIcon)
599 monIcone = QIcon(repIcon+"/" +self.item.GetIconName() + ".png")
600 self.setIcon(0,monIcone)
603 def update_node_label(self):
604 """ Met a jour le label du noeud """
605 #print "NODE update_node_label", self.item.GetLabelText()
606 labeltext,fonte,couleur = self.item.GetLabelText()
608 #self.setText(0, labeltext)
611 def update_node_label_in_blue(self):
612 if hasattr(self.appliEficas,'noeudColore'):
613 self.appliEficas.noeudColore.setTextColor( 0,Qt.black)
614 self.appliEficas.noeudColore.update_node_label()
615 self.setTextColor( 0,Qt.blue )
616 labeltext,fonte,couleur = self.item.GetLabelText()
617 self.setText(0, labeltext)
618 self.appliEficas.noeudColore=self
620 def update_plusieurs_node_label_in_blue(self,liste):
621 if hasattr(self.appliEficas,'listeNoeudsColores'):
622 for noeud in self.appliEficas.listeNoeudsColores:
623 noeud.setTextColor( 0,Qt.black)
624 noeud.update_node_label()
625 self.appliEficas.listeNoeudsColores=[]
627 noeud.setTextColor( 0,Qt.blue )
628 labeltext,fonte,couleur = noeud.item.GetLabelText()
629 noeud.setText(0, labeltext)
630 self.appliEficas.listeNoeudsColores.append(noeud)
632 def update_node_texte_in_black(self):
633 """ Met a jour les noms des SD et valeurs des mots-cles """
634 self.setTextColor( 1,Qt.black )
635 value = self.item.GetText()
636 self.setText(1, value)
638 def update_node_texte(self):
639 """ Met a jour les noms des SD et valeurs des mots-cles """
640 value = self.item.GetText()
641 self.setText(1, value)
644 def update_node_texte_in_blue(self):
645 self.setTextColor( 1,Qt.blue )
646 value = self.item.GetText()
647 self.setText(1, value)
649 def update_nodes(self):
650 #print 'NODE update_nodes', self.item.GetLabelText()
651 self.build_children()
653 def update_valid(self) :
654 """Cette methode a pour but de mettre a jour la validite du noeud
655 et de propager la demande de mise a jour a son parent
657 #print "NODE update_valid", self.item.GetLabelText()
658 self.update_node_valid()
660 self.treeParent.update_valid()
664 def update_texte(self):
665 """ Met a jour les noms des SD et valeurs des mots-cles """
666 #print "NODE update_texte", self.item.GetLabelText()
667 self.update_node_texte()
668 if self.isExpanded() :
669 for child in self.children:
670 if child.isHidden() == false : child.update_texte()
673 def forceRecalculChildren(self,niveau):
674 if self.state=='recalcule' :
677 self.state='recalcule'
678 if hasattr(self.item,'object'):
679 self.item.object.state="modified"
680 for child in self.children:
681 if niveau > 0 : child.forceRecalculChildren(niveau - 1)
685 def doPaste(self,node_selected,pos='after'):
687 Déclenche la copie de l'objet item avec pour cible
688 l'objet passé en argument : node_selected
690 #print 'je passe dans doPaste'
691 objet_a_copier = self.item.get_copie_objet()
692 child=node_selected.doPasteCommande(objet_a_copier,pos)
695 def doPasteCommande(self,objet_a_copier,pos='after'):
697 Réalise la copie de l'objet passé en argument qui est nécessairement
702 child = self.append_brother(objet_a_copier,pos)
707 def doPastePremier(self,objet_a_copier):
709 Réalise la copie de l'objet passé en argument (objet_a_copier)
711 objet = objet_a_copier.item.get_copie_objet()
712 child = self.append_child(objet,pos='first')
716 def plieToutEtReaffiche(self):
717 #print "je suis dans plieToutEtReaffiche", self.item.get_nom()
718 self.editor.deplier = False
719 for item in self.children :
720 # il ne faut pas plier les blocs
721 from InterfaceQT4 import compobloc
722 if (isinstance(item,compobloc.Node)) : continue
724 self.affichePanneau()
726 def deplieToutEtReaffiche(self):
727 self.editor.deplier = True
728 for item in self.children :
730 self.affichePanneau()
733 #print "je mets inhibeExpand a true dans setPlie"
734 #print "je suis dans plieTout", self.item.get_nom()
736 if self.fenetre == self.editor.fenetreCentraleAffichee and isinstance(self.treeParent,compojdc.Node):
738 self.tree.inhibeExpand=True
739 self.tree.collapseItem(self)
740 self.setPlieChildren()
741 self.tree.inhibeExpand=False
742 #print "je mets inhibeExpand a false dans setPlie"
745 # on ne plie pas au niveau 1
747 # for item in self.children :
748 # item.appartientAUnNoeudPlie=False
750 def setPlieChildren(self):
751 #print "dans setPlieChildren pour", self.item.nom
753 for c in self.children :
755 #print "dans setPlieChildren appartientAUnNoeudPlie=True ", c, c.item.GetLabelText()[0]
756 c.appartientAUnNoeudPlie=True
758 #print "dans setPlieChildren plie", c.item.nom
761 # Pour les blocs et les motcles list
762 # on affiche un niveau de plus
763 from InterfaceQT4 import compobloc
764 from InterfaceQT4 import compomclist
765 if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
766 niveauPere=self.treeParent
767 while (isinstance(niveauPere,compobloc.Node) or (isinstance(niveauPere,compomclist.Node) and niveauPere.item.isMCList())) :
768 niveauPere=niveauPere.treeParent
769 for c in self.children :
770 c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
773 # on affiche un niveau de plus
774 #if isinstance(self,compomclist.Node) :
775 #if isinstance(self,compobloc.Node) :
776 # niveauPere=self.treeParent
777 # while (isinstance(niveauPere,compobloc.Node)):
778 # niveauPere=niveauPere.treeParent
779 # for c in self.children :
780 # c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
783 #print "dans setPlieChildren pour", self.item.nom
784 #print "je mets inhibeExpand a true dans setDeplie"
785 self.tree.inhibeExpand=True
787 self.tree.expandItem(self)
788 self.setDeplieChildren()
789 self.tree.inhibeExpand=False
790 #print "je mets inhibeExpand a false dans setDePlie"
792 def setDeplieChildren(self):
793 #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", self.item.GetLabelText()
794 for c in self.children :
795 c.setDeplieChildren()
796 #print "dans setDeplieChildren ", c.item.nom
797 c.appartientAUnNoeudPlie=False
801 def selectAvant(self):
802 i=self.item.jdc.etapes.index(self.item.object)
804 cherche=self.item.jdc.etapes[i-1]
806 cherche=self.item.jdc.etapes[-1]
808 for i in self.tree.racine.children :
809 if i.item.object== cherche :
812 if node : node.affichePanneau()
814 def selectApres(self):
815 i=self.item.jdc.etapes.index(self.item.object)
817 cherche=self.item.jdc.etapes[i+1]
819 cherche=self.item.jdc.etapes[0]
821 for i in self.tree.racine.children :
822 if i.item.object== cherche :
825 if node : node.affichePanneau()