]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
gestion de la duplication
authorAndré <andre.ribes@edf.fr>
Wed, 28 Apr 2010 16:51:33 +0000 (18:51 +0200)
committerAndré <andre.ribes@edf.fr>
Wed, 28 Apr 2010 16:51:33 +0000 (18:51 +0200)
src/daSalome/daGUI/daGuiImpl/datassimGuiManager.py
src/daSalome/daGUI/daGuiImpl/datassimStudyEditor.py

index e6c9ccf88c3286f21c35ca8ece10a7598459e8a2..330bff458e3f6839fce063f19954ebd3b46b9b0f 100644 (file)
@@ -146,7 +146,7 @@ class DatassimGuiActionImpl(EficasObserver):
       new_case.set_name(str(fichier.split('/')[-1]))
       salomeStudyId   = datassimGuiHelper.getActiveStudyId()
       salomeStudyItem = datassimStudyEditor.addInStudy(salomeStudyId, new_case)
-      case_key = (salomeStudyId, salomeStudyItem.GetName())
+      case_key = (salomeStudyId, salomeStudyItem.GetID())
       __cases__[case_key] = new_case
 
       # Open file in Eficas
@@ -160,7 +160,7 @@ class DatassimGuiActionImpl(EficasObserver):
       global __cases__
       salomeStudyId   = datassimGuiHelper.getActiveStudyId()
       salomeStudyItem = datassimGuiHelper.getSelectedItem(salomeStudyId)
-      case_key = (salomeStudyId, salomeStudyItem.GetName())
+      case_key = (salomeStudyId, salomeStudyItem.GetID())
       try:
         case = __cases__[case_key]
         if case.get_filename() is not None and case.get_name() != "new_case":
@@ -200,7 +200,7 @@ class DatassimGuiActionImpl(EficasObserver):
       new_case = DatassimCase()
       salomeStudyId   = datassimGuiHelper.getActiveStudyId()
       salomeStudyItem = datassimStudyEditor.addInStudy(salomeStudyId, new_case)
-      case_key = (salomeStudyId, salomeStudyItem.GetName())
+      case_key = (salomeStudyId, salomeStudyItem.GetID())
       __cases__[case_key] = new_case
       datassimGuiHelper.refreshObjectBrowser()
       callbackId = [salomeStudyId, salomeStudyItem]
@@ -216,7 +216,7 @@ class DatassimGuiActionImpl(EficasObserver):
       new_case = DatassimCase()
       salomeStudyId   = datassimGuiHelper.getActiveStudyId()
       salomeStudyItem = datassimStudyEditor.addInStudy(salomeStudyId, new_case)
-      case_key = (salomeStudyId, salomeStudyItem.GetName())
+      case_key = (salomeStudyId, salomeStudyItem.GetID())
       __cases__[case_key] = new_case
 
       # Connexion du nouveau cas
@@ -243,19 +243,19 @@ class DatassimGuiActionImpl(EficasObserver):
         file_case_name = eficasWrapper.getFileCaseName()
         if case_name != "" :
           # Get case
-          old_case_key = (targetSalomeStudyId, targetSalomeStudyItem.GetName())
+          old_case_key = (targetSalomeStudyId, targetSalomeStudyItem.GetID())
           case =__cases__[old_case_key]
 
           # Set new informations
-          case.set_name(case_name)
           case.set_filename(file_case_name)
+          case.set_name(case_name)
           datassimStudyEditor.updateItem(targetSalomeStudyId, targetSalomeStudyItem, case)
 
           # Case key changed !
-          new_case_key = (targetSalomeStudyId, targetSalomeStudyItem.GetName())
+          #new_case_key = (targetSalomeStudyId, targetSalomeStudyItem.GetID())
           # A ne pas inverser !!!
-          __cases__.pop(old_case_key)
-          __cases__[new_case_key] = case
+          #__cases__.pop(old_case_key)
+          #__cases__[new_case_key] = case
 
           datassimGuiHelper.refreshObjectBrowser()
 
@@ -268,7 +268,7 @@ class DatassimGuiActionImpl(EficasObserver):
         if ( targetSalomeStudyId is None ) or ( targetSalomeStudyItem is None ):
             raise DevelException("the parameters targetSalomeStudyId and targetSalomeStudyItem should not be None")
 
-        case_key = (targetSalomeStudyId, targetSalomeStudyItem.GetName())
+        case_key = (targetSalomeStudyId, targetSalomeStudyItem.GetID())
         __cases__.pop(case_key)
         datassimStudyEditor.removeItem(targetSalomeStudyId, targetSalomeStudyItem)
         datassimGuiHelper.refreshObjectBrowser()
index cd8af4b7f2abc25b825e5ed9a9919b95c9aec4b1..e73da1874f544046ee6ee72ffcc9aea4299e9b3b 100644 (file)
@@ -60,7 +60,7 @@ def addInStudy(salomeStudyId, datassimCase):
         componentName = datassimModuleHelper.componentUserName())
 
     itemName  = datassimCase.get_name()
-    itemValue = ""
+    itemValue = str(datassimCase.get_filename())
     itemType  = DATASSIM_ITEM_TYPES.DATASSIM_CASE
 
     salomeStudyItem = studyEditor.createItem(
@@ -76,8 +76,12 @@ def updateItem(salomeStudyId, salomeStudyItem, datassimCase):
 
     studyEditor = studyedit.getStudyEditor(salomeStudyId)
     
-    itemName  = datassimCase.get_name()
-    itemValue = ""
+    if salomeStudyItem.GetName()[:-2] != datassimCase.get_name():
+      itemName  = datassimCase.get_name()
+      itemValue = datassimCase.get_filename()
+    else:
+      itemName  = salomeStudyItem.GetName()
+      itemValue = datassimCase.get_filename()
 
     studyEditor.setItem(salomeStudyItem,
         name    = itemName,