]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
- Meilleure gestion de la duplication
authorAndré <andre.ribes@edf.fr>
Thu, 29 Apr 2010 08:25:16 +0000 (10:25 +0200)
committerAndré <andre.ribes@edf.fr>
Thu, 29 Apr 2010 08:25:16 +0000 (10:25 +0200)
- Remove ok

src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py
src/daSalome/daGUI/daGuiImpl/datassimGuiManager.py

index 9f27c153a14677abfe1e91ab674d1ee78044e4ab..6bf06f46459fadf722da556cd4ef72cbaaae9d4e 100644 (file)
@@ -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
index 330bff458e3f6839fce063f19954ebd3b46b9b0f..af316aef8c9a7afd1ef4ff9e0af309ce322fd347 100644 (file)
@@ -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