From: salome <> Date: Wed, 22 Jun 2005 18:50:13 +0000 (+0000) Subject: Résolution du bug roundup n°32 (multi-études) X-Git-Tag: TEST_MULTI_STUDIES X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=52ef3cf15cda6dc307a049f23899eb39f5c4f31a;p=modules%2Feficas.git Résolution du bug roundup n°32 (multi-études) --- diff --git a/src/EFICASGUI/EFICASGUI.py b/src/EFICASGUI/EFICASGUI.py index 2e123812..aa607ebe 100644 --- a/src/EFICASGUI/EFICASGUI.py +++ b/src/EFICASGUI/EFICASGUI.py @@ -8,7 +8,7 @@ import SalomePyQt # Variable globale pour stocker le Workspace de Salome WORKSPACE=None -studyId=None +currentStudyId=None # ----------------------------------------------------------------------------- @@ -65,19 +65,26 @@ def OnGUIEvent(commandID) : # ----------------------------------------------------------------------------- def setSettings(): - print "setSettings" - print sgPyQt.getStudyId() + """ + Cette méthode permet les initialisations. On définit en particulier + l'identifiant de l'étude courante. + """ + global currentStudyId + currentStudyId = sgPyQt.getStudyId() + print "setSettings: currentStudyId = " + str(currentStudyId) + # _CS_gbo_ Voir si on peut utiliser directement sgPyQt.getStudyId() + # dans salomedsgui? + # ----------------------------------------------------------------------------- def activeStudyChanged(ID): - global studyId + global currentStudyId # ne marche pas car sg est supposé résider dans une etude # studyId=sg.getActiveStudyId() - studyId=ID - print "studyId: ",sg.getActiveStudyId() - print "On a changé d'étude active",studyId - print sgPyQt.getStudyId() + currentStudyId=ID + print "_CS_GBO_ : EFICASGUI.activeStudyChanged : currentStudyId = ", currentStudyId + print "_CS_GBO_ : EFICASGUI.activeStudyChanged : sgPyQt.getStudyId() = ", sgPyQt.getStudyId() def definePopup(theContext, theObject, theParent): print "EFICASGUI --- definePopup" @@ -102,8 +109,7 @@ def customPopup(popup, theContext, theObject, theParent): import eficasSalome def runEficas(ws): - print "runEficas" - eficasSalome.runEficas(ws,"ASTER") + eficasSalome.runEficas(ws,"ASTER",studyId=currentStudyId) def runEficaspourHomard(ws): print "runEficas" @@ -114,18 +120,24 @@ def runEficasHomard(ws): eficasSalome.runEficas(None,"HOMARD") def runEficasFichier(ws): + """ + Lancement d'eficas à partir d'un fichier sélectionné dans l'arbre + d'étude. + """ print "runEficasFichier" attr=None code="ASTER" a=salome.sg.getAllSelected() if len(a) == 1: + aGuiDS.setCurrentStudy(currentStudyId) boo,attr=aGuiDS.getExternalFileAttribute("FICHIER_EFICAS_ASTER",a[0]) if boo : code = "ASTER" else : boo,attr=aGuiDS.getExternalFileAttribute("FICHIER_EFICAS_HOMARD",a[0]) code = "HOMARD" - eficasSalome.runEficas(ws,code,attr) + + eficasSalome.runEficas(ws,code,attr,studyId=currentStudyId) # Partie applicative diff --git a/src/EFICASGUI/dataEficas.py b/src/EFICASGUI/dataEficas.py index 516552c7..a4a7bbac 100644 --- a/src/EFICASGUI/dataEficas.py +++ b/src/EFICASGUI/dataEficas.py @@ -16,15 +16,17 @@ import sys #import import_code from Editeur import splash from Editeur import eficas -from Editeur import session +# _CS_gbo Mise en commentaire en attendant eficas 1.8 +#from Editeur import session -def init(top,code="ASTER",fichier=None): + +def init(top,code="ASTER",fichier=None,studyId=None): splash.init_splash(top,code=code,titre="Lancement d'EFICAS pour %s" %code) splash._splash.configure(text="Chargement d'EFICAS en cours.\n Veuillez patienter ...") # Enregistrement dans l étude import eficasEtude - MaRef=eficasEtude.Eficas_In_Study(code) + MaRef=eficasEtude.Eficas_In_Study(code,studyId=studyId) #import eficas class MyEficas(eficas.EFICAS): @@ -35,9 +37,11 @@ def init(top,code="ASTER",fichier=None): def contexte(self): self.salome=MaRef - if fichier != None : - options=session.parse(sys.argv+[fichier]) - else : - options=session.parse(sys.argv) + # _CS_gbo Mise en commentaire en attendant eficas 1.8 + # if fichier != None : + # options=session.parse(sys.argv+[fichier]) + #else : + # options=session.parse(sys.argv) + moi=MyEficas(top,code=code) moi.contexte() diff --git a/src/EFICASGUI/eficasEtude.py b/src/EFICASGUI/eficasEtude.py index b8ad89c6..fa2f8b69 100644 --- a/src/EFICASGUI/eficasEtude.py +++ b/src/EFICASGUI/eficasEtude.py @@ -4,7 +4,7 @@ # Author : Pascale NOYRET, EDF # Project : SALOME # Copyright : EDF 2003 -# $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/EFICAS_SRC/src/EFICASGUI/eficasEtude.py,v 1.2 2005/01/06 11:12:12 salome Exp $ +# $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/EFICAS_SRC/src/EFICASGUI/eficasEtude.py,v 1.3 2005/06/03 07:25:24 salome Exp $ #============================================================================= import salome @@ -18,25 +18,31 @@ aGuiDS=salomedsgui.guiDS() class Eficas_In_Study: - def __init__(self,code): + def __init__(self,code,studyId=None): + print "#######################################################" + print "#######################################################" + print "#######################################################" + print "_CS_GBO_ : Eficas_In_Study:init: studyId = ", studyId + print "#######################################################" + print "#######################################################" import SMESH_utils + self.aGuiDS=salomedsgui.guiDS(studyId=studyId) self.enregistre() self.code=code self.liste_deja_la=[] def enregistre(self): - self.fatherId=aGuiDS.enregistre("Eficas") + self.fatherId=self.aGuiDS.enregistre("Eficas") salome.sg.updateObjBrowser(0) - def rangeInStudy(self,fichier, suf=""): + def rangeInStudy(self,fichier, suf=""): if fichier not in self.liste_deja_la : self.liste_deja_la.append(fichier) Nom=re.split("/",fichier)[-1] - - self.commId=aGuiDS.createItemInStudy(self.fatherId,Nom) + self.commId=self.aGuiDS.createItemInStudy(self.fatherId,Nom) if self.commId != None: - aGuiDS.setExternalFileAttribute(self.commId,"FICHIER_EFICAS_"+self.code+suf,fichier) + self.aGuiDS.setExternalFileAttribute(self.commId,"FICHIER_EFICAS_"+self.code+suf,fichier) salome.sg.updateObjBrowser(0) def creeConfigTxt(self,fichier,dico): diff --git a/src/EFICASGUI/eficasSalome.py b/src/EFICASGUI/eficasSalome.py index d0c5650a..c30d1259 100644 --- a/src/EFICASGUI/eficasSalome.py +++ b/src/EFICASGUI/eficasSalome.py @@ -19,17 +19,13 @@ root=Tkinter.Tk() root.withdraw() -def runEficas(ws,code="ASTER",fichier=None): +def runEficas(ws,code="ASTER",fichier=None,studyId=None): global initialised if not initialised: t=Tkinter.Toplevel() t.withdraw() - print t.geometry() - print t.winfo_geometry() - import dataEficas; dataEficas.init(t,code,fichier) + import dataEficas; dataEficas.init(t,code,fichier,studyId=studyId) t.update() - print t.geometry() - print t.winfo_geometry() t.deiconify() t.update() diff --git a/src/EFICASGUI/salomedsgui.py b/src/EFICASGUI/salomedsgui.py index 7f2cd697..2cd5d348 100644 --- a/src/EFICASGUI/salomedsgui.py +++ b/src/EFICASGUI/salomedsgui.py @@ -39,9 +39,21 @@ class guiDS: _father = None _component = None - def __init__(self): + def __init__(self,studyId=None): self._myStudyManager = salome.myStudyManager - self._myStudy = salome.myStudy + # Par défaut les réferences à l'étude sont celles fournies par + # le module salome. + if studyId is None: + self._myStudy = salome.myStudy + self._myBuilder = self._myStudy.NewBuilder() + else: + self.setCurrentStudy(studyId) + + def setCurrentStudy(self,studyId): + """ + Définit les références à l'étude et son builder associé + """ + self._myStudy = self._myStudyManager.GetStudyByID(studyId) self._myBuilder = self._myStudy.NewBuilder() def enregistre(self,myModule):