]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Nouvelle version de Save
authorAndré Ribes <andre.ribes@edf.fr>
Tue, 22 Feb 2011 16:10:51 +0000 (17:10 +0100)
committerAndré Ribes <andre.ribes@edf.fr>
Tue, 22 Feb 2011 16:10:51 +0000 (17:10 +0100)
src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py
src/daSalome/daGUI/daGuiImpl/ADAOGUI_impl.py
src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py
src/daSalome/daGUI/daGuiImpl/adaoStudyEditor.py

index f2dfbc327aa56f100f704706208eeb98908e260d..98ac5a9244faf3086c9cc68d64de50ca3e1df463 100644 (file)
@@ -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):
         """
index 198371c0db1d76497af6e078f62a596912f202c2..363d2434f34b8caf4d685d6b96205c4d3af7c4bb 100644 (file)
@@ -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)
 
index 1096d8f7fb3dd7fcf273a77197adf8584fc9224a..eafa6446b03dde81c55bf15e98e12ec603543bba 100644 (file)
@@ -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={
index 3bb857afd770b673c8d1a2c6d4af8480944c3205..aa0dc9adc31943682430122cad904c60d7bcb747 100644 (file)
@@ -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()