From b739c36db365b2e8eca8a3973081a7b2d16b3ec8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9?= Date: Thu, 29 Apr 2010 10:25:16 +0200 Subject: [PATCH] - Meilleure gestion de la duplication - Remove ok --- .../daEficasWrapper/datassimEficasWrapper.py | 11 ++++++++ .../daGUI/daGuiImpl/datassimGuiManager.py | 27 +++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py b/src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py index 9f27c15..6bf06f4 100644 --- a/src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py +++ b/src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py @@ -115,6 +115,17 @@ class DatassimEficasWrapper(EficasWrapper): def getOpenFileName(self): return str(self.__file_open_name) + def selectCase(self, callbackId): + rtn = False + for editor, myCallbackId in self.__myCallbackId.iteritems(): + if myCallbackId[0] == callbackId[0]: + if myCallbackId[1].GetID() == callbackId[1].GetID(): + rtn = True + for indexEditor in self.viewmanager.dict_editors.keys(): + if editor is self.viewmanager.dict_editors[indexEditor]: + self.viewmanager.myQtab.setCurrentIndex(indexEditor) + return rtn + def fileClose(self): """ @overload diff --git a/src/daSalome/daGUI/daGuiImpl/datassimGuiManager.py b/src/daSalome/daGUI/daGuiImpl/datassimGuiManager.py index 330bff4..af316ae 100644 --- a/src/daSalome/daGUI/daGuiImpl/datassimGuiManager.py +++ b/src/daSalome/daGUI/daGuiImpl/datassimGuiManager.py @@ -59,6 +59,7 @@ ACTIONS_MAP={ UI_ELT_IDS.NEW_DATASSIMCASE_ID:"newDatassimCase", UI_ELT_IDS.OPEN_DATASSIMCASE_ID:"openDatassimCase", UI_ELT_IDS.EDIT_DATASSIMCASE_POP_ID:"editDatassimCase", + UI_ELT_IDS.REMOVE_DATASSIMCASE_POP_ID:"removeDatassimCase", } class DatassimGuiUiComponentBuilder: @@ -163,15 +164,37 @@ class DatassimGuiActionImpl(EficasObserver): case_key = (salomeStudyId, salomeStudyItem.GetID()) try: case = __cases__[case_key] - if case.get_filename() is not None and case.get_name() != "new_case": + # Search if case is in Eficas ! + callbackId = [salomeStudyId, salomeStudyItem] + case_open_in_eficas = self.__dlgEficasWrapper.selectCase(callbackId) + # If case is not in eficas Open It ! + if case_open_in_eficas == False: self.__dlgEficasWrapper.Openfile(case.get_filename()) callbackId = [salomeStudyId, salomeStudyItem] self.__dlgEficasWrapper.setCallbackId(callbackId) - self.__dlgEficasWrapper.show() + self.__dlgEficasWrapper.show() except: print "Oups - cannot edit case !" traceback.print_exc() + def removeDatassimCase(self): + global __cases__ + + # First step: selectCase + salomeStudyId = datassimGuiHelper.getActiveStudyId() + salomeStudyItem = datassimGuiHelper.getSelectedItem(salomeStudyId) + callbackId = [salomeStudyId, salomeStudyItem] + case_open_in_eficas = self.__dlgEficasWrapper.selectCase(callbackId) + # If case is in eficas close it ! + if case_open_in_eficas: + self.__dlgEficasWrapper.fileClose() + + # Test if case exists + case_key = (salomeStudyId, salomeStudyItem.GetID()) + if __cases__.has_key(case_key): + __cases__.pop(case_key) + datassimStudyEditor.removeItem(salomeStudyId, salomeStudyItem) + datassimGuiHelper.refreshObjectBrowser() # ========================================================================== # Processing notifications from eficas -- 2.39.2