def handleOnItem(self,item,int):
#if (len(self.selectedIndexes())!=2): return
- #print "je passe dans handleOnItem"
+ #print "je passe dans handleOnItem pour ", self.item.nom
self.inhibeExpand == True
self.itemCourrant=item
itemParent=item
while not (hasattr (itemParent,'getPanel2')) :
if itemParent.plie==True : itemParent.setDeplie()
itemParent=itemParent.treeParent
- #print itemParent
+ #print itemParent.item.nom
#print itemParent.fenetre
#print self.editor.afficheCommandesPliees
if itemParent.fenetre != self.editor.fenetreCentraleAffichee :
- #print self.editor.afficheCommandesPliees
if self.editor.afficheCommandesPliees : itemParent.plieToutEtReaffiche()
else : itemParent.affichePanneau()
if itemParent!=item and item.fenetre != None: item.fenetre.rendVisible()
class JDCNode(QTreeWidgetItem):
def __init__( self, treeParent, item):
#print "creation d'un noeud : ", item, " ",item.nom,"", treeParent, self
+ #print "creation d'un noeud : ", item.nom
self.a=0
self.item = item
self.vraiParent = treeParent
elif (isinstance(self.item,compoparam.PARAMTreeItem)) : name=self.appliEficas.trUtf8(str(item.GetLabelText()[0]))
else: name = self.appliEficas.trUtf8(str(tr( item.nom))+" :")
value = self.appliEficas.trUtf8(str( item.GetText() ) )
+
mesColonnes=QStringList()
if self.editor.enteteQTree=='complet': mesColonnes << name << value
else :
self.plie = False
self.appartientAUnNoeudPlie = False
- #print "self.plie", self.plie
- #print "self.appartientAUnNoeudPlie", self.appartientAUnNoeudPlie
#print self.treeParent
ajoutAuParentduNoeud=0
return None
def affichePanneau(self) :
- print "dans affichePanneau appel getPanel2", self.item.GetLabelText()
+ #print "dans affichePanneau appel getPanel2", self.item.GetLabelText()
if self.item.isactif():
itemParent=self
- print self
- print self.getPanel2
+ #print self
+ #print self.getPanel2
while not (hasattr (itemParent,'getPanel2')) :
itemParent=itemParent.treeParent
if itemParent!=self :
itemParent.affichePanneau()
return
- print self.getPanel2
+ #print self.getPanel2
self.fenetre=self.getPanel2()
else:
from monInactifPanel import PanelInactif
"""
self.editor.init_modif()
- verifiePosition=self.verifiePosition(name,pos)
- if not verifiePosition : return 0
+ from InterfaceQT4 import compojdc
+ if (isinstance(self.treeParent, compojdc.Node)) and not self.verifiePosition(name,pos) : return 0
index = self.treeParent.children.index(self)
if pos == 'before': index = index
return 0
return self.treeParent.append_child(name,pos=index,plier=plier)
- def verifiePosition(self,name,pos):
- from InterfaceQT4 import compojdc
- if not (isinstance(self.treeParent, compojdc.Node)) : return True
+ def verifiePosition(self,name,pos,aLaRacine=False):
if name not in self.editor.Classement_Commandes_Ds_Arbre : return True
indexName=self.editor.Classement_Commandes_Ds_Arbre.index(name)
- etapes=self.item.jdc.etapes
+ etapes=self.item.get_jdc().etapes
if etapes == [] : return True
- indexOu=etapes.index(self.item.object)
+ if aLaRacine == False :indexOu=etapes.index(self.item.object)
+ else : indexOu=0
+
if pos=="after" : indexOu = indexOu+1
- print self.editor.Classement_Commandes_Ds_Arbre
- print indexOu
- print indexName
- print name
- print etapes
for e in etapes[:indexOu] :
nom=e.nom
if nom not in self.editor.Classement_Commandes_Ds_Arbre : continue
Si pos vaut None, on le place a la position du catalogue.
"""
#print "************** append_child ",self.item.GetLabelText(), plier
+
+
self.editor.init_modif()
if pos == 'first':
index = 0
index = self.item.get_index_child(name.nom)
else:
index = self.item.get_index_child(name)
+
+ # si on essaye d inserer a la racine
+ if (isinstance(self.treeParent,JDCTree) and index==0) :
+ verifiePosition=self.verifiePosition(name,'first',aLaRacine=True)
+ if not verifiePosition : return 0
+
self.tree.inhibeExpand=True
obj=self.item.additem(name,index) #CS_pbruno emet le signal 'add'
if obj is None:obj=0
def onValid(self):
#print "onValid pour ", self.item.nom
- if hasattr(self,'fenetre') and self.fenetre:
- self.fenetre.setValide()
- if self.item.nom == "VARIABLE" and self.item.isvalid():
+ if hasattr(self,'fenetre') and self.fenetre: self.fenetre.setValide()
+ 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'):
self.forceRecalculChildren(self.item.forceRecalcul)
def plieToutEtReaffiche(self):
- print "je suis dans plieToutEtReaffiche", self.item.get_nom()
+ #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()
self.affichePanneau()