Une MACRO_ETAPE peut ajouter plusieurs concepts dans le contexte
Une fonction enregistree dans op_init peut egalement modifier le contexte
"""
- print ("update_context",self,self.nom,d.keys())
+ #print ("update_context",self,self.nom,d.keys())
if hasattr(self,"jdc_aux") and self.jdc_aux:
#ATTENTION: update_context NE DOIT PAS appeler reset_context
# car il appelle directement ou indirectement update_context
# posera des pb si un code decide d appeler FIN un mot clef
# on resoudera a ce moment la
# pour l instant pas de poussiere sous le tapis
- #print( 'debut affichePanneau pour', self.item.nom)
if not(self.item.isactif()) :
from .monWidgetInactif import MonWidgetInactif
self.fenetre = MonWidgetInactif(self,self.editor)
if obj is None:obj=0
if obj == 0:return 0
try :
+ #if 1 :
child=self.children[index]
if plier == True : child.setPlie()
else : child.setDeplie()
except :
child=self.children[index]
+ try :
+ if len(obj) > 1 : self.build_children()
+ except : pass
self.tree.inhibeExpand=False
#print (" fin append child")
return child
# item.appartientAUnNoeudPlie=False
def setPlieChildren(self):
- #print "dans setPlieChildren pour", self.item.nom
+ #print ("dans setPlieChildren pour", self.item.nom)
self.plie=True
for c in self.children :
c.setPlieChildren()
class Node(browser.JDCNode,typeNode.PopUpMenuNodePartiel):
- def getPanelGroupe(self,parentQt,commande):
+ def getPanelGroupe(self,parentQt,commande,insertIn=-1):
+ import traceback
maDefinition=self.item.get_definition()
monObjet=self.item.object
monNom=self.item.nom
#elif hasattr(self,'plie') and self.plie==True :
if hasattr(self,'plie') and self.plie==True :
from .monWidgetFactPlie import MonWidgetFactPlie
- widget=MonWidgetFactPlie(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande)
+ widget=MonWidgetFactPlie(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande,insertIn)
else:
from .monWidgetFact import MonWidgetFact
- widget=MonWidgetFact(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande)
+ widget=MonWidgetFact(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande,insertIn)
return widget
def createPopUpMenu(self):
typeNode.PopUpMenuNodeMinimal.createPopUpMenu(self)
- def getPanelGroupe(self,parentQt,commande):
+ def getPanelGroupe(self,parentQt,commande,insertIn=-1):
maDefinition=self.item.get_definition()
monObjet=self.item.object
monNom=self.item.nom
if not (monObjet.isMCList()) :
if hasattr(self,'plie') and self.plie==True :
from .monWidgetFactPlie import MonWidgetFactPlie
- widget=MonWidgetFactPlie(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande)
+ widget=MonWidgetFactPlie(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande,insertIn)
else:
from .monWidgetFact import MonWidgetFact
- widget=MonWidgetFact(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande)
+ widget=MonWidgetFact(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande,insertIn)
else :
from .monWidgetBloc import MonWidgetBloc
widget=MonWidgetBloc(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande)
from InterfaceQT4.qtEficas import Appli
app = QApplication(sys.argv)
- Eficas=Appli(code=code,ssCode=ssCode,multi=multi,langue=langue)
+ Eficas=Appli(code=code,salome=0,ssCode=ssCode,multi=multi,langue=langue)
Eficas.show()
res=app.exec_()
from .gereIcones import FacultatifOuOptionnel
import Accas
+import traceback
# Import des panels
def ajouteMCOptionnelDesBlocs(self):
- #print ("Je passe dans ajouteMCOptionnelDesBlocs pour", self.node.item.nom)
self.dictMCVenantDesBlocs={}
i=0
self.calculOptionnel()
liste=self.liste_mc
for MC in self.liste_mc : self.dictMCVenantDesBlocs[MC]=self
- while i < self.commandesLayout.count():
+ # ce cas est le cas machine tournant sr le plie
+ try :
+ while i < self.commandesLayout.count():
from .monWidgetBloc import MonWidgetBloc
widget=self.commandesLayout.itemAt(i).widget()
i=i+1
if MC in self.dictMCVenantDesBlocs: print ("Pb Sur les MC" )
else : self.dictMCVenantDesBlocs[MC]=widget.dictMCVenantDesBlocs[MC]
liste=liste+listeW
+ except :
+ pass
return liste
def Plie(self):
self.node.setPlie()
+ if self.editor.code== 'MT' and (self.maCommande.obj.nom == "ZONE") :
+ #if (len(self.node.item.get_genealogie())==2):
+ index=self.maCommande.commandesLayout.indexOf(self)
+ self.maCommande.reafficheSeulement(self,index)
+ return
+ #else :
+ # self.reaffiche(self.node)
+ #return
+ #print ('je reaffiche dans Plie')
self.reaffiche(self.node)
def Deplie(self):
self.node.setDeplie()
+ if self.editor.code== 'MT' and (self.maCommande.obj.nom == "ZONE") :
+ #if (len(self.node.item.get_genealogie())==2):
+ index=self.parentQt.commandesLayout.indexOf(self)
+ self.maCommande.reafficheSeulement(self,index)
+ return
+ #else :
+ # self.reaffiche(self.node)
+ #return
+ #print ('je reaffiche dans Plie')
self.reaffiche(self.node)
+
+
+ #def Plie(self):
+ #print ('Deplie', self)
+ #print (self.obj.nom)
+ #print (self.node.setPlie)
+ #print (self.parentQt)
+ #print (self)
+ # self.node.setPlie()
+ #if self.editor.code== 'MT' and (self.maCommande.obj.nom == "ZONE") :
+ # itemAtraiter = self.node.item
+ # nodeAtraiter=self.node
+ #while (len(itemAtraiter.get_genealogie()) > 2 ):
+ # itemAtraiter=itemAtraiter.parent
+ # nodeAtraiter=nodeAtraiter.vraiParent
+ #ancien=nodeAtraiter.fenetre
+ #panneau = nodeAtraiter.getPanelGroupe(self,self.maCommande,insertIn=False)
+ #print (itemAtraiter,nodeAtraiter)
+ #self.parentQt.commandesLayout.replaceWidget(ancien,panneau,Qt.FindDirectChildrenOnly)
+ #nodeAtraiter.vraiParent.fenetre.commandesLayout.replaceWidget(ancien,panneau,Qt.FindDirectChildrenOnly)
+ #return
+ # if self.editor.code== 'MT' and (self.maCommande.obj.nom == "ZONE") :
+ # if (len(self.node.item.get_genealogie())==2):
+ #print (self)
+ #print (self.obj.nom)
+ #print (self.node.item.getlabeltext())
+ #print (self.parentQt)
+ #print (self.editor.fenetreCentraleAffichee)
+ #print (self.maCommande)
+ # index=self.parentQt.commandesLayout.indexOf(self)
+ #print (index)
+ # self.maCommande.reafficheSeulement(self,index)
+ #self.disconnect()
+ #for c in self.children():
+ # print (c)
+ # try :
+ # c.setParent(None)
+ # c.deleteLater()
+ # c.close()
+ # c.disconnect()
+ # except :
+ # print('poum')
+ #panneau = self.node.getPanelGroupe(self.parentQt,self.maCommande,insertIn=False)
+ # print (self.parentQt)
+ # print (self)
+ #self.parentQt.commandesLayout.replaceWidget(self,panneau,Qt.FindDirectChildrenOnly)
+ # self.parentQt.setUpdatesEnabled(True)
+ # print (dir(self.parentQt.commandesLayout))
+ #self.parentQt.commandesLayout.updateGeometry()
+ # else :
+ # self.reaffiche(self.node)
+ # return
+ #print ('je reaffiche dans Plie')
+ # self.reaffiche(self.node)
+#
+# def Deplie(self):
+# print ('Deplie', self)
+# print (self.obj.nom)
+# print (self.node.item.GetLabelText())
+# self.node.setDeplie()
+# #if self.editor.code== 'MT' and (self.maCommande.obj.nom == "ZONE") and (len(self.node.item.get_genealogie())==2):
+# #print (self.node.vraiParent.children)
+# #if self.editor.code== 'MT' and (self.maCommande.obj.nom == "ZONE") :
+# # itemAtraiter = self.node.item
+# # nodeAtraiter=self.node
+# # while (len(itemAtraiter.get_genealogie()) > 2 ):
+# # itemAtraiter=itemAtraiter.parent
+# # nodeAtraiter=nodeAtraiter.vraiParent
+# # ancien=nodeAtraiter.fenetre
+# # panneau = nodeAtraiter.getPanelGroupe(self,self.maCommande,insertIn=False)
+# #print (itemAtraiter,nodeAtraiter)
+# #self.parentQt.commandesLayout.replaceWidget(ancien,panneau,Qt.FindDirectChildrenOnly)
+# # nodeAtraiter.vraiParent.fenetre.commandesLayout.replaceWidget(ancien,panneau,Qt.FindDirectChildrenOnly)
+# # return
+# if self.editor.code== 'MT' and (self.maCommande.obj.nom == "ZONE") :
+# if (len(self.node.item.get_genealogie())==2):
+# #panneau = self.node.getPanelGroupe(self.parentQt,self.maCommande,insertIn=False)
+# #self.parentQt.commandesLayout.replaceWidget(self,panneau,Qt.FindDirectChildrenOnly)
+# #index=self.parentQt.commandesLayout.indexOf(self)
+# #index=self.maCommande.commandesLayout.indexOf(self)
+# #print ('index = ', index)
+# index=0
+# self.maCommande.reafficheSeulement(self,index)
+# else :
+# self.reaffiche(self.node)
+# return
+#
+# #print ('je reaffiche')
+# self.reaffiche(self.node)
def traiteClicSurLabel(self,texte):
if self.editor.code != "CARMELCND" : self.afficheOptionnel()
from PyQt5.QtWidgets import QApplication, QWidget, QSpacerItem, QSizePolicy
from PyQt5.QtGui import QFont, QIcon
from PyQt5.QtCore import QTimer
+from PyQt5.QtCore import Qt
+
from Extensions.i18n import tr
else : self.recentre()
self.inhibeExpand=False
+ def reafficheSeulement(self,nodeAReafficher,index):
+ #print ('ds reafficheSeulement', nodeAReafficher)
+ parentNodeAReafficher=nodeAReafficher.parentQt
+ index=parentNodeAReafficher.commandesLayout.indexOf(nodeAReafficher)
+ oldFenetre=nodeAReafficher.node.fenetre
+ newWidget=nodeAReafficher.node.getPanelGroupe(parentNodeAReafficher,self,index)
+ nodeAReafficher.node.fenetre=newWidget
+ oldFenetre.setParent(None)
+ oldFenetre.close()
+ oldFenetre.deleteLater()
+ #print ("fin pour " , self.node.item.nom)
+
def recentre(self):
QApplication.processEvents()
class MonWidgetFactCommun(Groupe):
"""
"""
- def __init__(self,node,editor,parentQt,definition, obj, niveau,commande):
+ def __init__(self,node,editor,parentQt,definition, obj, niveau,commande,insertIn=-1):
#print "fact : ",node.item.nom
Groupe.__init__(self,node,editor,parentQt, definition,obj,niveau,commande)
labeltext,fonte,couleur = self.node.item.GetLabelText()
self.GroupBox.setText(tr(labeltext))
self.GroupBox.setTextInteractionFlags(Qt.TextSelectableByMouse)
- self.parentQt.commandesLayout.insertWidget(-1,self)
+ self.parentQt.commandesLayout.insertWidget(insertIn,self)
+ #else : self.parentQt.commandesLayout.insertWidget(0,self)
self.doitAfficherOptionnel=False
def enterEvent(self,event):
if self.doitAfficherOptionnel and self.editor.code != "CARMELCND" :self.afficheOptionnel()
class MonWidgetFact(Ui_WidgetFact,MonWidgetFactCommun):
- def __init__(self,node,editor,parentQt,definition, obj, niveau,commande):
- MonWidgetFactCommun.__init__(self,node,editor,parentQt, definition,obj,niveau,commande)
+ def __init__(self,node,editor,parentQt,definition, obj, niveau,commande,insertIn=True):
+ MonWidgetFactCommun.__init__(self,node,editor,parentQt, definition,obj,niveau,commande,insertIn)
#class MonWidgetFactHorizontal(Ui_WidgetFactHorizon,MonWidgetFactCommun):
# def __init__(self,node,editor,parentQt,definition, obj, niveau,commande):
class MonWidgetFactPlie(Ui_WidgetFactPlie,Groupe):
"""
"""
- def __init__(self,node,editor,parentQt,definition, obj, niveau,commande):
+ def __init__(self,node,editor,parentQt,definition, obj, niveau,commande,insertIn=-1):
#print "fact plie : ",node.item.nom
Groupe.__init__(self,node,editor,parentQt, definition,obj,niveau,commande)
self.groupBox.setText(self.node.item.GetLabelText()[0])
- self.parentQt.commandesLayout.insertWidget(-1,self)
+ self.parentQt.commandesLayout.insertWidget(insertIn,self)
def traiteClicSurLabel(self,texte):
return