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,'getPanel2')) :
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,'getPanel2')) :
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 ", item.item.nom, item, item.item
140 self.inhibeExpand == True
141 self.itemCourrant=item
143 #print self.itemCourrant
144 while not (hasattr (itemParent,'getPanel2')) :
145 if itemParent.plie==True : itemParent.setDeplie()
146 itemParent=itemParent.treeParent
147 #print itemParent.item.nom
148 #print itemParent.fenetre
149 #print self.editor.afficheCommandesPliees
150 if itemParent.fenetre != self.editor.fenetreCentraleAffichee :
151 if self.editor.afficheCommandesPliees : itemParent.plieToutEtReaffiche()
152 else : itemParent.affichePanneau()
153 if itemParent!=item and item.fenetre != None: item.fenetre.rendVisible()
156 fr = item.item.get_fr()
157 if self.editor: self.editor.labelCommentaire.setText(unicode(fr))
161 self.inhibeExpand == False
162 #print "je mets inhibeExpand a false handleOnItem"
165 def choisitPremier(self,name):
166 self.editor.layoutJDCCHOIX.removeWidget(self.racine.fenetre)
167 self.racine.fenetre.close()
168 new_node=self.racine.append_brother(name,'after')
171 COMMENT = "COMMENTAIRE"
172 PARAMETERS = "PARAMETRE"
174 class JDCNode(QTreeWidgetItem,GereRegles):
175 def __init__( self, treeParent, item):
176 #print "creation d'un noeud : ", item, " ",item.nom,"", treeParent, self
179 self.vraiParent = treeParent
180 self.treeParent = treeParent
181 self.tree = self.treeParent.tree
182 self.editor = self.treeParent.editor
183 self.appliEficas = treeParent.appliEficas
185 self.childrenComplete=[]
187 from InterfaceQT4 import compocomm
188 from InterfaceQT4 import compoparam
189 if (isinstance(self.item,compocomm.COMMTreeItem)) : name=tr("Commentaire")
190 elif (isinstance(self.item,compoparam.PARAMTreeItem)) : name=self.appliEficas.trUtf8(str(item.GetLabelText()[0]))
191 else: name = self.appliEficas.trUtf8(str(tr( item.nom))+" :")
192 value = self.appliEficas.trUtf8(str( item.GetText() ) )
195 mesColonnes=QStringList()
196 if self.editor.enteteQTree=='complet': mesColonnes << name << value
197 else : mesColonnes << name
199 if self.treeParent.plie==True :
201 self.appartientAUnNoeudPlie=True
204 self.appartientAUnNoeudPlie = False
206 from InterfaceQT4 import compobloc
207 from InterfaceQT4 import compomclist
209 ajoutAuParentduNoeud=0
210 self.treeParent=treeParent
211 while (isinstance(self.treeParent,compobloc.Node) or ( isinstance(self.treeParent,compomclist.Node) and self.treeParent.item.isMCList())) :
212 self.treeParent.childrenComplete.append(self)
213 self.treeParent=self.treeParent.vraiParent
214 self.treeParent.childrenComplete.append(self)
215 if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
216 QTreeWidgetItem.__init__(self,None,mesColonnes)
218 QTreeWidgetItem.__init__(self,self.treeParent,mesColonnes)
220 self.setToolTip(0,QString(self.item.get_fr()))
221 self.setToolTip(1,QString(self.item.get_fr()))
223 repIcon=QString(self.appliEficas.repIcon)
224 monIcone = QIcon(repIcon+"/" +self.item.GetIconName() + ".png")
225 self.setIcon(0,monIcone)
228 self.build_children()
232 self.item.connect("valid",self.onValid,())
233 self.item.connect("supp" ,self.onSupp,())
234 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
251 for enfant in self.childrenComplete :
252 #if enfant.isExpanded():
253 # if self.childrenComplete.index(item) < posInsertion :
254 # listeExpanded.append(self.childrenComplete.index(item))
255 # print dir(item.item )
257 # listeExpanded.append( self.childrenComplete.index(item) +1)
261 parent=enfant.treeParent
262 parent.removeChild(enfant)
268 self.childrenComplete = []
269 sublist = self.item._GetSubList()
271 for item in sublist :
272 nouvelItem=item.itemNode(self,item)
273 self.children.append(nouvelItem)
276 def chercheNoeudCorrespondant(self,objSimp):
277 sublist = self.item._GetSubList()
278 for node in self.childrenComplete:
279 if node.item.object==objSimp : return node
283 def affichePanneau(self) :
284 if self.item.isactif():
286 while not (hasattr (itemParent,'getPanel2')) :
287 itemParent=itemParent.treeParent
288 if itemParent!=self :
289 itemParent.affichePanneau()
291 self.fenetre=self.getPanel2()
293 from monInactifPanel import PanelInactif
294 self.fenetre = PanelInactif(self,self.editor)
296 self.editor.widgetCentraleLayout.addWidget(self.fenetre)
298 self.editor.anciennefenetre=self.editor.fenetreCentraleAffichee
299 self.editor.fenetreCentraleAffichee=self.fenetre
300 self.tree.node_selected= self
302 if self.editor.anciennefenetre != None :
303 a=self.editor.anciennefenetre.close()
305 if self.editor.widgetTree !=None : index=1
308 if self.editor.first :
309 self.editor.splitter.setSizes((400,1400,400))
310 if not(isinstance(self.fenetre,MonChoixCommande)): self.editor.first=False
311 self.tree.inhibeExpand=True
312 self.tree.expandItem(self)
314 self.tree.inhibeExpand=False
315 #print "fin de affichePanneau"
316 #print "______________________________"
319 def createPopUpMenu(self):
320 #implemente dans les noeuds derives si necessaire
325 Cette methode a pour but de commentariser la commande pointee par self
327 # On traite par une exception le cas ou l'utilisateur final cherche a désactiver
328 # (commentariser) un commentaire.
330 pos=self.treeParent.children.index(self)
331 commande_comment = self.item.get_objet_commentarise()
332 # On signale a l editeur du panel (le JDCDisplay) une modification
333 self.editor.init_modif()
334 self.treeParent.build_children()
335 self.treeParent.children[pos].select()
336 self.treeParent.children[pos].affichePanneau()
338 traceback.print_exc()
339 QMessageBox.critical( self.editor, "TOO BAD",str(e))
341 def unCommentIt(self):
343 Realise la decommentarisation de self
346 pos=self.treeParent.children.index(self)
347 commande,nom = self.item.uncomment()
348 self.editor.init_modif()
349 self.treeParent.build_children()
350 self.treeParent.children[pos].select()
351 self.treeParent.children[pos].affichePanneau()
353 QMessageBox.critical( self.editor, "Erreur !",str(e))
355 def addComment( self, after=True ):
357 Ajoute un commentaire a l'interieur du JDC :
359 self.editor.init_modif()
364 return self.append_brother( COMMENT, pos )
366 def addParameters( self, after=True ):
368 Ajoute un parametre a l'interieur du JDC :
370 self.editor.init_modif()
371 if after: pos = 'after'
373 child=self.append_brother( PARAMETERS, pos )
379 Rend le noeud courant (self) selectionne et deselectionne
382 for item in self.tree.selectedItems() :
384 self.setSelected( True )
385 #self.setExpanded( True )
386 self.tree.setCurrentItem( self )
387 self.tree.node_selected= self
389 #------------------------------------------------------------------
390 # Methodes de creation et destruction de noeuds
391 # Certaines de ces methodes peuvent etre appelees depuis l'externe
392 #------------------------------------------------------------------
393 def append_brother(self,name,pos='after',plier=False):
395 Permet d'ajouter un objet frere a l'objet associe au noeud self
396 par defaut on l'ajoute immediatement apres
399 self.editor.init_modif()
401 from InterfaceQT4 import compojdc
402 if (isinstance(self.treeParent, compojdc.Node)) and not self.verifiePosition(name,pos) : return 0
404 index = self.treeParent.children.index(self)
405 if pos == 'before': index = index
406 elif pos == 'after': index = index +1
408 print unicode(pos), tr(" n'est pas un index valide pour append_brother")
410 return self.treeParent.append_child(name,pos=index,plier=plier)
412 def verifiePosition(self,name,pos,aLaRacine=False):
413 if name not in self.editor.Classement_Commandes_Ds_Arbre : return True
414 indexName=self.editor.Classement_Commandes_Ds_Arbre.index(name)
416 etapes=self.item.get_jdc().etapes
417 if etapes == [] : return True
419 if aLaRacine == False :indexOu=etapes.index(self.item.object)
422 if pos=="after" : indexOu = indexOu+1
423 for e in etapes[:indexOu] :
425 if nom not in self.editor.Classement_Commandes_Ds_Arbre : continue
426 indexEtape=self.editor.Classement_Commandes_Ds_Arbre.index(nom)
427 if indexEtape > indexName :
428 comment=tr('le mot clef ')+name+tr(' doit etre insere avant ')+nom
429 QMessageBox.information( None,tr('insertion impossible'),comment, )
431 for e in etapes[indexOu:] :
433 if nom not in self.editor.Classement_Commandes_Ds_Arbre : continue
434 indexEtape=self.editor.Classement_Commandes_Ds_Arbre.index(nom)
435 if indexEtape < indexName :
436 comment=tr('le mot clef ')+name+tr(' doit etre insere apres ')+nom
437 QMessageBox.information( None,tr('insertion impossible'),comment, )
441 def append_child(self,name,pos=None,plier=False):
443 Methode pour ajouter un objet fils a l'objet associe au noeud self.
444 On peut l'ajouter en debut de liste (pos='first'), en fin (pos='last')
445 ou en position intermediaire.
446 Si pos vaut None, on le place a la position du catalogue.
448 #print "************** append_child ",self.item.GetLabelText(), plier
451 self.editor.init_modif()
455 index = len(self.children)
456 elif type(pos) == types.IntType :
459 elif type(pos) == types.InstanceType:
460 # pos est un item. Il faut inserer name apres pos
461 index = self.item.get_index(pos) +1
462 elif type(name) == types.InstanceType:
463 index = self.item.get_index_child(name.nom)
465 index = self.item.get_index_child(name)
467 # si on essaye d inserer a la racine
468 if (isinstance(self.treeParent,JDCTree) and index==0) :
469 verifiePosition=self.verifiePosition(name,'first',aLaRacine=True)
470 if not verifiePosition : return 0
472 self.tree.inhibeExpand=True
473 obj=self.item.additem(name,index) #CS_pbruno emet le signal 'add'
477 # old_obj = self.item.object.get_child(name.nom,restreint = 'oui')
479 # if plier : child.plieToutEtReaffiche()
480 # else : child.affichePanneau()
481 # print "dans le 1er Try"
484 # Souci pour gerer les copies des AFFE d'une commande à l autre
486 # child=self.children[index]
487 # if plier == True : child.setPlie()
488 # else : child.setDeplie()
489 # print "dans le 2nd Try"
491 # child=self.children[index]
492 # print "dans le except"
495 child=self.children[index]
496 if plier == True : child.setPlie()
497 else : child.setDeplie()
499 child=self.children[index]
500 #print "dans le except"
501 self.tree.inhibeExpand=False
505 self.editor.init_modif()
506 index = self.treeParent.children.index(self) - 1
507 if index < 0 : index =0
508 ret=self.treeParent.item.deplaceEntite(self.item.getObject())
512 Methode externe pour la destruction de l'objet associe au noeud
514 self.editor.init_modif()
515 index = self.vraiParent.children.index(self) - 1
516 if index < 0 : index =0
518 if self.item.nom == "VARIABLE" :
521 ret=self.vraiParent.item.suppitem(self.item)
522 self.treeParent.build_children()
523 if self.treeParent.childrenComplete : toselect=self.treeParent.childrenComplete[index]
524 else: toselect=self.treeParent
525 if recalcule : jdc.recalcule_etat_correlation()
526 from InterfaceQT4 import compojdc
527 # cas ou on detruit dans l arbre sans affichage
528 if isinstance(self.treeParent,compojdc.Node) :
529 toselect.affichePanneau()
531 if self.treeParent.fenetre== None : return
532 #print "J appelle reaffiche de browser apres delete"
533 self.treeParent.fenetre.reaffiche(toselect)
535 def deleteMultiple(self,liste=()):
537 Methode externe pour la destruction d une liste de noeud
539 from InterfaceQT4 import compojdc
540 self.editor.init_modif()
545 while not(isinstance(jdc,compojdc.Node)):
548 if not( isinstance(noeud.treeParent, compojdc.Node)): continue
549 if noeud.item.nom == "VARIABLE" : recalcule=1
550 if noeud.treeParent.children.index(noeud) < index : index=noeud.treeParent.children.index(noeud)
551 if index < 0 : index =0
553 # Cas ou on détruit dans une ETape
555 parentPosition=self.treeParent
556 while not(isinstance(parentPosition, compojdc.Node)):
557 index=parentPosition.treeParent.children.index(parentPosition)
558 parentPosition=parentPosition.treeParent
561 noeud.treeParent.item.suppitem(noeud.item)
564 if recalcule : jdc.recalcule_etat_correlation()
565 try : toselect=parentPosition.children[index]
566 except : toselect=jdc
568 toselect.affichePanneau()
570 # #------------------------------------------------------------------
573 #print "onValid pour ", self.item.nom
574 if hasattr(self,'fenetre') and self.fenetre: self.fenetre.setValide()
575 if (self.item.nom == "VARIABLE" or self.item.nom == "DISTRIBUTION") and self.item.isvalid():
576 self.item.jdc.recalcule_etat_correlation()
577 if hasattr(self.item,'forceRecalcul'):
578 self.forceRecalculChildren(self.item.forceRecalcul)
579 self.editor.init_modif()
581 self.update_node_valid()
582 self.update_node_label()
583 self.update_node_texte()
585 def onAdd(self,object):
586 if self.JESUISOFF==1 : return
587 self.editor.init_modif()
590 # PN -- non necessaire si item=jdc
591 if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
593 def onSupp(self,object):
594 if self.JESUISOFF==1 : return
595 self.editor.init_modif()
597 # PN -- non necessaire si item=jdc
598 if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
603 def update_node_valid(self):
604 """Cette methode remet a jour la validite du noeud (icone)
607 repIcon=QString(self.appliEficas.repIcon)
608 monIcone = QIcon(repIcon+"/" +self.item.GetIconName() + ".png")
609 self.setIcon(0,monIcone)
612 def update_node_label(self):
613 """ Met a jour le label du noeud """
614 #print "NODE update_node_label", self.item.GetLabelText()
615 labeltext,fonte,couleur = self.item.GetLabelText()
617 #self.setText(0, labeltext)
620 def update_node_label_in_blue(self):
621 if hasattr(self.appliEficas,'noeudColore'):
622 self.appliEficas.noeudColore.setTextColor( 0,Qt.black)
623 self.appliEficas.noeudColore.update_node_label()
624 self.setTextColor( 0,Qt.blue )
625 labeltext,fonte,couleur = self.item.GetLabelText()
626 self.setText(0, labeltext)
627 self.appliEficas.noeudColore=self
629 def update_plusieurs_node_label_in_blue(self,liste):
630 if hasattr(self.appliEficas,'listeNoeudsColores'):
631 for noeud in self.appliEficas.listeNoeudsColores:
632 noeud.setTextColor( 0,Qt.black)
633 noeud.update_node_label()
634 self.appliEficas.listeNoeudsColores=[]
636 noeud.setTextColor( 0,Qt.blue )
637 labeltext,fonte,couleur = noeud.item.GetLabelText()
638 noeud.setText(0, labeltext)
639 self.appliEficas.listeNoeudsColores.append(noeud)
641 def update_node_texte_in_black(self):
642 """ Met a jour les noms des SD et valeurs des mots-cles """
643 self.setTextColor( 1,Qt.black )
644 value = self.item.GetText()
645 self.setText(1, value)
647 def update_node_texte(self):
648 """ Met a jour les noms des SD et valeurs des mots-cles """
649 value = self.item.GetText()
650 self.setText(1, value)
653 def update_node_texte_in_blue(self):
654 self.setTextColor( 1,Qt.blue )
655 value = self.item.GetText()
656 self.setText(1, value)
658 def update_nodes(self):
659 #print 'NODE update_nodes', self.item.GetLabelText()
660 self.build_children()
662 def update_valid(self) :
663 """Cette methode a pour but de mettre a jour la validite du noeud
664 et de propager la demande de mise a jour a son parent
666 #print "NODE update_valid", self.item.GetLabelText()
667 self.update_node_valid()
669 self.treeParent.update_valid()
673 def update_texte(self):
674 """ Met a jour les noms des SD et valeurs des mots-cles """
675 #print "NODE update_texte", self.item.GetLabelText()
676 self.update_node_texte()
677 if self.isExpanded() :
678 for child in self.children:
679 if child.isHidden() == false : child.update_texte()
682 def forceRecalculChildren(self,niveau):
683 if self.state=='recalcule' :
686 self.state='recalcule'
687 if hasattr(self.item,'object'):
688 self.item.object.state="modified"
689 for child in self.children:
690 if niveau > 0 : child.forceRecalculChildren(niveau - 1)
694 def doPaste(self,node_selected,pos='after'):
696 Déclenche la copie de l'objet item avec pour cible
697 l'objet passé en argument : node_selected
699 #print 'je passe dans doPaste'
700 objet_a_copier = self.item.get_copie_objet()
701 child=node_selected.doPasteCommande(objet_a_copier,pos)
704 def doPasteCommande(self,objet_a_copier,pos='after'):
706 Réalise la copie de l'objet passé en argument qui est nécessairement
711 child = self.append_brother(objet_a_copier,pos)
716 def doPastePremier(self,objet_a_copier):
718 Réalise la copie de l'objet passé en argument (objet_a_copier)
720 objet = objet_a_copier.item.get_copie_objet()
721 child = self.append_child(objet,pos='first')
725 def plieToutEtReaffiche(self):
726 #print "je suis dans plieToutEtReaffiche", self.item.get_nom()
727 self.editor.deplier = False
728 for item in self.children :
729 # il ne faut pas plier les blocs
730 from InterfaceQT4 import compobloc
731 if (isinstance(item,compobloc.Node)) : continue
733 self.affichePanneau()
735 def deplieToutEtReaffiche(self):
736 self.editor.deplier = True
737 for item in self.children :
739 self.affichePanneau()
742 #print "je mets inhibeExpand a true dans setPlie"
743 #print "je suis dans plieTout", self.item.get_nom()
745 if self.fenetre == self.editor.fenetreCentraleAffichee and isinstance(self.treeParent,compojdc.Node):
747 self.tree.inhibeExpand=True
748 self.tree.collapseItem(self)
749 self.setPlieChildren()
750 self.tree.inhibeExpand=False
751 #print "je mets inhibeExpand a false dans setPlie"
754 # on ne plie pas au niveau 1
756 # for item in self.children :
757 # item.appartientAUnNoeudPlie=False
759 def setPlieChildren(self):
761 for c in self.children :
763 #print "dans setPlieChildren appartientAUnNoeudPlie=True ", c, c.item.GetLabelText()[0]
764 c.appartientAUnNoeudPlie=True
768 # Pour les blocs et les motcles list
769 # on affiche un niveau de plus
770 from InterfaceQT4 import compobloc
771 from InterfaceQT4 import compomclist
772 if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
773 niveauPere=self.treeParent
774 while (isinstance(niveauPere,compobloc.Node) or (isinstance(niveauPere,compomclist.Node) and niveauPere.item.isMCList())) :
775 niveauPere=niveauPere.treeParent
776 for c in self.children :
777 c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
780 # on affiche un niveau de plus
781 #if isinstance(self,compomclist.Node) :
782 #if isinstance(self,compobloc.Node) :
783 # niveauPere=self.treeParent
784 # while (isinstance(niveauPere,compobloc.Node)):
785 # niveauPere=niveauPere.treeParent
786 # for c in self.children :
787 # c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
790 #print "je mets inhibeExpand a true dans setDeplie"
791 self.tree.inhibeExpand=True
793 self.tree.expandItem(self)
794 self.setDeplieChildren()
795 self.tree.inhibeExpand=False
796 #print "je mets inhibeExpand a false dans setDePlie"
798 def setDeplieChildren(self):
799 #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", self.item.GetLabelText()
800 for c in self.children :
801 c.setDeplieChildren()
802 #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", c.item.GetLabelText()
803 c.appartientAUnNoeudPlie=False
807 def selectAvant(self):
808 i=self.item.jdc.etapes.index(self.item.object)
810 cherche=self.item.jdc.etapes[i-1]
812 cherche=self.item.jdc.etapes[-1]
814 for i in self.tree.racine.children :
815 if i.item.object== cherche :
818 if node : node.affichePanneau()
820 def selectApres(self):
821 i=self.item.jdc.etapes.index(self.item.object)
823 cherche=self.item.jdc.etapes[i+1]
825 cherche=self.item.jdc.etapes[0]
827 for i in self.tree.racine.children :
828 if i.item.object== cherche :
831 if node : node.affichePanneau()