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 !=[] :
70 if self.editor.afficheCommandesPliees : self.racine.children[0].plieToutEtReaffiche()
71 else : self.racine.children[0].deplieToutEtReaffiche()
72 self.racine.children[0].fenetre.donnePremier()
73 else : self.racine.affichePanneau()
77 def contextMenuEvent(self,event) :
78 #print "contextMenuEvent"
79 coord=event.globalPos()
80 item= self.currentItem()
81 self.handleContextMenu(item,coord)
83 def handleContextMenu(self,item,coord):
85 Private slot to show the context menu of the listview.
87 @param itm the selected listview item (QListWidgetItem)
88 @param coord the position of the mouse pointer (QPoint)
89 Attention : existeMenu permet de savoir si un menu est associe a cet item
91 #print "handleContextMenu"
92 if item == None : return
93 if item.existeMenu == 0 : return
95 item.createPopUpMenu()
97 if item.item.get_nom() == "DISTRIBUTION" and item.item.isvalid() :
98 item.Graphe.setEnabled(1)
99 item.menu.exec_(coord)
102 def handleCollapsedItem(self,item):
103 #print "dans CollapsedItem", self.inhibeExpand
104 if self.inhibeExpand == True : return
105 # On traite le cas de l item non selectionne
107 while not (hasattr (itemParent,'getPanel2')) :
108 itemParent=itemParent.treeParent
109 if self.tree.node_selected != itemParent :
110 item.setExpanded(False)
115 item.plieToutEtReaffiche()
117 def handleExpandedItem(self,item):
118 #print "dans ExpandItem", self.inhibeExpand
119 if self.inhibeExpand == True : return
122 while not (hasattr (itemParent,'getPanel2')) :
123 if itemParent.plie==True : itemParent.setDeplie()
124 itemParent=itemParent.treeParent
126 if self.tree.node_selected != itemParent :
127 item.setExpanded(True)
130 item.deplieToutEtReaffiche()
132 def handleOnItem(self,item,int):
133 #if (len(self.selectedIndexes())!=2): return
134 #print "je passe dans handleOnItem"
135 self.inhibeExpand == True
136 self.itemCourrant=item
138 #print self.itemCourrant
139 while not (hasattr (itemParent,'getPanel2')) :
140 if itemParent.plie==True : itemParent.setDeplie()
141 itemParent=itemParent.treeParent
143 #print itemParent.fenetre
144 #print self.editor.afficheCommandesPliees
145 if itemParent.fenetre != self.editor.fenetreCentraleAffichee :
146 #print self.editor.afficheCommandesPliees
147 if self.editor.afficheCommandesPliees : itemParent.plieToutEtReaffiche()
148 else : itemParent.affichePanneau()
149 if itemParent!=item and item.fenetre != None: item.fenetre.rendVisible()
152 fr = item.item.get_fr()
153 if self.editor: self.editor.labelCommentaire.setText(unicode(fr))
157 self.inhibeExpand == False
158 #print "je mets inhibeExpand a false handleOnItem"
161 def choisitPremier(self,name):
162 self.editor.layoutJDCCHOIX.removeWidget(self.racine.fenetre)
163 self.racine.fenetre.close()
164 new_node=self.racine.append_brother(name,'after')
167 COMMENT = "COMMENTAIRE"
168 PARAMETERS = "PARAMETRE"
170 class JDCNode(QTreeWidgetItem):
171 def __init__( self, treeParent, item):
172 #print "creation d'un noeud : ", item, " ",item.nom,"", treeParent, self
175 self.vraiParent = treeParent
176 self.treeParent = treeParent
177 self.tree = self.treeParent.tree
178 self.editor = self.treeParent.editor
179 self.appliEficas = treeParent.appliEficas
180 self.treeParent.childrenIssusDesBlocs=[]
181 self.childrenComplete=[]
183 from InterfaceQT4 import compocomm
184 from InterfaceQT4 import compoparam
185 if (isinstance(self.item,compocomm.COMMTreeItem)) : name=tr("Commentaire")
186 elif (isinstance(self.item,compoparam.PARAMTreeItem)) : name=self.appliEficas.trUtf8(str(item.GetLabelText()[0]))
187 else: name = self.appliEficas.trUtf8(str(tr( item.nom))+" :")
188 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
200 #print "self.plie", self.plie
201 #print "self.appartientAUnNoeudPlie", self.appartientAUnNoeudPlie
202 #print self.treeParent
204 ajoutAuParentduNoeud=0
205 from InterfaceQT4 import compobloc
206 from InterfaceQT4 import compomclist
207 while (isinstance(self.treeParent,compobloc.Node) or ( isinstance(self.treeParent,compomclist.Node) and self.treeParent.item.isMCList())) :
208 #while (isinstance(self.treeParent,compobloc.Node)) :
209 self.treeParent=self.treeParent.treeParent
210 ajoutAuParentduNoeud=1
211 if ajoutAuParentduNoeud :
212 treeParent.childrenComplete.append(self)
213 self.treeParent.childrenIssusDesBlocs.append(self)
214 while (isinstance(self.treeParent,compobloc.Node)) : self.treeParent=self.treeParent.treeParent
216 #if isinstance(self,compobloc.Node) :
217 if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
218 QTreeWidgetItem.__init__(self,None,mesColonnes)
220 QTreeWidgetItem.__init__(self,self.treeParent,mesColonnes)
221 self.treeParent.childrenComplete.append(self)
223 self.setToolTip(0,QString(self.item.get_fr()))
224 self.setToolTip(1,QString(self.item.get_fr()))
226 repIcon=QString(self.appliEficas.repIcon)
227 monIcone = QIcon(repIcon+"/" +self.item.GetIconName() + ".png")
228 self.setIcon(0,monIcone)
231 self.build_children()
235 self.item.connect("valid",self.onValid,())
236 self.item.connect("supp" ,self.onSupp,())
237 self.item.connect("add" ,self.onAdd,())
241 if self.item.getObject().isBLOC() :
242 self.setExpanded(True)
248 def build_children(self,posInsertion=10000):
249 """ Construit la liste des enfants de self """
250 """ Se charge de remettre les noeuds Expanded dans le meme etat """
251 #print "*********** build_children ",self.item, self.item.GetLabelText()
254 for item in self.childrenComplete :
256 #if item.isExpanded():
257 # if self.childrenComplete.index(item) < posInsertion :
258 # listeExpanded.append(self.childrenComplete.index(item))
259 # print dir(item.item )
261 # listeExpanded.append( self.childrenComplete.index(item) +1)
262 self.detruit_les_noeuds_issus_de_blocs(item)
263 parent=item.treeParent
264 parent.removeChild(item)
268 self.childrenComplete = []
269 sublist = self.item._GetSubList()
271 for item in sublist :
272 nouvelItem=item.itemNode(self,item)
273 self.children.append(nouvelItem)
274 #print " J ajoute ", nouvelItem ,nouvelItem.item.GetLabelText(),"dans" ,self.item.GetLabelText()
276 #if ind in listeExpanded : nouvelItem.setExpanded(1)
278 #if ind in listeExpanded : print "plie=0"
279 #else : print "plie=1"
280 #if ind in listeExpanded : nouvelItem.plie=0
281 #else : nouvelItem.plie=1
284 #print "*********** fin build_children ",self.item, self.item.GetLabelText()
286 def chercheNoeudCorrespondant(self,objSimp):
287 sublist = self.item._GetSubList()
288 for node in self.childrenComplete:
289 if node.item.object==objSimp : return node
292 def affichePanneau(self) :
293 #print "dans affichePanneau appel getPanel2", self.item.GetLabelText()
294 if self.item.isactif():
296 while not (hasattr (itemParent,'getPanel2')) :
297 itemParent=itemParent.treeParent
298 if itemParent!=self :
299 itemParent.affichePanneau()
301 self.fenetre=self.getPanel2()
303 from monInactifPanel import PanelInactif
304 self.fenetre = PanelInactif(self,self.editor)
306 self.editor.widgetCentraleLayout.addWidget(self.fenetre)
307 #print "widgetCentraleLayout = ", self.editor.widgetCentraleLayout
308 #print "nouvelle fenetre ", self.fenetre, " associee a ", self
310 self.editor.anciennefenetre=self.editor.fenetreCentraleAffichee
311 #print "ancienne fenetre ", self.editor.anciennefenetre
312 self.editor.fenetreCentraleAffichee=self.fenetre
313 self.tree.node_selected= self
315 if self.editor.anciennefenetre != None :
316 a=self.editor.anciennefenetre.close()
317 #print "je ferme ", self.editor.anciennefenetre
319 if self.editor.widgetTree !=None : index=1
322 if self.editor.first :
323 self.editor.splitter.setSizes((400,1400,400))
324 if not(isinstance(self.fenetre,MonChoixCommande)): self.editor.first=False
325 self.tree.inhibeExpand=True
326 self.tree.expandItem(self)
328 self.tree.inhibeExpand=False
329 #print "fin de affichePanneau"
330 #print "______________________________"
333 def createPopUpMenu(self):
334 #implemente dans les noeuds derives si necessaire
339 Cette methode a pour but de commentariser la commande pointee par self
341 # On traite par une exception le cas ou l'utilisateur final cherche a désactiver
342 # (commentariser) un commentaire.
344 pos=self.treeParent.children.index(self)
345 commande_comment = self.item.get_objet_commentarise()
346 # On signale a l editeur du panel (le JDCDisplay) une modification
347 self.editor.init_modif()
348 self.treeParent.build_children()
349 self.treeParent.children[pos].select()
350 self.treeParent.children[pos].affichePanneau()
352 traceback.print_exc()
353 QMessageBox.critical( self.editor, "TOO BAD",str(e))
355 def unCommentIt(self):
357 Realise la decommentarisation de self
360 pos=self.treeParent.children.index(self)
361 commande,nom = self.item.uncomment()
362 self.editor.init_modif()
363 self.treeParent.build_children()
364 self.treeParent.children[pos].select()
365 self.treeParent.children[pos].affichePanneau()
367 QMessageBox.critical( self.editor, "Erreur !",str(e))
369 def addComment( self, after=True ):
371 Ajoute un commentaire a l'interieur du JDC :
373 self.editor.init_modif()
378 return self.append_brother( COMMENT, pos )
380 def addParameters( self, after=True ):
382 Ajoute un parametre a l'interieur du JDC :
384 self.editor.init_modif()
385 if after: pos = 'after'
387 child=self.append_brother( PARAMETERS, pos )
393 Rend le noeud courant (self) selectionne et deselectionne
396 #print "je suis sur select"
397 for item in self.tree.selectedItems() :
399 self.setSelected( True )
400 #self.setExpanded( True )
401 self.tree.setCurrentItem( self )
402 self.tree.node_selected= self
404 #------------------------------------------------------------------
405 # Methodes de creation et destruction de noeuds
406 # Certaines de ces methodes peuvent etre appelees depuis l'externe
407 #------------------------------------------------------------------
408 def append_brother(self,name,pos='after',plier=False):
410 Permet d'ajouter un objet frere a l'objet associe au noeud self
411 par defaut on l'ajoute immediatement apres
414 self.editor.init_modif()
415 index = self.treeParent.children.index(self)
416 if pos == 'before': index = index
417 elif pos == 'after': index = index +1
419 print unicode(pos), tr(" n'est pas un index valide pour append_brother")
421 return self.treeParent.append_child(name,pos=index,plier=plier)
423 def append_child(self,name,pos=None,plier=False):
425 Methode pour ajouter un objet fils a l'objet associe au noeud self.
426 On peut l'ajouter en debut de liste (pos='first'), en fin (pos='last')
427 ou en position intermediaire.
428 Si pos vaut None, on le place a la position du catalogue.
430 #print "************** append_child ",self.item.GetLabelText(), plier
431 self.editor.init_modif()
435 index = len(self.children)
436 elif type(pos) == types.IntType :
439 elif type(pos) == types.InstanceType:
440 # pos est un item. Il faut inserer name apres pos
441 index = self.item.get_index(pos) +1
442 elif type(name) == types.InstanceType:
443 index = self.item.get_index_child(name.nom)
445 index = self.item.get_index_child(name)
446 self.tree.inhibeExpand=True
447 obj=self.item.additem(name,index) #CS_pbruno emet le signal 'add'
451 # old_obj = self.item.object.get_child(name.nom,restreint = 'oui')
453 # if plier : child.plieToutEtReaffiche()
454 # else : child.affichePanneau()
455 # print "dans le 1er Try"
458 # Souci pour gerer les copies des AFFE d'une commande à l autre
460 # child=self.children[index]
461 # if plier == True : child.setPlie()
462 # else : child.setDeplie()
463 # print "dans le 2nd Try"
465 # child=self.children[index]
466 # print "dans le except"
469 child=self.children[index]
470 if plier == True : child.setPlie()
471 else : child.setDeplie()
473 child=self.children[index]
474 #print "dans le except"
475 self.tree.inhibeExpand=False
479 self.editor.init_modif()
480 index = self.treeParent.children.index(self) - 1
481 if index < 0 : index =0
482 ret=self.treeParent.item.deplaceEntite(self.item.getObject())
486 Methode externe pour la destruction de l'objet associe au noeud
488 self.editor.init_modif()
489 index = self.vraiParent.children.index(self) - 1
490 if index < 0 : index =0
492 if self.item.nom == "VARIABLE" :
495 ret=self.vraiParent.item.suppitem(self.item)
496 self.treeParent.build_children()
497 if self.treeParent.childrenComplete : toselect=self.treeParent.childrenComplete[index]
498 else: toselect=self.treeParent
499 if recalcule : jdc.recalcule_etat_correlation()
500 from InterfaceQT4 import compojdc
501 # cas ou on detruit dans l arbre sans affichage
502 if isinstance(self.treeParent,compojdc.Node) :
503 toselect.affichePanneau()
505 if self.treeParent.fenetre== None : return
506 #print "J appelle reaffiche de browser apres delete"
507 self.treeParent.fenetre.reaffiche(toselect)
509 def deleteMultiple(self,liste=()):
511 Methode externe pour la destruction d une liste de noeud
513 from InterfaceQT4 import compojdc
514 self.editor.init_modif()
519 while not(isinstance(jdc,compojdc.Node)):
522 if not( isinstance(noeud.treeParent, compojdc.Node)): continue
523 if noeud.item.nom == "VARIABLE" : recalcule=1
524 if noeud.treeParent.children.index(noeud) < index : index=noeud.treeParent.children.index(noeud)
525 if index < 0 : index =0
527 # Cas ou on détruit dans une ETape
529 parentPosition=self.treeParent
530 while not(isinstance(parentPosition, compojdc.Node)):
531 index=parentPosition.treeParent.children.index(parentPosition)
532 parentPosition=parentPosition.treeParent
535 noeud.treeParent.item.suppitem(noeud.item)
538 if recalcule : jdc.recalcule_etat_correlation()
539 try : toselect=parentPosition.children[index]
540 except : toselect=jdc
542 toselect.affichePanneau()
544 # #------------------------------------------------------------------
547 #print "onValid pour ", self.item.nom
548 if hasattr(self,'fenetre') and self.fenetre:
549 self.fenetre.setValide()
550 if self.item.nom == "VARIABLE" and self.item.isvalid():
551 self.item.jdc.recalcule_etat_correlation()
552 if hasattr(self.item,'forceRecalcul'):
553 self.forceRecalculChildren(self.item.forceRecalcul)
554 self.editor.init_modif()
556 self.update_node_valid()
557 self.update_node_label()
558 self.update_node_texte()
560 def onAdd(self,object):
561 #print "onAdd pour ", self.item.nom
562 self.editor.init_modif()
564 #print "dans onAdd" ,self.item
565 # PN -- non necessaire si item=jdc
566 if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
568 def onSupp(self,object):
569 #print "onSupp pour ", self.item.nom
570 self.editor.init_modif()
572 # PN -- non necessaire si item=jdc
573 if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
575 def detruit_les_noeuds_issus_de_blocs(self,bloc):
576 from InterfaceQT4 import compobloc
577 if (isinstance(bloc,compobloc.Node)) :
578 for node in bloc.childrenComplete :
579 self.detruit_les_noeuds_issus_de_blocs(node)
580 parent=node.treeParent
581 #print "je detruit " , node.item.GetLabelText()
582 parent.removeChild(node)
584 def update_node_valid(self):
585 """Cette methode remet a jour la validite du noeud (icone)
588 repIcon=QString(self.appliEficas.repIcon)
589 monIcone = QIcon(repIcon+"/" +self.item.GetIconName() + ".png")
590 self.setIcon(0,monIcone)
593 def update_node_label(self):
594 """ Met a jour le label du noeud """
595 #print "NODE update_node_label", self.item.GetLabelText()
596 labeltext,fonte,couleur = self.item.GetLabelText()
598 #self.setText(0, labeltext)
601 def update_node_label_in_blue(self):
602 if hasattr(self.appliEficas,'noeudColore'):
603 self.appliEficas.noeudColore.setTextColor( 0,Qt.black)
604 self.appliEficas.noeudColore.update_node_label()
605 self.setTextColor( 0,Qt.blue )
606 labeltext,fonte,couleur = self.item.GetLabelText()
607 self.setText(0, labeltext)
608 self.appliEficas.noeudColore=self
610 def update_plusieurs_node_label_in_blue(self,liste):
611 if hasattr(self.appliEficas,'listeNoeudsColores'):
612 for noeud in self.appliEficas.listeNoeudsColores:
613 noeud.setTextColor( 0,Qt.black)
614 noeud.update_node_label()
615 self.appliEficas.listeNoeudsColores=[]
617 noeud.setTextColor( 0,Qt.blue )
618 labeltext,fonte,couleur = noeud.item.GetLabelText()
619 noeud.setText(0, labeltext)
620 self.appliEficas.listeNoeudsColores.append(noeud)
622 def update_node_texte_in_black(self):
623 """ Met a jour les noms des SD et valeurs des mots-cles """
624 self.setTextColor( 1,Qt.black )
625 value = self.item.GetText()
626 self.setText(1, value)
628 def update_node_texte(self):
629 """ Met a jour les noms des SD et valeurs des mots-cles """
630 value = self.item.GetText()
631 self.setText(1, value)
633 def update_node_texte_in_blue(self):
634 self.setTextColor( 1,Qt.blue )
635 value = self.item.GetText()
636 self.setText(1, value)
638 def update_nodes(self):
639 #print 'NODE update_nodes', self.item.GetLabelText()
640 self.build_children()
642 def update_valid(self) :
643 """Cette methode a pour but de mettre a jour la validite du noeud
644 et de propager la demande de mise a jour a son parent
646 #print "NODE update_valid", self.item.GetLabelText()
647 self.update_node_valid()
649 self.treeParent.update_valid()
653 def update_texte(self):
654 """ Met a jour les noms des SD et valeurs des mots-cles """
655 #print "NODE update_texte", self.item.GetLabelText()
656 self.update_node_texte()
657 if self.isExpanded() :
658 for child in self.children:
659 if child.isHidden() == false : child.update_texte()
662 def forceRecalculChildren(self,niveau):
663 if self.state=='recalcule' :
666 self.state='recalcule'
667 if hasattr(self.item,'object'):
668 self.item.object.state="modified"
669 for child in self.children:
670 if niveau > 0 : child.forceRecalculChildren(niveau - 1)
674 def doPaste(self,node_selected,pos='after'):
676 Déclenche la copie de l'objet item avec pour cible
677 l'objet passé en argument : node_selected
679 #print 'je passe dans doPaste'
680 objet_a_copier = self.item.get_copie_objet()
681 child=node_selected.doPasteCommande(objet_a_copier,pos)
684 def doPasteCommande(self,objet_a_copier,pos='after'):
686 Réalise la copie de l'objet passé en argument qui est nécessairement
691 child = self.append_brother(objet_a_copier,pos)
696 def doPastePremier(self,objet_a_copier):
698 Réalise la copie de l'objet passé en argument (objet_a_copier)
700 objet = objet_a_copier.item.get_copie_objet()
701 child = self.append_child(objet,pos='first')
705 def plieToutEtReaffiche(self):
706 #print "je suis dans plieToutEtReaffiche", self.item.get_nom()
707 self.editor.deplier = False
708 for item in self.children :
710 self.affichePanneau()
712 def deplieToutEtReaffiche(self):
713 self.editor.deplier = True
714 for item in self.children :
716 self.affichePanneau()
719 #print "je mets inhibeExpand a true dans setPlie"
720 #print "je suis dans plieTout", self.item.get_nom()
722 if self.fenetre == self.editor.fenetreCentraleAffichee and isinstance(self.treeParent,compojdc.Node):
724 self.tree.inhibeExpand=True
725 self.tree.collapseItem(self)
726 self.setPlieChildren()
727 self.tree.inhibeExpand=False
728 #print "je mets inhibeExpand a false dans setPlie"
731 # on ne plie pas au niveau 1
733 # for item in self.children :
734 # item.appartientAUnNoeudPlie=False
736 def setPlieChildren(self):
738 for c in self.children :
740 #print "dans setPlieChildren appartientAUnNoeudPlie=True ", c, c.item.GetLabelText()[0]
741 c.appartientAUnNoeudPlie=True
745 # Pour les blocs et les motcles list
746 # on affiche un niveau de plus
747 from InterfaceQT4 import compobloc
748 from InterfaceQT4 import compomclist
749 if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
750 niveauPere=self.treeParent
751 while (isinstance(niveauPere,compobloc.Node) or (isinstance(niveauPere,compomclist.Node) and niveauPere.item.isMCList())) :
752 niveauPere=niveauPere.treeParent
753 for c in self.children :
754 c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
757 # on affiche un niveau de plus
758 #if isinstance(self,compomclist.Node) :
759 #if isinstance(self,compobloc.Node) :
760 # niveauPere=self.treeParent
761 # while (isinstance(niveauPere,compobloc.Node)):
762 # niveauPere=niveauPere.treeParent
763 # for c in self.children :
764 # c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
767 #print "je mets inhibeExpand a true dans setDeplie"
768 self.tree.inhibeExpand=True
770 self.tree.expandItem(self)
771 self.setDeplieChildren()
772 self.tree.inhibeExpand=False
773 #print "je mets inhibeExpand a false dans setDePlie"
775 def setDeplieChildren(self):
776 #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", self.item.GetLabelText()
777 for c in self.children :
778 c.setDeplieChildren()
779 #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", c.item.GetLabelText()
780 c.appartientAUnNoeudPlie=False
784 def selectAvant(self):
785 i=self.item.jdc.etapes.index(self.item.object)
787 cherche=self.item.jdc.etapes[i-1]
789 cherche=self.item.jdc.etapes[-1]
791 for i in self.tree.racine.children :
792 if i.item.object== cherche :
795 if node : node.affichePanneau()
797 def selectApres(self):
798 i=self.item.jdc.etapes.index(self.item.object)
800 cherche=self.item.jdc.etapes[i+1]
802 cherche=self.item.jdc.etapes[0]
804 for i in self.tree.racine.children :
805 if i.item.object== cherche :
808 if node : node.affichePanneau()