From: André Ribes Date: Tue, 22 Feb 2011 16:10:51 +0000 (+0100) Subject: Nouvelle version de Save X-Git-Tag: V6_4_0rc3~84 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4950e8b308af03fd8b3d0bbb420fd4fdc7e42d03;p=modules%2Fadao.git Nouvelle version de Save --- diff --git a/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py index f2dfbc3..98ac5a9 100644 --- a/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py +++ b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py @@ -84,14 +84,15 @@ class AdaoEficasWrapper(eficasSalome.MyEficas): self.removeCallbackId(callbackId) self.setCallbackId(callbackId) - def fileSave(self): - """ - @overload - """ - qtEficas.Appli.fileSave(self) - index = self.viewmanager.myQtab.currentIndex() - if index > -1 : - self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE) + def adaoFileSave(self, adao_case): + + ok = qtEficas.Appli.fileSave(self) + if ok: + index = self.viewmanager.myQtab.currentIndex() + adao_case.name = str(self.viewmanager.myQtab.tabText(index)) # Utilisation de str() pour passer d'un Qstring à un string + adao_case.eficas_editor = self.viewmanager.dict_editors[index] + adao_case.filename = str(self.viewmanager.dict_editors[index].fichier) + self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE, callbackId=adao_case) def fileSaveAs(self): """ diff --git a/src/daSalome/daGUI/daGuiImpl/ADAOGUI_impl.py b/src/daSalome/daGUI/daGuiImpl/ADAOGUI_impl.py index 198371c..363d243 100644 --- a/src/daSalome/daGUI/daGuiImpl/ADAOGUI_impl.py +++ b/src/daSalome/daGUI/daGuiImpl/ADAOGUI_impl.py @@ -120,7 +120,6 @@ def OnGUIEvent(actionId) : toolbar button). The actionId value is the ID associated to the item. """ pass - print "OnGUIEvent", actionId ctx = _setContext( sgPyQt.getStudyId() ) ctx.adaoCaseManager.processGUIEvent(actionId) diff --git a/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py b/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py index 1096d8f..eafa644 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py @@ -146,14 +146,26 @@ class AdaoCaseManager(EficasObserver): # Ajout du cas self.cases[adao_case.name] = adao_case + # Sauvegarde d'un cas + # 1: la fonction saveAdaoCase est appelée par le GUI SALOME + # 2: la fonction _processEficasSaveEvent est appelée par le manager EFICAS + def saveAdaoCase(self): + adaoLogger.debug("Sauvegarde du cas s'il y a modification") + salomeStudyItem = adaoGuiHelper.getSelectedItem() + for case_name, adao_case in self.cases.iteritems(): + if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): + self.eficas_manager.adaoFileSave(adao_case) + break - - - - - - - + def _processEficasSaveEvent(self, eficasWrapper, eficasEvent): + adao_case = eficasEvent.callbackId + # On met à jour l'étude + adaoStudyEditor.updateItem(adao_case.salome_study_id, adao_case.salome_study_item, adao_case) + # Affichage correct dans l'étude + adaoGuiHelper.refreshObjectBrowser() + adaoGuiHelper.selectItem(adao_case.salome_study_item.GetID()) + # Ajout du cas + self.cases[adao_case.name] = adao_case # Gestion des évènements venant du manager Eficas __processOptions={ diff --git a/src/daSalome/daGUI/daGuiImpl/adaoStudyEditor.py b/src/daSalome/daGUI/daGuiImpl/adaoStudyEditor.py index 3bb857a..aa0dc9a 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoStudyEditor.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoStudyEditor.py @@ -77,9 +77,9 @@ def updateItem(salomeStudyId, salomeStudyItem, adaoCase): studyEditor = studyedit.getStudyEditor(salomeStudyId) - if salomeStudyItem.GetName()[:-2] != adaoCase.get_name(): - itemName = adaoCase.get_name() - itemValue = adaoCase.get_filename() + if salomeStudyItem.GetName()[:-2] != adaoCase.name: + itemName = adaoCase.name + itemValue = adaoCase.filename else: itemName = salomeStudyItem.GetName() itemValue = adaoCase.get_filename()