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():
"""
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).
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):