X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=InterfaceQT4%2Fbrowser.py;h=9bed683f816ce3b36298fac1a60f91992fe23145;hb=7b4162f8842f6ac0f099e392660843bc9896847d;hp=ca143810d90023049ebb5ed30b2ba0005e2d172e;hpb=42895950e564e837c445896b5bac263370bdf37b;p=tools%2Feficas.git diff --git a/InterfaceQT4/browser.py b/InterfaceQT4/browser.py index ca143810..9bed683f 100644 --- a/InterfaceQT4/browser.py +++ b/InterfaceQT4/browser.py @@ -28,6 +28,7 @@ from determine import monEnvQT5 if monEnvQT5 : from PyQt5.QtWidgets import QTreeWidget , QTreeWidgetItem from PyQt5.QtGui import QIcon + from PyQt5.QtCore import Qt else : from PyQt4.QtGui import * from PyQt4.QtCore import * @@ -114,7 +115,7 @@ class JDCTree( QTreeWidget,GereRegles ): def handleCollapsedItem(self,item): - print "dans CollapsedItem", self.inhibeExpand + #print "dans CollapsedItem", self.inhibeExpand if self.inhibeExpand == True : return # On traite le cas de l item non selectionne itemParent=item @@ -131,23 +132,27 @@ class JDCTree( QTreeWidget,GereRegles ): def handleExpandedItem(self,item): #print "handleExpandedItem pour ", item.item.nom, self.inhibeExpand + #import traceback + #traceback.print_stack() if self.inhibeExpand == True : return + self.inhibeExpand = True itemParent=item while not (hasattr (itemParent,'getPanel')) : if itemParent.plie==True : itemParent.setDeplie() itemParent=itemParent.treeParent if self.tree.node_selected != itemParent : item.setExpanded(True) + self.inhibeExpand = False return item.deplieToutEtReaffiche() - self.inhibeExpand == False + self.inhibeExpand = False def handleOnItem(self,item,int): - print "je passe dans handleOnItem pour ",self, item.item.nom, item, item.item + #print "je passe dans handleOnItem pour ",self, item.item.nom, item, item.item from InterfaceQT4 import composimp - self.inhibeExpand == True + self.inhibeExpand = True self.itemCourrant=item itemParent=item @@ -159,26 +164,27 @@ class JDCTree( QTreeWidget,GereRegles ): estUneFeuille=(isinstance(item,composimp.Node)) # il faut afficher le parent - print "estUneFeuille", estUneFeuille - print "afficheCommandesPliees", self.editor.afficheCommandesPliees + #print "estUneFeuille", estUneFeuille + #print "afficheCommandesPliees", self.editor.afficheCommandesPliees if estUneFeuille : itemParent.affichePanneau() elif self.editor.afficheCommandesPliees : itemParent.plieToutEtReafficheSaufItem(item) else : itemParent.affichePanneau() - if (isinstance(item,composimp.Node)) and item.fenetre : item.fenetre.rendVisible() + elif (isinstance(item,composimp.Node)) and item.fenetre : item.fenetre.rendVisible() elif itemParent!=item: - #self.tree.handleExpandedItem(item) + self.tree.handleExpandedItem(item) #item.fenetre.donnePremier() #item.fenetre.rendActif() - print 'il faut afficher le 1er' + #print 'il faut afficher le 1er' + try : fr = item.item.get_fr() if self.editor: self.editor.affiche_commentaire(unicode(fr)) except: pass item.select() - self.inhibeExpand == False + self.inhibeExpand = False #print "je mets inhibeExpand a false handleOnItem" @@ -225,10 +231,13 @@ class JDCNode(QTreeWidgetItem,GereRegles): if self.treeParent.plie==True : self.plie = True self.appartientAUnNoeudPlie=True + if self.treeParent.item.isMCList() : self.appartientAUnNoeudPlie = self.treeParent.appartientAUnNoeudPlie else : self.plie = False self.appartientAUnNoeudPlie = False + #if item.nom == "POUTRE" :print "creation d'un noeud : ", item, " ",item.nom,"", self.treeParent, self.appartientAUnNoeudPlie , self.plie + if ancien and itemExpand : self.plie = False if ancien and not itemExpand : self.plie = True if (isinstance(self.item,composimp.SIMPTreeItem)) : self.plie=False @@ -242,7 +251,10 @@ class JDCNode(QTreeWidgetItem,GereRegles): self.treeParent.childrenComplete.append(self) self.treeParent=self.treeParent.vraiParent self.treeParent.childrenComplete.append(self) - if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) : + + + if (isinstance(self,compobloc.Node) or (isinstance(self,compomclist.Node) and self.item.isMCList()) or ( hasattr(self.item.parent,'inhibeValidator') and isinstance(self,compomclist.Node) and self.item.parent.inhibeValidator)) : + # Le dernier or ne sert que lorsqu'on est en train de creer une liste par les validator QTreeWidgetItem.__init__(self,None,mesColonnes) else : QTreeWidgetItem.__init__(self,self.treeParent,mesColonnes) @@ -291,7 +303,6 @@ class JDCNode(QTreeWidgetItem,GereRegles): else : self.listeItemExpanded.append(enfant.item) for enfant in self.childrenComplete : - p=enfant.vraiParent parent=enfant.treeParent parent.removeChild(enfant) enfant.JESUISOFF=1 @@ -310,7 +321,7 @@ class JDCNode(QTreeWidgetItem,GereRegles): nouvelItem=item.itemNode(self,item,itemExpand,ancien) self.children.append(nouvelItem) - #print "fin *********** build_children ",self,self.item, self.item.nom + #print "fin *********** build_children ",self,self.item, self.item.nom, self.children def chercheNoeudCorrespondant(self,objSimp): @@ -321,7 +332,6 @@ class JDCNode(QTreeWidgetItem,GereRegles): def affichePanneau(self) : - #print " affichePanneau " , self.item.nom #if self.item.isactif(): #if self.editor.code == 'ASTER' and not(self.item.isactif()) : # posera des pb si un code decide d appeler FIN un mot clef @@ -338,15 +348,19 @@ class JDCNode(QTreeWidgetItem,GereRegles): return self.fenetre=self.getPanel() + #print "hhhhhhhhhh", self.editor.splitter.sizes() 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 + #print "iiiiiiiiiiiiiii", self.editor.splitter.sizes() 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.setParent(None) self.editor.fenetreCentraleAffichee.close() + self.editor.fenetreCentraleAffichee.deleteLater() self.editor.widgetCentraleLayout.addWidget(self.fenetre) #print "j ajoute ", self.fenetre, self.fenetre.node.item.nom @@ -354,7 +368,7 @@ class JDCNode(QTreeWidgetItem,GereRegles): self.tree.node_selected= self if self.editor.first : - self.editor.splitter.setSizes((400,1400,400)) + #self.editor.splitter.setSizes((400,1400,400)) if not(isinstance(self.fenetre,MonChoixCommande)): self.editor.first=False self.tree.inhibeExpand=True self.tree.expandItem(self) @@ -427,7 +441,7 @@ class JDCNode(QTreeWidgetItem,GereRegles): Rend le noeud courant (self) selectionne et deselectionne tous les autres """ - print "select pour", self.item.nom + #print "select pour", self.item.nom for item in self.tree.selectedItems() : item.setSelected(0) self.tree.setCurrentItem( self ) @@ -516,7 +530,7 @@ class JDCNode(QTreeWidgetItem,GereRegles): if not verifiePosition : return 0 self.tree.inhibeExpand=True - obj=self.item.additem(name,index) #CS_pbruno emet le signal 'add' + obj=self.item.additem(name,index) # emet le signal 'add' if obj is None:obj=0 if obj == 0:return 0 try : @@ -609,7 +623,14 @@ class JDCNode(QTreeWidgetItem,GereRegles): def onValid(self): #print "onValid pour ", self.item.nom - if hasattr(self,'fenetre') and self.fenetre: self.fenetre.setValide() + if self.JESUISOFF==1 : return + if hasattr(self,'fenetre') and self.fenetre: + try : + self.fenetre.setValide() + except : + # print "onValid pour ", self.item.nom, self,'pb' + pass + if (self.item.nom == "VARIABLE" or self.item.nom == "DISTRIBUTION") and self.item.isvalid(): self.item.jdc.recalcule_etat_correlation() if hasattr(self.item,'forceRecalcul'): @@ -638,7 +659,6 @@ class JDCNode(QTreeWidgetItem,GereRegles): - def update_node_valid(self): """Cette methode remet a jour la validite du noeud (icone) Elle appelle isvalid @@ -763,8 +783,12 @@ class JDCNode(QTreeWidgetItem,GereRegles): def plieToutEtReafficheSaufItem(self, itemADeplier): #print "je suis dans plieToutEtReaffiche", self.item.get_nom() + self.inhibeExpand=True from InterfaceQT4 import compojdc - if (isinstance(self, compojdc.Node)) : self.affichePanneau(); return + if (isinstance(self, compojdc.Node)) : + self.affichePanneau() + self.inhibeExpand=False + return self.editor.deplier = False for item in self.children : # il ne faut pas plier les blocs @@ -774,11 +798,13 @@ class JDCNode(QTreeWidgetItem,GereRegles): if item==itemADeplier : itemADeplier.setDeplie() self.affichePanneau() + self.inhibeExpand=False def plieToutEtReaffiche(self): #print "je suis dans plieToutEtReaffiche", self.item.get_nom() from InterfaceQT4 import compojdc if (isinstance(self, compojdc.Node)) : self.affichePanneau(); return + self.inhibeExpand=True self.editor.deplier = False for item in self.children : # il ne faut pas plier les blocs @@ -786,6 +812,7 @@ class JDCNode(QTreeWidgetItem,GereRegles): if (isinstance(item,compobloc.Node)) : continue item.setPlie() self.affichePanneau() + self.inhibeExpand=True def deplieToutEtReaffiche(self): self.editor.deplier = True @@ -832,6 +859,7 @@ class JDCNode(QTreeWidgetItem,GereRegles): niveauPere=niveauPere.treeParent for c in self.children : c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie + #print "dans setPlieChildren appartientAUnNoeudPlie=True ", c, c.item.GetLabelText()[0], "mis a la valeur ", niveauPere.appartientAUnNoeudPlie c.setExpanded(False) # on affiche un niveau de plus