]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Correction de la fonction Remove
authorAndré Ribes <andre.ribes@edf.fr>
Thu, 23 Dec 2010 15:37:42 +0000 (16:37 +0100)
committerAndré Ribes <andre.ribes@edf.fr>
Thu, 23 Dec 2010 15:37:42 +0000 (16:37 +0100)
src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py
src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py

index f9b40561c7baf2c079569f5d0ef0423d69e6c49d..68cf220f688cb8041aa6d4e8a84c7627b93c60f8 100644 (file)
@@ -60,14 +60,14 @@ class AdaoEficasWrapper(eficasSalome.MyEficas):
       # On gere nous meme l'etude
       pass
 
-    def fileNew(self):        
+    def fileNew(self):
         """
         @overload
         """
         qtEficas.Appli.fileNew(self)
         self.notifyObserver(EficasEvent.EVENT_TYPES.NEW)
 
-    def openEmptyCase(self, callbackId):        
+    def openEmptyCase(self, callbackId):
         qtEficas.Appli.fileNew(self)
         self.removeCallbackId(callbackId)
         self.setCallbackId(callbackId)
@@ -190,10 +190,12 @@ class AdaoEficasWrapper(eficasSalome.MyEficas):
 
     def removeCallbackId(self, callbackId):
       key_to_remove = None
+      print callbackId
       for k, v in self.__myCallbackId.iteritems():
+        print k, v
         if v[0] == callbackId[0] and v[1].GetID() == callbackId[1].GetID():
           key_to_remove = k
-      if key_to_remove is not None:    
+      if key_to_remove is not None:
         del self.__myCallbackId[key_to_remove]
       else:
         print "Oups - cannot find callbackId"
index 272a81e01151357f904904b7420752ce59cca423..3c98d52998e85c5a753c2d68f0ffcd51a926ec8b 100644 (file)
@@ -165,6 +165,8 @@ class AdaoGuiActionImpl(EficasObserver):
     def activate(self):
       self.showEficas()
 
+    # Actions from SALOME GUI
+
     def newAdaoCase(self):
       self.showEficas()
       self.__dlgEficasWrapper.fileNew()
@@ -227,40 +229,45 @@ class AdaoGuiActionImpl(EficasObserver):
       salomeStudyItem = adaoGuiHelper.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:
+        # fileClose: remove the CallbackId
+        # fileClose: sends a destroy event
         self.__dlgEficasWrapper.fileClose()
-
-      # Test if case exists
-      case_key = (salomeStudyId, salomeStudyItem.GetID())
-      if __cases__.has_key(case_key):
-        __cases__.pop(case_key)
-        adaoStudyEditor.removeItem(salomeStudyId, salomeStudyItem)
-        adaoGuiHelper.refreshObjectBrowser()
-
-      # Remove Callback in adaoEficasWrapper
-      self.__dlgEficasWrapper.removeCallbackId(callbackId)
+      else:
+        # Test if case exists
+        case_key = (salomeStudyId, salomeStudyItem.GetID())
+        if __cases__.has_key(case_key):
+          __cases__.pop(case_key)
+          adaoStudyEditor.removeItem(salomeStudyId, salomeStudyItem)
+          adaoGuiHelper.refreshObjectBrowser()
 
     def exportCaseToYACS(self):
       global __cases__
+
+      # Get case from study
       salomeStudyId   = adaoGuiHelper.getActiveStudyId()
       salomeStudyItem = adaoGuiHelper.getSelectedItem(salomeStudyId)
       case_key = (salomeStudyId, salomeStudyItem.GetID())
       case = __cases__[case_key]
 
+      # Generates YACS schema and export it
       msg = case.exportCaseToYACS()
+
+      # If msg is not empty -> error found
       if msg != "":
         adaoGuiHelper.gui_warning(self.__parent, msg)
 
     # ==========================================================================
-    # Processing notifications from eficas
+    # Processing notifications from adaoEficasWrapper
     #
     __processOptions={
-        EficasEvent.EVENT_TYPES.CLOSE : "_processEficasCloseEvent",
-        EficasEvent.EVENT_TYPES.SAVE  : "_processEficasSaveEvent",
-        EficasEvent.EVENT_TYPES.NEW  : "_processEficasNewEvent",
-        EficasEvent.EVENT_TYPES.DESTROY  : "_processEficasDestroyEvent",
-        EficasEvent.EVENT_TYPES.OPEN  : "_processEficasOpenEvent",
+        EficasEvent.EVENT_TYPES.CLOSE   : "_processEficasCloseEvent",
+        EficasEvent.EVENT_TYPES.SAVE    : "_processEficasSaveEvent",
+        EficasEvent.EVENT_TYPES.NEW     : "_processEficasNewEvent",
+        EficasEvent.EVENT_TYPES.DESTROY : "_processEficasDestroyEvent",
+        EficasEvent.EVENT_TYPES.OPEN    : "_processEficasOpenEvent",
         EficasEvent.EVENT_TYPES.REOPEN  : "_processEficasReOpenEvent"
         }
     def processEficasEvent(self, eficasWrapper, eficasEvent):