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()
389 return self.append_brother( PARAMETERS, pos )
394 Rend le noeud courant (self) selectionne et deselectionne
397 print "je suis sur select"
398 for item in self.tree.selectedItems() :
400 self.setSelected( True )
401 #self.setExpanded( True )
402 self.tree.setCurrentItem( self )
403 self.tree.node_selected= self
405 #------------------------------------------------------------------
406 # Methodes de creation et destruction de noeuds
407 # Certaines de ces methodes peuvent etre appelees depuis l'externe
408 #------------------------------------------------------------------
409 def append_brother(self,name,pos='after',plier=False):
411 Permet d'ajouter un objet frere a l'objet associe au noeud self
412 par defaut on l'ajoute immediatement apres
415 self.editor.init_modif()
416 index = self.treeParent.children.index(self)
417 if pos == 'before': index = index
418 elif pos == 'after': index = index +1
420 print unicode(pos), tr(" n'est pas un index valide pour append_brother")
422 return self.treeParent.append_child(name,pos=index,plier=plier)
424 def append_child(self,name,pos=None,plier=False):
426 Methode pour ajouter un objet fils a l'objet associe au noeud self.
427 On peut l'ajouter en debut de liste (pos='first'), en fin (pos='last')
428 ou en position intermediaire.
429 Si pos vaut None, on le place a la position du catalogue.
431 #print "************** append_child ",self.item.GetLabelText(), plier
432 self.editor.init_modif()
436 index = len(self.children)
437 elif type(pos) == types.IntType :
440 elif type(pos) == types.InstanceType:
441 # pos est un item. Il faut inserer name apres pos
442 index = self.item.get_index(pos) +1
443 elif type(name) == types.InstanceType:
444 index = self.item.get_index_child(name.nom)
446 index = self.item.get_index_child(name)
447 self.tree.inhibeExpand=True
448 obj=self.item.additem(name,index) #CS_pbruno emet le signal 'add'
452 # old_obj = self.item.object.get_child(name.nom,restreint = 'oui')
454 # if plier : child.plieToutEtReaffiche()
455 # else : child.affichePanneau()
456 # print "dans le 1er Try"
459 # Souci pour gerer les copies des AFFE d'une commande à l autre
461 # child=self.children[index]
462 # if plier == True : child.setPlie()
463 # else : child.setDeplie()
464 # print "dans le 2nd Try"
466 # child=self.children[index]
467 # print "dans le except"
470 child=self.children[index]
471 if plier == True : child.setPlie()
472 else : child.setDeplie()
474 child=self.children[index]
475 print "dans le except"
476 self.tree.inhibeExpand=False
480 self.editor.init_modif()
481 index = self.treeParent.children.index(self) - 1
482 if index < 0 : index =0
483 ret=self.treeParent.item.deplaceEntite(self.item.getObject())
487 Methode externe pour la destruction de l'objet associe au noeud
489 self.editor.init_modif()
490 index = self.vraiParent.children.index(self) - 1
491 if index < 0 : index =0
493 if self.item.nom == "VARIABLE" :
496 ret=self.vraiParent.item.suppitem(self.item)
497 self.treeParent.build_children()
498 if self.treeParent.childrenComplete : toselect=self.treeParent.childrenComplete[index]
499 else: toselect=self.treeParent
500 if recalcule : jdc.recalcule_etat_correlation()
501 from InterfaceQT4 import compojdc
502 # cas ou on detruit dans l arbre sans affichage
503 if isinstance(self.treeParent,compojdc.Node) :
504 toselect.affichePanneau()
506 if self.treeParent.fenetre== None : return
507 #print "J appelle reaffiche de browser apres delete"
508 self.treeParent.fenetre.reaffiche(toselect)
510 def deleteMultiple(self,liste=()):
512 Methode externe pour la destruction d une liste de noeud
514 from InterfaceQT4 import compojdc
515 self.editor.init_modif()
520 while not(isinstance(jdc,compojdc.Node)):
523 if not( isinstance(noeud.treeParent, compojdc.Node)): continue
524 if noeud.item.nom == "VARIABLE" : recalcule=1
525 if noeud.treeParent.children.index(noeud) < index : index=noeud.treeParent.children.index(noeud)
526 if index < 0 : index =0
528 # Cas ou on détruit dans une ETape
530 parentPosition=self.treeParent
531 while not(isinstance(parentPosition, compojdc.Node)):
532 index=parentPosition.treeParent.children.index(parentPosition)
533 parentPosition=parentPosition.treeParent
536 noeud.treeParent.item.suppitem(noeud.item)
539 if recalcule : jdc.recalcule_etat_correlation()
540 try : toselect=parentPosition.children[index]
541 except : toselect=jdc
543 toselect.affichePanneau()
545 # #------------------------------------------------------------------
548 #print "onValid pour ", self.item.nom
549 if hasattr(self,'fenetre') and self.fenetre:
550 self.fenetre.setValide()
551 if self.item.nom == "VARIABLE" and self.item.isvalid():
552 self.item.jdc.recalcule_etat_correlation()
553 if hasattr(self.item,'forceRecalcul'):
554 self.forceRecalculChildren(self.item.forceRecalcul)
555 self.editor.init_modif()
557 self.update_node_valid()
558 self.update_node_label()
559 self.update_node_texte()
561 def onAdd(self,object):
562 #print "onAdd pour ", self.item.nom
563 self.editor.init_modif()
565 #print "dans onAdd" ,self.item
566 # PN -- non necessaire si item=jdc
567 if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
569 def onSupp(self,object):
570 #print "onSupp pour ", self.item.nom
571 self.editor.init_modif()
573 # PN -- non necessaire si item=jdc
574 if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
576 def detruit_les_noeuds_issus_de_blocs(self,bloc):
577 from InterfaceQT4 import compobloc
578 if (isinstance(bloc,compobloc.Node)) :
579 for node in bloc.childrenComplete :
580 self.detruit_les_noeuds_issus_de_blocs(node)
581 parent=node.treeParent
582 #print "je detruit " , node.item.GetLabelText()
583 parent.removeChild(node)
585 def update_node_valid(self):
586 """Cette methode remet a jour la validite du noeud (icone)
589 repIcon=QString(self.appliEficas.repIcon)
590 monIcone = QIcon(repIcon+"/" +self.item.GetIconName() + ".png")
591 self.setIcon(0,monIcone)
594 def update_node_label(self):
595 """ Met a jour le label du noeud """
596 #print "NODE update_node_label", self.item.GetLabelText()
597 labeltext,fonte,couleur = self.item.GetLabelText()
599 #self.setText(0, labeltext)
602 def update_node_label_in_blue(self):
603 if hasattr(self.appliEficas,'noeudColore'):
604 self.appliEficas.noeudColore.setTextColor( 0,Qt.black)
605 self.appliEficas.noeudColore.update_node_label()
606 self.setTextColor( 0,Qt.blue )
607 labeltext,fonte,couleur = self.item.GetLabelText()
608 self.setText(0, labeltext)
609 self.appliEficas.noeudColore=self
611 def update_plusieurs_node_label_in_blue(self,liste):
612 if hasattr(self.appliEficas,'listeNoeudsColores'):
613 for noeud in self.appliEficas.listeNoeudsColores:
614 noeud.setTextColor( 0,Qt.black)
615 noeud.update_node_label()
616 self.appliEficas.listeNoeudsColores=[]
618 noeud.setTextColor( 0,Qt.blue )
619 labeltext,fonte,couleur = noeud.item.GetLabelText()
620 noeud.setText(0, labeltext)
621 self.appliEficas.listeNoeudsColores.append(noeud)
623 def update_node_texte_in_black(self):
624 """ Met a jour les noms des SD et valeurs des mots-cles """
625 self.setTextColor( 1,Qt.black )
626 value = self.item.GetText()
627 self.setText(1, value)
629 def update_node_texte(self):
630 """ Met a jour les noms des SD et valeurs des mots-cles """
631 value = self.item.GetText()
632 self.setText(1, value)
634 def update_node_texte_in_blue(self):
635 self.setTextColor( 1,Qt.blue )
636 value = self.item.GetText()
637 self.setText(1, value)
639 def update_nodes(self):
640 #print 'NODE update_nodes', self.item.GetLabelText()
641 self.build_children()
643 def update_valid(self) :
644 """Cette methode a pour but de mettre a jour la validite du noeud
645 et de propager la demande de mise a jour a son parent
647 #print "NODE update_valid", self.item.GetLabelText()
648 self.update_node_valid()
650 self.treeParent.update_valid()
654 def update_texte(self):
655 """ Met a jour les noms des SD et valeurs des mots-cles """
656 #print "NODE update_texte", self.item.GetLabelText()
657 self.update_node_texte()
658 if self.isExpanded() :
659 for child in self.children:
660 if child.isHidden() == false : child.update_texte()
663 def forceRecalculChildren(self,niveau):
664 if self.state=='recalcule' :
667 self.state='recalcule'
668 if hasattr(self.item,'object'):
669 self.item.object.state="modified"
670 for child in self.children:
671 if niveau > 0 : child.forceRecalculChildren(niveau - 1)
675 def doPaste(self,node_selected,pos='after'):
677 Déclenche la copie de l'objet item avec pour cible
678 l'objet passé en argument : node_selected
680 #print 'je passe dans doPaste'
681 objet_a_copier = self.item.get_copie_objet()
682 child=node_selected.doPasteCommande(objet_a_copier,pos)
685 def doPasteCommande(self,objet_a_copier,pos='after'):
687 Réalise la copie de l'objet passé en argument qui est nécessairement
692 child = self.append_brother(objet_a_copier,pos)
697 def doPastePremier(self,objet_a_copier):
699 Réalise la copie de l'objet passé en argument (objet_a_copier)
701 objet = objet_a_copier.item.get_copie_objet()
702 child = self.append_child(objet,pos='first')
706 def plieToutEtReaffiche(self):
707 #print "je suis dans plieToutEtReaffiche", self.item.get_nom()
708 self.editor.deplier = False
709 for item in self.children :
711 self.affichePanneau()
713 def deplieToutEtReaffiche(self):
714 self.editor.deplier = True
715 for item in self.children :
717 self.affichePanneau()
720 #print "je mets inhibeExpand a true dans setPlie"
721 #print "je suis dans plieTout", self.item.get_nom()
722 self.tree.inhibeExpand=True
723 self.tree.collapseItem(self)
724 self.setPlieChildren()
727 # on ne plie pas au niveau 1
728 #if not(isinstance(self.treeParent,compojdc.Node)) :
732 # for item in self.children :
733 # item.appartientAUnNoeudPlie=False
734 #self.tree.inhibeExpand=False
735 #print "je mets inhibeExpand a false dans setPlie"
737 def setPlieChildren(self):
739 for c in self.children :
741 #print "dans setPlieChildren appartientAUnNoeudPlie=True ", c, c.item.GetLabelText()[0]
742 c.appartientAUnNoeudPlie=True
746 # Pour les blocs et les motcles list
747 # on affiche un niveau de plus
748 from InterfaceQT4 import compobloc
749 from InterfaceQT4 import compomclist
750 if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
751 niveauPere=self.treeParent
752 while (isinstance(niveauPere,compobloc.Node) or (isinstance(niveauPere,compomclist.Node) and niveauPere.item.isMCList())) :
753 niveauPere=niveauPere.treeParent
754 for c in self.children :
755 c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
758 # on affiche un niveau de plus
759 #if isinstance(self,compomclist.Node) :
760 #if isinstance(self,compobloc.Node) :
761 # niveauPere=self.treeParent
762 # while (isinstance(niveauPere,compobloc.Node)):
763 # niveauPere=niveauPere.treeParent
764 # for c in self.children :
765 # c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
768 #print "je mets inhibeExpand a true dans setDeplie"
769 self.tree.inhibeExpand=True
771 self.tree.expandItem(self)
772 self.setDeplieChildren()
773 self.tree.inhibeExpand=False
774 #print "je mets inhibeExpand a false dans setDePlie"
776 def setDeplieChildren(self):
777 #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", self.item.GetLabelText()
778 for c in self.children :
779 c.setDeplieChildren()
780 #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", c.item.GetLabelText()
781 c.appartientAUnNoeudPlie=False
785 def selectAvant(self):
786 i=self.item.jdc.etapes.index(self.item.object)
788 cherche=self.item.jdc.etapes[i-1]
790 cherche=self.item.jdc.etapes[-1]
792 for i in self.tree.racine.children :
793 if i.item.object== cherche :
796 if node : node.affichePanneau()
798 def selectApres(self):
799 i=self.item.jdc.etapes.index(self.item.object)
801 cherche=self.item.jdc.etapes[i+1]
803 cherche=self.item.jdc.etapes[0]
805 for i in self.tree.racine.children :
806 if i.item.object== cherche :
809 if node : node.affichePanneau()