From 733d349ff6da8ffe728ca98267ee5a79a2f2d594 Mon Sep 17 00:00:00 2001 From: boulant Date: Mon, 13 Feb 2012 12:49:37 +0000 Subject: [PATCH] IMP: studyedit, helper functions to convert study in studyId et conversely --- src/KERNEL_PY/kernel/studyedit.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/KERNEL_PY/kernel/studyedit.py b/src/KERNEL_PY/kernel/studyedit.py index 8d7c1a3ab..5359de87e 100644 --- a/src/KERNEL_PY/kernel/studyedit.py +++ b/src/KERNEL_PY/kernel/studyedit.py @@ -49,7 +49,16 @@ def getActiveStudyId(): return salome.myStudyId def getActiveStudy(): - return salome.myStudyManager.GetStudyByID(getActiveStudyId()) + return getStudyFromStudyId(getActiveStudyId()) + +def getStudyFromStudyId(studyId): + salome.salome_init() + study = salome.myStudyManager.GetStudyByID(studyId) + return study + +def getStudyIdFromStudy(study): + studyId = study._get_StudyId() + return studyId def getStudyEditor(studyId = None): """ @@ -63,7 +72,6 @@ def getStudyEditor(studyId = None): _editors[studyId] = StudyEditor(studyId) return _editors[studyId] - class StudyEditor: """ This class provides utility methods to complement :class:`Study` and -- 2.39.2