From 7487e300335588cecbb22c79735a1d7517be6a1a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Ribes?= Date: Thu, 24 Feb 2011 17:22:26 +0100 Subject: [PATCH] Synchro etat etude etat cas dans eficas --- src/daSalome/daGUI/ADAOGUI.py | 3 ++- .../daEficasWrapper/adaoEficasWrapper.py | 8 ++++---- src/daSalome/daGUI/daGuiImpl/ADAOGUI_impl.py | 1 - src/daSalome/daGUI/daGuiImpl/adaoCase.py | 20 +++++++++++++++++++ .../daGUI/daGuiImpl/adaoStudyEditor.py | 1 - 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/daSalome/daGUI/ADAOGUI.py b/src/daSalome/daGUI/ADAOGUI.py index 24ae044..43b361e 100644 --- a/src/daSalome/daGUI/ADAOGUI.py +++ b/src/daSalome/daGUI/ADAOGUI.py @@ -91,5 +91,6 @@ def preferenceChanged( section, setting ): adaoLogger.debug("preferenceChanged") GuiImpl.preferenceChanged( section, setting ) -def activeViewChanged(toto, myView): +def activeViewChanged(myView): adaoLogger.debug("activeViewChanged") + GuiImpl.activeViewChanged(myView) diff --git a/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py index 3806147..8538879 100644 --- a/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py +++ b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py @@ -84,7 +84,7 @@ class AdaoEficasWrapper(eficasSalome.MyEficas): qtEficas.Appli.fileNew(self) index = self.viewmanager.myQtab.currentIndex() adao_case.name = str(self.viewmanager.myQtab.tabText(index)) - adao_case.eficas_editor = self.viewmanager.dict_editors[index] + adao_case.setEditor(self.viewmanager.dict_editors[index]) self.notifyObserver(EficasEvent.EVENT_TYPES.NEW, callbackId=adao_case) def adaoFileSave(self, adao_case): @@ -94,7 +94,7 @@ class AdaoEficasWrapper(eficasSalome.MyEficas): index = self.viewmanager.myQtab.currentIndex() adao_case.name = str(self.viewmanager.myQtab.tabText(index)) adao_case.filename = str(self.viewmanager.dict_editors[index].fichier) - adao_case.eficas_editor = self.viewmanager.dict_editors[index] + adao_case.setEditor(self.viewmanager.dict_editors[index]) self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE, callbackId=adao_case) def adaoFileSaveAs(self, adao_case): @@ -104,7 +104,7 @@ class AdaoEficasWrapper(eficasSalome.MyEficas): index = self.viewmanager.myQtab.currentIndex() adao_case.name = str(self.viewmanager.myQtab.tabText(index)) adao_case.filename = str(self.viewmanager.dict_editors[index].fichier) - adao_case.eficas_editor = self.viewmanager.dict_editors[index] + adao_case.setEditor(self.viewmanager.dict_editors[index]) self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE, callbackId=adao_case) def adaoFileOpen(self, adao_case): @@ -117,7 +117,7 @@ class AdaoEficasWrapper(eficasSalome.MyEficas): index = self.viewmanager.myQtab.currentIndex() adao_case.name = str(self.viewmanager.myQtab.tabText(index)) adao_case.filename = str(self.viewmanager.dict_editors[index].fichier) - adao_case.eficas_editor = self.viewmanager.dict_editors[index] + adao_case.setEditor(self.viewmanager.dict_editors[index]) self.notifyObserver(EficasEvent.EVENT_TYPES.OPEN, callbackId=adao_case) def adaoFileClose(self, adao_case): diff --git a/src/daSalome/daGUI/daGuiImpl/ADAOGUI_impl.py b/src/daSalome/daGUI/daGuiImpl/ADAOGUI_impl.py index 363d243..21f055f 100644 --- a/src/daSalome/daGUI/daGuiImpl/ADAOGUI_impl.py +++ b/src/daSalome/daGUI/daGuiImpl/ADAOGUI_impl.py @@ -131,7 +131,6 @@ def preferenceChanged( section, setting ): # called when active view is changed # view ID is passed as parameter def activeViewChanged( viewID ): - print "activeViewChanged", viewID pass # called when active view is cloned diff --git a/src/daSalome/daGUI/daGuiImpl/adaoCase.py b/src/daSalome/daGUI/daGuiImpl/adaoCase.py index ca2e2c0..cd0beb6 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoCase.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoCase.py @@ -23,6 +23,11 @@ import subprocess import traceback import SalomePyQt +import eficasSalome +from Ihm import CONNECTOR +import adaoGuiHelper +import adaoStudyEditor + class AdaoCase: def __init__(self): @@ -37,6 +42,21 @@ class AdaoCase: self.eficas_editor = None # Editor object from Eficas + def setEditor(self, editor): + if editor is not self.eficas_editor: + self.eficas_editor = editor + # Connect to the jdc + print self.eficas_editor.jdc + CONNECTOR.Connect(self.eficas_editor.jdc, "valid", self.editorValidEvent, ()) + + # Rq on notera que l'on utilise isvalid dans isOk + # et que isOk appelle editorValidEvent + # il n'y a pas de boucle infini car isvalid n'émet + # son signal que si l'état a changé + def editorValidEvent(self): + adaoStudyEditor.updateItem(self.salome_study_id, self.salome_study_item, self) + adaoGuiHelper.refreshObjectBrowser() + def isOk(self): if self.eficas_editor.jdc: return self.eficas_editor.jdc.isvalid() diff --git a/src/daSalome/daGUI/daGuiImpl/adaoStudyEditor.py b/src/daSalome/daGUI/daGuiImpl/adaoStudyEditor.py index b4d5391..52bb64c 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoStudyEditor.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoStudyEditor.py @@ -25,7 +25,6 @@ from enumerate import Enumerate from salome.kernel import studyedit import adaoModuleHelper -from daGuiImpl.adaoCase import AdaoCase # # ============================================================================== -- 2.39.2