From 528338e9209dbc35ddd4cc3230178704ccf5f252 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9?= Date: Thu, 29 Apr 2010 16:01:45 +0200 Subject: [PATCH] - Multi Etude... --- .../daGUI/daEficasWrapper/datassimEficasWrapper.py | 7 +++---- src/daSalome/daGUI/daGuiImpl/DATASSIMGUI_impl.py | 11 ++++++++--- src/daSalome/daGUI/daGuiImpl/datassimGuiManager.py | 5 +++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py b/src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py index 422a044..7a11ae6 100644 --- a/src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py +++ b/src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py @@ -34,12 +34,11 @@ sys.path[:0]=[DATASSIM_INSTALL_DIR] # class DatassimEficasWrapper(EficasWrapper): - __myCallbackId = {} - __close_editor = None - __file_open_name = "" - def __init__(self, parent, code="DATASSIM"): EficasWrapper.__init__(self, parent, code) + self.__myCallbackId = {} + self.__close_editor = None + self.__file_open_name = "" def init_gui(self): EficasWrapper.init_gui(self) diff --git a/src/daSalome/daGUI/daGuiImpl/DATASSIMGUI_impl.py b/src/daSalome/daGUI/daGuiImpl/DATASSIMGUI_impl.py index 6423113..272bd3c 100644 --- a/src/daSalome/daGUI/daGuiImpl/DATASSIMGUI_impl.py +++ b/src/daSalome/daGUI/daGuiImpl/DATASSIMGUI_impl.py @@ -37,10 +37,13 @@ sgPyQt = SalomePyQt.SalomePyQt() from daGuiImpl import datassimGuiHelper from daGuiImpl.datassimGuiManager import DatassimGuiUiComponentBuilder +from daGuiImpl.datassimGuiManager import DatassimGuiActionImpl class GUIcontext: uiComponentBuilder = None + actionImpl = None def __init__(self): self.uiComponentBuilder = DatassimGuiUiComponentBuilder() + self.actionImpl = DatassimGuiActionImpl() __study2context__ = {} @@ -48,13 +51,12 @@ __current_context__ = None def _setContext( studyID ): global __study2context__, __current_context__ if not __study2context__.has_key(studyID): + print "create new context" __study2context__[studyID] = GUIcontext() pass __current_context__ = __study2context__[studyID] return __current_context__ -from daGuiImpl.datassimGuiManager import DatassimGuiActionImpl -actionImpl = DatassimGuiActionImpl() # This object does not need to be embedded in a GUI context object. A single # instance for all studies is a priori sufficient. @@ -89,7 +91,9 @@ def createPreferences(): # called when module is activated # returns True if activating is successfull and False otherwise def activate(): + print "activate study", sgPyQt.getStudyId() ctx = _setContext( sgPyQt.getStudyId() ) + ctx.actionImpl.activate() return True # called when module is deactivated @@ -119,7 +123,8 @@ def OnGUIEvent(actionId) : toolbar button). The actionId value is the ID associated to the item. """ pass - actionImpl.processAction(actionId) + ctx = _setContext( sgPyQt.getStudyId() ) + ctx.actionImpl.processAction(actionId) # called when module's preferences are changed diff --git a/src/daSalome/daGUI/daGuiImpl/datassimGuiManager.py b/src/daSalome/daGUI/daGuiImpl/datassimGuiManager.py index e7ac721..ed1b3fb 100644 --- a/src/daSalome/daGUI/daGuiImpl/datassimGuiManager.py +++ b/src/daSalome/daGUI/daGuiImpl/datassimGuiManager.py @@ -105,8 +105,6 @@ class DatassimGuiActionImpl(EficasObserver): This class implements the ui actions concerning the management of oma study cases. """ - __dlgEficasWrapper = None - __Eficas_viewId = -1 def __init__(self): pass @@ -115,6 +113,7 @@ class DatassimGuiActionImpl(EficasObserver): #self.__dlgNewStudyCase = DlgNewStudyCase() self.__dlgEficasWrapper = DatassimEficasWrapper(parent=SalomePyQt.SalomePyQt().getDesktop()) self.__dlgEficasWrapper.addObserver(self) + self.__Eficas_viewId = -1 # ========================================================================== # Processing of ui actions @@ -148,6 +147,8 @@ class DatassimGuiActionImpl(EficasObserver): self.__dlgEficasWrapper.init_gui() self.__Eficas_viewId = SalomePyQt.SalomePyQt().createViewWithMain(self.__dlgEficasWrapper) + def activate(self): + self.showEficas() def newDatassimCase(self): self.showEficas() -- 2.39.2