From 3f47f1ad5b51ea2ed1714eb058e811e0dc857f95 Mon Sep 17 00:00:00 2001 From: srn Date: Thu, 9 Feb 2006 11:52:41 +0000 Subject: [PATCH] Added method getStudyScript --- src/SALOMEDS/SALOMEDS_IParameters.cxx | 36 ++++++++++++++++++++++++++- src/SALOMEDS/SALOMEDS_IParameters.hxx | 5 ++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/SALOMEDS/SALOMEDS_IParameters.cxx b/src/SALOMEDS/SALOMEDS_IParameters.cxx index 3ad0f26e0..14c5ae8f1 100644 --- a/src/SALOMEDS/SALOMEDS_IParameters.cxx +++ b/src/SALOMEDS/SALOMEDS_IParameters.cxx @@ -261,7 +261,7 @@ string SALOMEDS_IParameters::getDefaultScript(_PTR(Study) study, dump += shift +"import iparameters\n"; - dump += shift + "ipar = iparameters.IParameters(salome.myStudy.GetModuleParameters(\""+theID+"\", \""+moduleName+"\", 1))\n\n"; + dump += shift + "ipar = iparameters.IParameters(theStudy.GetModuleParameters(\""+theID+"\", \""+moduleName+"\", 1))\n\n"; vector v = ip.getProperties(); if(v.size() > 0) { @@ -298,3 +298,37 @@ string SALOMEDS_IParameters::getDefaultScript(_PTR(Study) study, return dump; } +string SALOMEDS_IParameters::getStudyScript(_PTR(Study) study, const std::string& theID, int savePoint) +{ + _PTR(AttributeParameter) ap = study->GetCommonParameters(theID, savePoint); + SALOMEDS_IParameters ip(ap); + + ip.setDumpPython(true); //Enable DumpPython of visual parameters for modules. + string dump(""); + + dump += "import iparameters\n"; + dump += "ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters(\""+theID+"\", 1))\n\n"; + + + vector v = ip.getProperties(); + if(v.size() > 0) { + dump += "#Set up visual properties:\n"; + for(int i = 0; i 0) { + dump += "#Set up lists:\n"; + for(int i = 0; i lst = ip.getValues(v[i]); + dump += "# fill list "+v[i]+"\n"; + for(int j = 0; j < lst.size(); j++) + dump += "ipar.append(\""+v[i]+"\", \""+lst[j]+"\")\n"; + } + } + + return dump; +} diff --git a/src/SALOMEDS/SALOMEDS_IParameters.hxx b/src/SALOMEDS/SALOMEDS_IParameters.hxx index e888b8adf..7a5694965 100644 --- a/src/SALOMEDS/SALOMEDS_IParameters.hxx +++ b/src/SALOMEDS/SALOMEDS_IParameters.hxx @@ -135,6 +135,11 @@ public: const std::string& moduleName, const std::string& shift); + /*! + Returns a Python script for the study, which sets up visual parameters + */ + static std::string getStudyScript(_PTR(Study) study, const std::string& theID, int savePoint); + private: _PTR(AttributeParameter) _ap; -- 2.39.2