-
-if __name__=='__main__':
- from PyQt4 import *
- from PyQt4.QtGui import *
- from PyQt4.QtCore import *
-
-
-# sys.path[:0]=['..','../Aster','../Aster/Cata' ]
-
-# app = QApplication(sys.argv)
-
-# fn = 'azAster.comm'
-# jdcName = os.path.basename(fn)
-# f=open(fn,'r')
-# text=f.read()
-# f.close()
-# print 'text',text
- print "afaire"
-
-#
-# from autre_analyse_cata import analyse_catalogue
-# from Cata import cataSTA8
-# cata=cataSTA8
-# fic_cata="../../Aster/Cata/cataSTA8/cata.py"
-# cata_ordonne ,list_simp_reel = analyse_catalogue(cata)
-#
-#
-#
-# j=cata.JdC( procedure=text, cata=cata, nom=jdcName,
-# cata_ord_dico=cata_ordonne )
-#
-# j.compile()
-# if not j.cr.estvide():
-# print j.cr
-# sys.exit()
-#
-# j.exec_compile()
-# if not j.cr.estvide():
-# print j.cr
-# sys.exit()
-#
-# from Editeur import comploader
-# comploader.charger_composants(QT)
-# from Editeur import Objecttreeitem
-# jdc_item=Objecttreeitem.make_objecttreeitem( app, "nom", j)
-#
-# if jdc_item:
-# tree = JDCTree( jdc_item, None )
-#
-# app.setMainWidget(tree)
-# app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
-# tree.show()
-#
-# res = app.exec_loop()
-# sys.exit(res)
-#
-#
+ def plieToutEtReafficheSaufItem(self, itemADeplier):
+ #print "je suis dans plieToutEtReaffiche", self.item.get_nom()
+ from InterfaceQT4 import compojdc
+ if (isinstance(self, compojdc.Node)) : self.affichePanneau(); return
+ 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 :
+ itemADeplier.setDeplie()
+ self.affichePanneau()
+
+ 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.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()
+
+ def deplieToutEtReaffiche(self):
+ self.editor.deplier = True
+ for item in self.children :
+ item.setDeplie()
+ self.affichePanneau()
+
+ def setPlie(self):
+ #print "je mets inhibeExpand a true dans setPlie"
+ #print "je suis dans plieTout", self.item.get_nom()
+ import compojdc
+ if self.fenetre == self.editor.fenetreCentraleAffichee and isinstance(self.treeParent,compojdc.Node):
+ return
+ self.tree.inhibeExpand=True
+ self.tree.collapseItem(self)
+ self.setPlieChildren()
+ self.tree.inhibeExpand=False
+ #print "je mets inhibeExpand a false dans setPlie"
+
+
+ # on ne plie pas au niveau 1
+ # self.plie=False
+ # for item in self.children :
+ # item.appartientAUnNoeudPlie=False
+
+ def setPlieChildren(self):
+ #print "dans setPlieChildren pour", self.item.nom
+ self.plie=True
+ for c in self.children :
+ c.setPlieChildren()
+ #print "dans setPlieChildren appartientAUnNoeudPlie=True ", c, c.item.GetLabelText()[0]
+ c.appartientAUnNoeudPlie=True
+ c.plie=True
+ #print "dans setPlieChildren plie", c.item.nom
+ c.setExpanded(False)
+
+ # Pour les blocs et les motcles list
+ # on affiche un niveau de plus
+ from InterfaceQT4 import compobloc
+ from InterfaceQT4 import compomclist
+ if (isinstance(self,compobloc.Node) or ( isinstance(self,compomclist.Node) and self.item.isMCList())) :
+ niveauPere=self.treeParent
+ while (isinstance(niveauPere,compobloc.Node) or (isinstance(niveauPere,compomclist.Node) and niveauPere.item.isMCList())) :
+ 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
+ #if isinstance(self,compomclist.Node) :
+ #if isinstance(self,compobloc.Node) :
+ # niveauPere=self.treeParent
+ # while (isinstance(niveauPere,compobloc.Node)):
+ # niveauPere=niveauPere.treeParent
+ # for c in self.children :
+ # c.appartientAUnNoeudPlie=niveauPere.appartientAUnNoeudPlie
+
+ def setDeplie(self):
+ #print "dans setPlieChildren pour", self.item.nom
+ #print "je mets inhibeExpand a true dans setDeplie"
+ self.tree.inhibeExpand=True
+ self.plie=False
+ self.tree.expandItem(self)
+ self.setDeplieChildren()
+ self.tree.inhibeExpand=False
+ #print "je mets inhibeExpand a false dans setDePlie"
+
+ def setDeplieChildren(self):
+ #print "dans setDeplieChildren appartientAUnNoeudPlie=False ", self.item.GetLabelText()
+ for c in self.children :
+ c.setDeplieChildren()
+ #print "dans setDeplieChildren ", c.item.nom
+ c.appartientAUnNoeudPlie=False
+ c.setExpanded(True)
+ c.plie=False
+
+ def selectAvant(self):
+ i=self.item.jdc.etapes.index(self.item.object)
+ try :
+ cherche=self.item.jdc.etapes[i-1]
+ except :
+ cherche=self.item.jdc.etapes[-1]
+ node=None
+ for i in self.tree.racine.children :
+ if i.item.object== cherche :
+ node=i
+ break
+ if node :
+ node.affichePanneau()
+ node.select()
+
+ def selectApres(self):
+ i=self.item.jdc.etapes.index(self.item.object)
+ try :
+ cherche=self.item.jdc.etapes[i+1]
+ except :
+ cherche=self.item.jdc.etapes[0]
+ node=None
+ for i in self.tree.racine.children :
+ if i.item.object== cherche :
+ node=i
+ break
+ if node :
+ node.affichePanneau()
+ node.select()