From 0724604f1575e334b4ac9fd1fd9f3dca9d689462 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Ribes?= Date: Thu, 8 Dec 2011 10:00:09 +0100 Subject: [PATCH] User kernel service for study management --- src/daSalome/daGUI/daGuiImpl/adaoGuiHelper.py | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/daSalome/daGUI/daGuiImpl/adaoGuiHelper.py b/src/daSalome/daGUI/daGuiImpl/adaoGuiHelper.py index e93f085..3f553e9 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoGuiHelper.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoGuiHelper.py @@ -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): -- 2.39.2