itemParent=item
item.setPlie()
item.plieToutEtReaffiche()
+ item.select()
def handleExpandedItem(self,item):
- #print "dans ExpandItem", self.inhibeExpand
+ #print "handleExpandedItem pour ", item.item.nom, self.inhibeExpand
if self.inhibeExpand == True : return
- #print "apres if"
itemParent=item
while not (hasattr (itemParent,'getPanel')) :
if itemParent.plie==True : itemParent.setDeplie()
itemParent=itemParent.treeParent
- #print "apres if"
if self.tree.node_selected != itemParent :
item.setExpanded(True)
- #print "je suis la"
return
item.deplieToutEtReaffiche()
def handleOnItem(self,item,int):
- #if (len(self.selectedIndexes())!=2): return
- #print "je passe dans handleOnItem pour ", item.item.nom, item, item.item
+ #print "je passe dans handleOnItem pour ",self, item.item.nom, item, item.item
self.inhibeExpand == True
self.itemCourrant=item
itemParent=item
- #print self.itemCourrant
while not (hasattr (itemParent,'getPanel')) :
if itemParent.plie==True : itemParent.setDeplie()
itemParent=itemParent.treeParent
- #print itemParent.item.nom
- #print itemParent.fenetre
- #print self.editor.afficheCommandesPliees
if itemParent.fenetre != self.editor.fenetreCentraleAffichee :
- if self.editor.afficheCommandesPliees : itemParent.plieToutEtReaffiche()
+ # il faut afficher le parent
+ if self.editor.afficheCommandesPliees : itemParent.plieToutEtReafficheSaufItem(item)
else : itemParent.affichePanneau()
- if itemParent!=item and item.fenetre != None: item.fenetre.rendVisible()
- #try :
- if 1:
+
+
+ from InterfaceQT4 import composimp
+ if (isinstance(item,composimp.Node)) : item.fenetre.rendVisible()
+ elif itemParent!=item:
+ #self.tree.handleExpandedItem(item)
+ #item.fenetre.donnePremier()
+ print 'il faut afficher le 1er'
+ try :
fr = item.item.get_fr()
if self.editor: self.editor.labelCommentaire.setText(unicode(fr))
- #except:
- else :
+ except:
pass
+ item.select()
self.inhibeExpand == False
#print "je mets inhibeExpand a false handleOnItem"
from InterfaceQT4 import compocomm
from InterfaceQT4 import compoparam
+ from InterfaceQT4 import composimp
if (isinstance(self.item,compocomm.COMMTreeItem)) : name=tr("Commentaire")
elif (isinstance(self.item,compoparam.PARAMTreeItem)) : name=self.appliEficas.trUtf8(str(item.GetLabelText()[0]))
else: name = self.appliEficas.trUtf8(str(tr( item.nom))+" :")
else :
self.plie = False
self.appartientAUnNoeudPlie = False
+
if ancien and itemExpand : self.plie = False
if ancien and not itemExpand : self.plie = True
-
+ if (isinstance(self.item,composimp.SIMPTreeItem)) : self.plie=False
from InterfaceQT4 import compobloc
from InterfaceQT4 import compomclist
self.listeItemExpanded=[]
self.listeItemPlie=[]
+
for enfant in self.childrenComplete :
- if enfant.isExpanded() : self.listeItemExpanded.append(enfant.item)
- if not(enfant.isExpanded()) : self.listeItemPlie.append(enfant.item)
+ if enfant.plie : self.listeItemPlie.append(enfant.item)
+ else : self.listeItemExpanded.append(enfant.item)
for enfant in self.childrenComplete :
p=enfant.vraiParent
from monInactifPanel import PanelInactif
self.fenetre = PanelInactif(self,self.editor)
- self.editor.widgetCentraleLayout.addWidget(self.fenetre)
+ for indiceWidget in range(self.editor.widgetCentraleLayout.count()):
+ widget=self.editor.widgetCentraleLayout.itemAt(indiceWidget)
+ self.editor.widgetCentraleLayout.removeItem(widget)
+ # ceinture et bretelle
+ #print 'old fenetre = ',self.editor.fenetreCentraleAffichee
+ if self.editor.fenetreCentraleAffichee != None :
+ #print "j enleve ", self.editor.fenetreCentraleAffichee, self.editor.fenetreCentraleAffichee.node.item.nom
+ self.editor.widgetCentraleLayout.removeWidget(self.editor.fenetreCentraleAffichee)
+ self.editor.fenetreCentraleAffichee.close()
- self.editor.anciennefenetre=self.editor.fenetreCentraleAffichee
+ self.editor.widgetCentraleLayout.addWidget(self.fenetre)
+ #print "j ajoute ", self.fenetre, self.fenetre.node.item.nom
self.editor.fenetreCentraleAffichee=self.fenetre
self.tree.node_selected= self
- if self.editor.anciennefenetre != None :
- a=self.editor.anciennefenetre.close()
-
- if self.editor.widgetTree !=None : index=1
- else : index=0
-
if self.editor.first :
self.editor.splitter.setSizes((400,1400,400))
if not(isinstance(self.fenetre,MonChoixCommande)): self.editor.first=False
self.tree.expandItem(self)
self.select()
self.tree.inhibeExpand=False
- #print "fin de affichePanneau"
+ #print "fin de affichePanneau", self.item.nom
#print "______________________________"
for item in self.tree.selectedItems() :
item.setSelected(0)
self.setSelected( True )
- #self.setExpanded( True )
self.tree.setCurrentItem( self )
- self.tree.node_selected= self
#------------------------------------------------------------------
# Methodes de creation et destruction de noeuds
def onAdd(self,object):
if self.JESUISOFF==1 : return
+ #print "onAdd pour ", self.item.nom, object.nom
self.editor.init_modif()
self.update_nodes()
-
# PN -- non necessaire si item=jdc
if hasattr(self.item,'jdc'): self.item.jdc.aReafficher=True
def onSupp(self,object):
if self.JESUISOFF==1 : return
+ #print "onSup pour ", self.item.nom, object.nom
self.editor.init_modif()
self.update_nodes()
# PN -- non necessaire si item=jdc
child = self.append_child(objet,pos='first')
return child
+ def plieToutEtReafficheSaufItem(self, itemADeplier):
+ #print "je suis dans plieToutEtReaffiche", self.item.get_nom()
+ self.editor.deplier = False
+ for item in self.children :
+ # il ne faut pas plier les blocs
+ from InterfaceQT4 import compobloc
+ if (isinstance(item,compobloc.Node)) : continue
+ item.setPlie()
+ if item==itemADeplier :
+ print itemADeplier.item.nom
+ itemADeplier.setDeplie()
+
+ self.affichePanneau()
def plieToutEtReaffiche(self):
#print "je suis dans plieToutEtReaffiche", self.item.get_nom()