]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
User kernel service for study management
authorAndré Ribes <andre.ribes@edf.fr>
Thu, 8 Dec 2011 09:00:09 +0000 (10:00 +0100)
committerAndré Ribes <andre.ribes@edf.fr>
Thu, 8 Dec 2011 09:00:09 +0000 (10:00 +0100)
src/daSalome/daGUI/daGuiImpl/adaoGuiHelper.py

index e93f08551906e47208b9bbaad645646e56d1613a..3f553e9b001a0790d50e369db438aeec16fde627 100644 (file)
@@ -45,17 +45,7 @@ def getActiveStudyId():
     This function returns the id of the active study. The concept of active study
     makes sens only in the GUI context.
     """
-    return __sgPyQt.getStudyId()
-
-
-def getActiveStudy():
-    """
-    This function returns the active study reference. The concept of active study
-    makes sens only in the GUI context.
-    """
-    studyId = getActiveStudyId()()
-    study = adaoModuleHelper.getStudyManager().GetStudyByID( studyId )
-    return study
+    return salome.sg.getActiveStudyId()
 
 def refreshObjectBrowser():
     """
@@ -70,7 +60,7 @@ def selectItem(salomeStudyItem):
     salome.sg.ClearIObjects()
     salome.sg.AddIObject(salomeStudyItem)
 
-def getSelectedItem(salomeStudyId=getActiveStudyId()):
+def getSelectedItem(salomeStudyId=-100):
     """
     Get the current selection. If more than one item are selected, the
     only first is considered. The object is return (not the id).
@@ -79,14 +69,16 @@ def getSelectedItem(salomeStudyId=getActiveStudyId()):
     if salome.sg is None:
         raise Exception("GuiHelper.getSelectedItem can't be used without the GUI context")
 
-    salomeStudy = adaoModuleHelper.getStudyManager().GetStudyByID( salomeStudyId )
-
+    if salomeStudyId != -100:
+      studyEditor = salome.kernel.studyedit.getStudyEditor(salomeStudyId)
+    studyEditor = salome.kernel.studyedit.getStudyEditor()
     item = None
     listEntries=salome.sg.getAllSelected()
+    print listEntries
     if len(listEntries) >= 1:
         entry = listEntries[0]
-        item = salomeStudy.FindObjectID( entry )
-
+        print entry
+        item = studyEditor.study.FindObjectID( entry )
     return item
 
 def getAllSelected(salomeStudyId):