From d9a5f47e7b702b1edb8266c1131a10f35aed2657 Mon Sep 17 00:00:00 2001 From: boulant Date: Wed, 2 Nov 2011 14:56:01 +0000 Subject: [PATCH] FIX: add missing commit from the V6_main --- src/KERNEL_PY/kernel/services.py | 12 +++++++----- src/KERNEL_PY/kernel/studyedit.py | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/KERNEL_PY/kernel/services.py b/src/KERNEL_PY/kernel/services.py index 90bd44f5e..032242bf6 100644 --- a/src/KERNEL_PY/kernel/services.py +++ b/src/KERNEL_PY/kernel/services.py @@ -135,11 +135,6 @@ def __getStudyManager_demo(): # ============================================================================== # -# TO BE COMPLETED: -# With functions to manipulate object, sobject, etc (See -# GUI_SRC/src/SALOME_SWIG/salome.py). The functions to manipulate the -# study are implemented in the Study Editor (see studyedit.py) - # - the SObject is an item in a study (Study Object). # - the entry is the identifier of an item. # - the ID is the entry @@ -147,6 +142,13 @@ def __getStudyManager_demo(): # embedded in the SALOME component container and with a reference in # the SALOME study, so that it can be retrieved. +# __GBO__ WARN: theses functions are already defined in +# salome_study.py, but without the possibility to specify the +# underlying study (in salome_study.py, the study is the default study +# binded to the salome.myStudy attribute). TODO: see if it can be +# extends to the prototype (with the study as an argument) below and +# resorb the functions below. + def IDToObject(id, study=None): myObj = None if study is None: diff --git a/src/KERNEL_PY/kernel/studyedit.py b/src/KERNEL_PY/kernel/studyedit.py index 62d416261..f31c6ede6 100644 --- a/src/KERNEL_PY/kernel/studyedit.py +++ b/src/KERNEL_PY/kernel/studyedit.py @@ -40,10 +40,12 @@ def getActiveStudyId(): ``salome.myStudyId`` variable. """ salome.salome_init() - if salome.hasDesktop(): - return salome.sg.getActiveStudyId() - else: - return salome.myStudyId + # _GBO_WARN: note that salome.getActiveStudy() returns an id. It + # should return the study or be renammed in getActiveStudyId. + return salome.getActiveStudy() + +def getActiveStudy(): + return salome.myStudyManager.GetStudyByID(getActiveStudyId()) def getStudyEditor(studyId = None): """ -- 2.39.2