From 6da11e5fc054062f35d3dfb90167fa5b59e7eddd Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Fri, 1 Mar 2013 15:15:22 +0100 Subject: [PATCH] Use FactoryServerPy instead of FactoryServer to load the engine because it's still the GUI default for Python modules --- src/PARAMETRIC/PARAMETRIC.py | 6 +++--- src/salome/parametric/__init__.py | 1 + src/salome/parametric/study.py | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/PARAMETRIC/PARAMETRIC.py b/src/PARAMETRIC/PARAMETRIC.py index b821eb9..a0ed4be 100644 --- a/src/PARAMETRIC/PARAMETRIC.py +++ b/src/PARAMETRIC/PARAMETRIC.py @@ -39,7 +39,7 @@ from salome.kernel import termcolor logger = Logger("PARAMETRIC", color = termcolor.BLUE) logger.setLevel(logging.DEBUG) -from salome.parametric import PARAM_STUDY_TYPE_ID, ParametricStudy, parse_entry +from salome.parametric import PARAM_STUDY_TYPE_ID, ParametricStudy, parse_entry, PARAMETRIC_ENGINE_CONTAINER from salome.parametric.persistence import load_param_study_dict, save_param_study_dict # module constants @@ -104,7 +104,8 @@ class PARAMETRIC(PARAMETRIC_ORB__POA.PARAMETRIC_Gen, SALOME_ComponentPy_i, SALOM """ if salomeStudyID not in self.param_comp: ed = getStudyEditor(salomeStudyID) - self.param_comp[salomeStudyID] = ed.findOrCreateComponent(MODULE_NAME, COMPONENT_NAME, COMPONENT_ICON) + self.param_comp[salomeStudyID] = ed.findOrCreateComponent(MODULE_NAME, COMPONENT_NAME, + COMPONENT_ICON, PARAMETRIC_ENGINE_CONTAINER) return self.param_comp[salomeStudyID] def _set_param_study_sobj(self, parametric_study, salomeStudyID, sobj): @@ -362,7 +363,6 @@ class PARAMETRIC(PARAMETRIC_ORB__POA.PARAMETRIC_Gen, SALOME_ComponentPy_i, SALOM for (entry, param_study) in loaded_dict.iteritems(): if entry.startswith(componentEntry): self.param_study_dict[salomeStudyID][entry] = param_study - print self.param_study_dict return 1 except: logger.exception("Error while trying to load study") diff --git a/src/salome/parametric/__init__.py b/src/salome/parametric/__init__.py index a56664d..8f1dbbd 100644 --- a/src/salome/parametric/__init__.py +++ b/src/salome/parametric/__init__.py @@ -19,6 +19,7 @@ import study import genjob PARAM_STUDY_TYPE_ID = study.PARAM_STUDY_TYPE_ID +PARAMETRIC_ENGINE_CONTAINER = study.PARAMETRIC_ENGINE_CONTAINER ParametricStudy = study.ParametricStudy VariableRange = study.VariableRange ParametricStudyEditor = study.ParametricStudyEditor diff --git a/src/salome/parametric/study.py b/src/salome/parametric/study.py index 40aa7f7..d4023fe 100644 --- a/src/salome/parametric/study.py +++ b/src/salome/parametric/study.py @@ -25,6 +25,10 @@ import PARAMETRIC PARAM_STUDY_TYPE_ID = 1 +# We must use FactoryServerPy for now because it is the one that is used by GUI +# when automatically loading the engine +PARAMETRIC_ENGINE_CONTAINER = "FactoryServerPy" + class ParametricStudyEditor: """ This class provides utility methods to edit the component "Parametric" in @@ -43,7 +47,7 @@ class ParametricStudyEditor: :return: the PARAMETRIC engine """ if self.engine is None: - self.engine = salome.lcc.FindOrLoadComponent("FactoryServer", "PARAMETRIC") + self.engine = salome.lcc.FindOrLoadComponent(PARAMETRIC_ENGINE_CONTAINER, "PARAMETRIC") return self.engine def add_parametric_study(self, parametric_study): -- 2.39.2