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 monChoixCommande import MonChoixCommande
32 class JDCTree( QTreeWidget ):
33 def __init__( self, jdc_item, QWParent):
34 #if hasattr(QWParent,'widgetTree') :
35 self.editor = QWParent
37 if self.editor.widgetTree !=None :
38 QTreeWidget.__init__(self, self.editor.widgetTree )
39 self.editor.verticalLayout_2.addWidget(self)
40 if self.editor.enteteQTree=='complet':
41 self.headerItem().setText(0, "Commande ")
42 self.headerItem().setText(1, "Concept/Valeur")
44 self.headerItem().setText(0, "Commande ")
45 self.setColumnWidth(0,200)
46 self.setExpandsOnDoubleClick(False)
47 self.setSelectionMode(3)
49 QTreeWidget.__init__(self, None )
52 self.appliEficas = self.editor.appliEficas
53 self.childrenComplete=[]
54 self.childrenIssusDesBlocs=[]
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 !=[] :
71 if self.editor.afficheCommandesPliees : self.racine.children[0].plieToutEtReaffiche()
72 else : self.racine.children[0].deplieToutEtReaffiche()
74 self.racine.children[0].fenetre.donnePremier()
75 else : self.racine.affichePanneau()
79 def contextMenuEvent(self,event) :
80 #print "contextMenuEvent"
81 coord=event.globalPos()
82 item= self.currentItem()
83 self.handleContextMenu(item,coord)
85 def handleContextMenu(self,item,coord):
87 Private slot to show the context menu of the listview.
89 @param itm the selected listview item (QListWidgetItem)
90 @param coord the position of the mouse pointer (QPoint)
91 Attention : existeMenu permet de savoir si un menu est associe a cet item
93 #print "handleContextMenu"
94 if item == None : return
95 if item.existeMenu == 0 : return
97 item.createPopUpMenu()
99 if item.item.get_nom() == "DISTRIBUTION" and item.item.isvalid() :
100 item.Graphe.setEnabled(1)
101 item.menu.exec_(coord)
104 def handleCollapsedItem(self,item):
105 #print "dans CollapsedItem", self.inhibeExpand
106 if self.inhibeExpand == True : return
107 # On traite le cas de l item non selectionne
109 while not (hasattr (itemParent,'getPanel2')) :
110 itemParent=itemParent.treeParent
111 if self.tree.node_selected != itemParent :
112 item.setExpanded(False)
117 item.plieToutEtReaffiche()
119 def handleExpandedItem(self,item):
120 #print "dans ExpandItem", self.inhibeExpand
121 if self.inhibeExpand == True : return
124 while not (hasattr (itemParent,'getPanel2')) :
125 if itemParent.plie==True : itemParent.setDeplie()
126 itemParent=itemParent.treeParent
128 if self.tree.node_selected != itemParent :
129 item.setExpanded(True)
132 item.deplieToutEtReaffiche()
134 def handleOnItem(self,item,int):
135 #if (len(self.selectedIndexes())!=2): return
136 #print "je passe dans handleOnItem"
137 self.inhibeExpand == True
138 self.itemCourrant=item
140 #print self.itemCourrant
141 while not (hasattr (itemParent,'getPanel2')) :
142 if itemParent.plie==True : itemParent.setDeplie()
143 itemParent=itemParent.treeParent
145 #print itemParent.fenetre
146 #print self.editor.afficheCommandesPliees
147 if itemParent.fenetre != self.editor.fenetreCentraleAffichee :
148 #print self.editor.afficheCommandesPliees
149 if self.editor.afficheCommandesPliees : itemParent.plieToutEtReaffiche()
150 else : itemParent.affichePanneau()
151 if itemParent!=item and item.fenetre != None: item.fenetre.rendVisible()
154 fr = item.item.get_fr()
155 if self.editor: self.editor.labelCommentaire.setText(unicode(fr))
159 self.inhibeExpand == False
160 #print "je mets inhibeExpand a false handleOnItem"
163 def choisitPremier(self,name):
164 self.editor.layoutJDCCHOIX.removeWidget(self.racine.fenetre)
165 self.racine.fenetre.close()
166 new_node=self.racine.append_brother(name,'after')
169 COMMENT = "COMMENTAIRE"
170 PARAMETERS = "PARAMETRE"
172 class JDCNode(QTreeWidgetItem):
173 def __init__( self, treeParent, item):
174 #print "creation d'un noeud : ", item, " ",item.nom,"", treeParent, self
177 self.vraiParent = treeParent
178 self.treeParent = treeParent
179 self.tree = self.treeParent.tree
180 self.editor = self.treeParent.editor
181 self.appliEficas = treeParent.appliEficas
182 self.treeParent.childrenIssusDesBlocs=[]
183 self.childrenComplete=[]
185 from InterfaceQT4 import compocomm
186 from InterfaceQT4 import compoparam
187 if (isinstance(self.item,compocomm.COMMTreeItem)) : name=tr("Commentaire")
188 elif (isinstance(self.item,compoparam.PARAMTreeItem)) : name=self.appliEficas.trUtf8(str(item.GetLabelText()[0]))
189 else: name = self.appliEficas.trUtf8(str(tr( item.nom))+" :")
190 value = self.appliEficas.trUtf8(str( item.GetText() ) )
192 mesColonnes=QStringList()
193 if self.editor.enteteQTree=='complet': mesColonnes << name << value
194 else : mesColonnes << name
196 if self.treeParent.plie==True :
198 self.appartientAUnNoeudPlie=True
201 self.appartientAUnNoeudPlie = False
202 #print "self.plie", self.plie
203 #print "self.appartientAUnNoeudPlie", self.appartientAUnNoeudPlie
204 #print self.treeParent
206 ajoutAuParentduNoeud=0
207 from InterfaceQT4 import compobloc
208 from InterfaceQT4 import compomclist
209 while (isinstance(self.treeParent,compobloc.Node) or ( isinstance(self.treeParent,compomclist.Node) and self.treeParent.item.isMCList())) :
210 #while (isinstance(self.treeParent,compobloc.Node)) :
211 self.treeParent=self.treeParent.treeParent
212 ajoutAuParentduNoeud=1
213 if ajoutAuParentduNoeud :
214 treeParent.childrenComplete.append(self)
215 self.treeParent.childrenIssusDesBlocs.append(self)
216 while (isinstance(self.treeParent,compobloc.Node)) : self.treeParent=self.treeParent.treeParent
218 #if isinstance(self,compobloc.Node) :
219 if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
220 QTreeWidgetItem.__init__(self,None,mesColonnes)
222 QTreeWidgetItem.__init__(self,self.treeParent,mesColonnes)
223 self.treeParent.childrenComplete.append(self)
225 self.setToolTip(0,QString(self.item.get_fr()))
226 self.setToolTip(1,QString(self.item.get_fr()))
228 repIcon=QString(self.appliEficas.repIcon)
229 monIcone = QIcon(repIcon+"/" +self.item.GetIconName() + ".png")
230 self.setIcon(0,monIcone)
233 self.build_children()
237 self.item.connect("valid",self.onValid,())
238 self.item.connect("supp" ,self.onSupp,())
239 self.item.connect("add" ,self.onAdd,())
243 if self.item.getObject().isBLOC() :
244 self.setExpanded(True)
250 def build_children(self,posInsertion=10000):
251 """ Construit la liste des enfants de self """
252 """ Se charge de remettre les noeuds Expanded dans le meme etat """
253 #print "*********** build_children ",self.item, self.item.GetLabelText()
256 for item in self.childrenComplete :
258 #if item.isExpanded():
259 # if self.childrenComplete.index(item) < posInsertion :
260 # listeExpanded.append(self.childrenComplete.index(item))
261 # print dir(item.item )
263 # listeExpanded.append( self.childrenComplete.index(item) +1)
264 self.detruit_les_noeuds_issus_de_blocs(item)
265 parent=item.treeParent
266 parent.removeChild(item)
270 self.childrenComplete = []
271 sublist = self.item._GetSubList()
273 for item in sublist :
274 nouvelItem=item.itemNode(self,item)
275 self.children.append(nouvelItem)
276 #print " J ajoute ", nouvelItem ,nouvelItem.item.GetLabelText(),"dans" ,self.item.GetLabelText()
278 #if ind in listeExpanded : nouvelItem.setExpanded(1)
280 #if ind in listeExpanded : print "plie=0"
281 #else : print "plie=1"
282 #if ind in listeExpanded : nouvelItem.plie=0
283 #else : nouvelItem.plie=1
286 #print "*********** fin build_children ",self.item, self.item.GetLabelText()
288 def chercheNoeudCorrespondant(self,objSimp):
289 sublist = self.item._GetSubList()
290 for node in self.childrenComplete:
291 if node.item.object==objSimp : return node
294 def affichePanneau(self) :
295 #print "dans affichePanneau appel getPanel2", self.item.GetLabelText()
296 if self.item.isactif():
298 while not (hasattr (itemParent,'getPanel2')) :
299 itemParent=itemParent.treeParent
300 if itemParent!=self :
301 itemParent.affichePanneau()
303 self.fenetre=self.getPanel2()
305 from monInactifPanel import PanelInactif
306 self.fenetre = PanelInactif(self,self.editor)
308 self.editor.widgetCentraleLayout.addWidget(self.fenetre)
309 #print "widgetCentraleLayout = ", self.editor.widgetCentraleLayout
310 #print "nouvelle fenetre ", self.fenetre, " associee a ", self
312 self.editor.anciennefenetre=self.editor.fenetreCentraleAffichee
313 #print "ancienne fenetre ", self.editor.anciennefenetre
314 self.editor.fenetreCentraleAffichee=self.fenetre
315 self.tree.node_selected= self
317 if self.editor.anciennefenetre != None :
318 a=self.editor.anciennefenetre.close()
319 #print "je ferme ", self.editor.anciennefenetre
321 if self.editor.widgetTree !=None : index=1
324 if self.editor.first :
325 self.editor.splitter.setSizes((400,1400,400))
326 if not(isinstance(self.fenetre,MonChoixCommande)): self.editor.first=False
327 self.tree.inhibeExpand=True
328 self.tree.expandItem(self)
330 self.tree.inhibeExpand=False
331 #print "fin de affichePanneau"
332 #print "______________________________"
335 def createPopUpMenu(self):
336 #implemente dans les noeuds derives si necessaire
341 Cette methode a pour but de commentariser la commande pointee par self
343 # On traite par une exception le cas ou l'utilisateur final cherche a désactiver
344 # (commentariser) un commentaire.
346 pos=self.treeParent.children.index(self)
347 commande_comment = self.item.get_objet_commentarise()
348 # On signale a l editeur du panel (le JDCDisplay) une modification
349 self.editor.init_modif()
350 self.treeParent.build_children()
351 self.treeParent.children[pos].select()
352 self.treeParent.children[pos].affichePanneau()
354 traceback.print_exc()
355 QMessageBox.critical( self.editor, "TOO BAD",str(e))
357 def unCommentIt(self):
359 Realise la decommentarisation de self
362 pos=self.treeParent.children.index(self)
363 commande,nom = self.item.uncomment()
364 self.editor.init_modif()
365 self.treeParent.build_children()
366 self.treeParent.children[pos].select()
367 self.treeParent.children[pos].affichePanneau()
369 QMessageBox.critical( self.editor, "Erreur !",str(e))
371 def addComment( self, after=True ):
373 Ajoute un commentaire a l'interieur du JDC :
375 self.editor.init_modif()
380 return self.append_brother( COMMENT, pos )
382 def addParameters( self, after=True ):
384 Ajoute un parametre a l'interieur du JDC :
386 self.editor.init_modif()
387 if after: pos = 'after'
389 child=self.append_brother( PARAMETERS, pos )
395 Rend le noeud courant (self) selectionne et deselectionne
398 #print "je suis sur select"
399 for item in self.tree.selectedItems() :
401 self.setSelected( True )
402 #self.setExpanded( True )
403 self.tree.setCurrentItem( self )
404 self.tree.node_selected= self
406 #------------------------------------------------------------------
407 # Methodes de creation et destruction de noeuds
408 # Certaines de ces methodes peuvent etre appelees depuis l'externe
409 #------------------------------------------------------------------
410 def append_brother(self,name,pos='after',plier=False):
412 Permet d'ajouter un objet frere a l'objet associe au noeud self
413 par defaut on l'ajoute immediatement apres
416 self.editor.init_modif()
417 index = self.treeParent.children.index(self)
418 if pos == 'before': index = index
419 elif pos == 'after': index = index +1
421 print unicode(pos), tr(" n'est pas un index valide pour append_brother")
423 return self.treeParent.append_child(name,pos=index,plier=plier)
425 def append_child(self,name,pos=None,plier=False):
427 Methode pour ajouter un objet fils a l'objet associe au noeud self.
428 On peut l'ajouter en debut de liste (pos='first'), en fin (pos='last')
429 ou en position intermediaire.
430 Si pos vaut None, on le place a la position du catalogue.
432 #print "************** append_child ",self.item.GetLabelText(), plier
433 self.editor.init_modif()
437 index = len(self.children)
438 elif type(pos) == types.IntType :
441 elif type(pos) == types.InstanceType:
442 # pos est un item. Il faut inserer name apres pos
443 index = self.item.get_index(pos) +1
444 elif type(name) == types.InstanceType:
445 index = self.item.get_index_child(name.nom)
447 index = self.item.get_index_child(name)
448 self.tree.inhibeExpand=True
449 obj=self.item.additem(name,index) #CS_pbruno emet le signal 'add'
453 # old_obj = self.item.object.get_child(name.nom,restreint = 'oui')
455 # if plier : child.plieToutEtReaffiche()
456 # else : child.affichePanneau()
457 # print "dans le 1er Try"
460 # Souci pour gerer les copies des AFFE d'une commande à l autre
462 # child=self.children[index]
463 # if plier == True : child.setPlie()
464 # else : child.setDeplie()
465 # print "dans le 2nd Try"
467 # child=self.children[index]
468 # print "dans le except"
471 child=self.children[index]
472 if plier == True : child.setPlie()
473 else : child.setDeplie()
475 child=self.children[index]
476 #print "dans le except"
477 self.tree.inhibeExpand=False
481 self.editor.init_modif()
482 index = self.treeParent.children.index(self) - 1
483 if index < 0 : index =0
484 ret=self.treeParent.item.deplaceEntite(self.item.getObject())
488 Methode externe pour la destruction de l'objet associe au noeud
490 self.editor.init_modif()
491 index = self.vraiParent.children.index(self) - 1
492 if index < 0 : index =0
494 if self.item.nom == "VARIABLE" :
497 ret=self.vraiParent.item.suppitem(self.item)
498 self.treeParent.build_children()
499 if self.treeParent.childrenComplete : toselect=self.treeParent.childrenComplete[index]
500 else: toselect=self.treeParent
501 if recalcule : jdc.recalcule_etat_correlation()
502 from InterfaceQT4 import compojdc
503 # cas ou on detruit dans l arbre sans affichage
504 if isinstance(self.treeParent,compojdc.Node) :
505 toselect.affichePanneau()
507 if self.treeParent.fenetre== None : return
508 #print "J appelle reaffiche de browser apres delete"
509 self.treeParent.fenetre.reaffiche(toselect)
511 def deleteMultiple(self,liste=()):
513 Methode externe pour la destruction d une liste de noeud
515 from InterfaceQT4 import compojdc
516 self.editor.init_modif()
521 while not(isinstance(jdc,compojdc.Node)):
524 if not( isinstance(noeud.treeParent, compojdc.Node)): continue
525 if noeud.item.nom == "VARIABLE" : recalcule=1
526 if noeud.treeParent.children.index(noeud) < index : index=noeud.treeParent.children.index(noeud)
527 if index < 0 : index =0
529 # Cas ou on détruit dans une ETape
531 parentPosition=self.treeParent
532 while not(isinstance(parentPosition, compojdc.Node)):
533 index=parentPosition.treeParent.children.index(parentPosition)
534 parentPosition=parentPosition.treeParent
537 noeud.treeParent.item.suppitem(noeud.item)
540 if recalcule : jdc.recalcule_etat_correlation()
541 try : toselect=parentPosition.children[index]
542 except : toselect=jdc
544 toselect.affichePanneau()
546 # #------------------------------------------------------------------
549 #print "onValid pour ", self.item.nom
550 if hasattr(self,'fenetre') and self.fenetre:
551 self.fenetre.setValide()
552 if self.item.nom == "VARIABLE" and self.item.isvalid():
553 self.item.jdc.recalcule_etat_correlation()
554 if hasattr(self.item,'forceRecalcul'):
555 self.forceRecalculChildren(self.item.forceRecalcul)
556 self.editor.init_modif()
558 self.update_node_valid()
559 self.update_node_label()
560 self.update_node_texte()
562 def onAdd(self,object):
563 #print "onAdd pour ", self.item.nom
564 self.editor.init_modif()
566 #print "dans onAdd" ,self.item
567 # PN -- non necessaire si item=jdc
568 if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
570 def onSupp(self,object):
571 #print "onSupp pour ", self.item.nom
572 self.editor.init_modif()
574 # PN -- non necessaire si item=jdc
575 if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
577 def detruit_les_noeuds_issus_de_blocs(self,bloc):
578 from InterfaceQT4 import compobloc
579 if (isinstance(bloc,compobloc.Node)) :
580 for node in bloc.childrenComplete :
581 self.detruit_les_noeuds_issus_de_blocs(node)
582 parent=node.treeParent
583 #print "je detruit " , node.item.GetLabelText()
584 parent.removeChild(node)
586 def update_node_valid(self):
587 """Cette methode remet a jour la validite du noeud (icone)
590 repIcon=QString(self.appliEficas.repIcon)
591 monIcone = QIcon(repIcon+"/" +self.item.GetIconName() + ".png")
592 self.setIcon(0,monIcone)
595 def update_node_label(self):
596 """ Met a jour le label du noeud """
597 #print "NODE update_node_label", self.item.GetLabelText()
598 labeltext,fonte,couleur = self.item.GetLabelText()
600 #self.setText(0, labeltext)
603 def update_node_label_in_blue(self):
604 if hasattr(self.appliEficas,'noeudColore'):
605 self.appliEficas.noeudColore.setTextColor( 0,Qt.black)
606 self.appliEficas.noeudColore.update_node_label()
607 self.setTextColor( 0,Qt.blue )
608 labeltext,fonte,couleur = self.item.GetLabelText()
609 self.setText(0, labeltext)
610 self.appliEficas.noeudColore=self
612 def update_plusieurs_node_label_in_blue(self,liste):
613 if hasattr(self.appliEficas,'listeNoeudsColores'):
614 for noeud in self.appliEficas.listeNoeudsColores:
615 noeud.setTextColor( 0,Qt.black)
616 noeud.update_node_label()
617 self.appliEficas.listeNoeudsColores=[]
619 noeud.setTextColor( 0,Qt.blue )
620 labeltext,fonte,couleur = noeud.item.GetLabelText()
621 noeud.setText(0, labeltext)
622 self.appliEficas.listeNoeudsColores.append(noeud)
624 def update_node_texte_in_black(self):
625 """ Met a jour les noms des SD et valeurs des mots-cles """
626 self.setTextColor( 1,Qt.black )
627 value = self.item.GetText()
628 self.setText(1, value)
630 def update_node_texte(self):
631 """ Met a jour les noms des SD et valeurs des mots-cles """
632 value = self.item.GetText()
633 self.setText(1, value)
635 def update_node_texte_in_blue(self):
636 self.setTextColor( 1,Qt.blue )
637 value = self.item.GetText()
638 self.setText(1, value)
640 def update_nodes(self):
641 #print 'NODE update_nodes', self.item.GetLabelText()
642 self.build_children()
644 def update_valid(self) :
645 """Cette methode a pour but de mettre a jour la validite du noeud
646 et de propager la demande de mise a jour a son parent
648 #print "NODE update_valid", self.item.GetLabelText()
649 self.update_node_valid()
651 self.treeParent.update_valid()
655 def update_texte(self):
656 """ Met a jour les noms des SD et valeurs des mots-cles """
657 #print "NODE update_texte", self.item.GetLabelText()
658 self.update_node_texte()
659 if self.isExpanded() :
660 for child in self.children:
661 if child.isHidden() == false : child.update_texte()
664 def forceRecalculChildren(self,niveau):
665 if self.state=='recalcule' :
668 self.state='recalcule'
669 if hasattr(self.item,'object'):
670 self.item.object.state="modified"
671 for child in self.children:
672 if niveau > 0 : child.forceRecalculChildren(niveau - 1)
676 def doPaste(self,node_selected,pos='after'):
678 Déclenche la copie de l'objet item avec pour cible
679 l'objet passé en argument : node_selected
681 #print 'je passe dans doPaste'
682 objet_a_copier = self.item.get_copie_objet()
683 child=node_selected.doPasteCommande(objet_a_copier,pos)
686 def doPasteCommande(self,objet_a_copier,pos='after'):
688 Réalise la copie de l'objet passé en argument qui est nécessairement
693 child = self.append_brother(objet_a_copier,pos)
698 def doPastePremier(self,objet_a_copier):
700 Réalise la copie de l'objet passé en argument (objet_a_copier)
702 objet = objet_a_copier.item.get_copie_objet()
703 child = self.append_child(objet,pos='first')
707 def plieToutEtReaffiche(self):
708 #print "je suis dans plieToutEtReaffiche", self.item.get_nom()
709 self.editor.deplier = False
710 for item in self.children :
712 self.affichePanneau()
714 def deplieToutEtReaffiche(self):
715 self.editor.deplier = True
716 for item in self.children :
718 self.affichePanneau()
721 #print "je mets inhibeExpand a true dans setPlie"
722 #print "je suis dans plieTout", self.item.get_nom()
724 if self.fenetre == self.editor.fenetreCentraleAffichee and isinstance(self.treeParent,compojdc.Node):
726 self.tree.inhibeExpand=True
727 self.tree.collapseItem(self)
728 self.setPlieChildren()
729 self.tree.inhibeExpand=False
730 #print "je mets inhibeExpand a false dans setPlie"
733 # on ne plie pas au niveau 1
735 # for item in self.children :
736 # item.appartientAUnNoeudPlie=False
738 def setPlieChildren(self):
740 for c in self.children :
742 #print "dans setPlieChildren appartientAUnNoeudPlie=True ", c, c.item.GetLabelText()[0]
743 c.appartientAUnNoeudPlie=True
747 # Pour les blocs et les motcles list
748 # on affiche un niveau de plus
749 from InterfaceQT4 import compobloc
750 from InterfaceQT4 import compomclist
751 if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
752 niveauPere=self.treeParent
753 while (isinstance(niveauPere,compobloc.Node) or (isinstance(niveauPere,compomclist.Node) and niveauPere.item.isMCList())) :
754 niveauPere=niveauPere.treeParent
755 for c in self.children :
756 c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
759 # on affiche un niveau de plus
760 #if isinstance(self,compomclist.Node) :
761 #if isinstance(self,compobloc.Node) :
762 # niveauPere=self.treeParent
763 # while (isinstance(niveauPere,compobloc.Node)):
764 # niveauPere=niveauPere.treeParent
765 # for c in self.children :
766 # c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
769 #print "je mets inhibeExpand a true dans setDeplie"
770 self.tree.inhibeExpand=True
772 self.tree.expandItem(self)
773 self.setDeplieChildren()
774 self.tree.inhibeExpand=False
775 #print "je mets inhibeExpand a false dans setDePlie"
777 def setDeplieChildren(self):
778 #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", self.item.GetLabelText()
779 for c in self.children :
780 c.setDeplieChildren()
781 #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", c.item.GetLabelText()
782 c.appartientAUnNoeudPlie=False
786 def selectAvant(self):
787 i=self.item.jdc.etapes.index(self.item.object)
789 cherche=self.item.jdc.etapes[i-1]
791 cherche=self.item.jdc.etapes[-1]
793 for i in self.tree.racine.children :
794 if i.item.object== cherche :
797 if node : node.affichePanneau()
799 def selectApres(self):
800 i=self.item.jdc.etapes.index(self.item.object)
802 cherche=self.item.jdc.etapes[i+1]
804 cherche=self.item.jdc.etapes[0]
806 for i in self.tree.racine.children :
807 if i.item.object== cherche :
810 if node : node.affichePanneau()