From: André Ribes Date: Thu, 8 Dec 2011 09:00:09 +0000 (+0100) Subject: User kernel service for study management X-Git-Tag: V6_4_0rc3~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0724604f1575e334b4ac9fd1fd9f3dca9d689462;p=modules%2Fadao.git User kernel service for study management --- 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):