]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fixed problem with dump study and small optimization:
authorimn <imn@opencascade.com>
Mon, 28 Nov 2016 14:33:53 +0000 (17:33 +0300)
committerimn <imn@opencascade.com>
Mon, 28 Nov 2016 14:33:53 +0000 (17:33 +0300)
- Remove parameter "theStudy" in python function "RebuildData()"
- Remove NoteBook repeated initialization after DumpStudy
("import salome_notebook" first time initialization notebook)

idl/SALOME_Component.idl
src/Container/Component_i.cxx
src/Container/SALOME_ComponentPy.py
src/Container/SALOME_Component_i.hxx
src/ParallelContainer/SALOME_ParallelComponent_i.cxx
src/ParallelContainer/SALOME_ParallelComponent_i.hxx
src/SALOMEDS/SALOMEDS_Driver_i.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx

index c18277c905c8435b3dffb8d83b64cf7e0f976476..ff1e97141383bbfc7b1dbe1e43107d5ad2c6af13 100644 (file)
@@ -336,8 +336,7 @@ module Engines
       Returns a python script, which is being played back reproduces
       the data model of component
     */
-    TMPFile DumpPython(in Object theStudy,
-                       in boolean isPublished,
+    TMPFile DumpPython(in boolean isPublished,
                        in boolean isMultiFile,
                        out boolean isValidScript);
 
index 7857a5d1034f5fc0c196f913e5eb7a11deaf79b7..6b4676f05d313009b87bb505dfbee41639713ac3 100644 (file)
@@ -869,12 +869,11 @@ std::string Engines_Component_i::GetDynLibraryName(const char *componentName)
  */
 //=============================================================================
 
-Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Object_ptr theStudy,
-                                                  CORBA::Boolean isPublished,
+Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Boolean isPublished,
                                                   CORBA::Boolean isMultiFile,
                                                   CORBA::Boolean& isValidScript)
 {
-  const char* aScript = isMultiFile ? "def RebuildData(theStudy): pass" : "";
+  const char* aScript = isMultiFile ? "def RebuildData(): pass" : "";
   char* aBuffer = new char[strlen(aScript)+1];
   strcpy(aBuffer, aScript);
   CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
index 89d1ab0aaa0ce2ef8f6a0daa353b4ecd80eec5ee..e02ed1b3086dab6fca1b397dc3c6ffa982a084a3 100755 (executable)
@@ -292,10 +292,10 @@ class SALOME_ComponentPy_i (Engines__POA.EngineComponent):
 
     #-------------------------------------------------------------------------
 
-    def DumpPython(self, theStudy, isPublished, isMultiFile):
+    def DumpPython(self, isPublished, isMultiFile):
         aBuffer = "\0"
         if isMultiFile :
-            aBuffer = "def RebuildData(theStudy): pass\n\0"
+            aBuffer = "def RebuildData(): pass\n\0"
         return (aBuffer, 1)
 
     #-------------------------------------------------------------------------
index a69339168142d4503315a0f8405f4b58d9e50c5b..ca1f7cf4f3a546432f2b1b252f8b33fa27fe12e9 100644 (file)
@@ -96,8 +96,7 @@ public:
   bool Resume_impl();
   CORBA::Long CpuUsed_impl() ;
 
-  virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
-                                       CORBA::Boolean isPublished,
+  virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
                                        CORBA::Boolean isMultiFile,
                                        CORBA::Boolean& isValidScript);
 
index 112132bab75a5f413a5963561b2cc197bf544450..597ef48cca3d61dce9429d4c056a0c49b4cf5f09 100644 (file)
@@ -802,12 +802,11 @@ std::string Engines_Parallel_Component_i::GetDynLibraryName(const char *componen
  */
 //=============================================================================
 
-Engines::TMPFile* Engines_Parallel_Component_i::DumpPython(CORBA::Object_ptr theStudy, 
-                                                           CORBA::Boolean isPublished, 
+Engines::TMPFile* Engines_Parallel_Component_i::DumpPython(CORBA::Boolean isPublished,
                                                            CORBA::Boolean isMultiFile,
                                                            CORBA::Boolean& isValidScript)
 {
-  const char* aScript = isMultiFile ? "def RebuildData(theStudy): pass" : "";
+  const char* aScript = isMultiFile ? "def RebuildData(): pass" : "";
   char* aBuffer = new char[strlen(aScript)+1];
   strcpy(aBuffer, aScript);
   CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
index d7bcbf38dae46f178912de02c8f7d984fc2174b7..98fe0e9ea96bd7501fee3461340363b2bdd1f860 100644 (file)
@@ -92,8 +92,7 @@ public:
   bool Resume_impl();
   CORBA::Long CpuUsed_impl() ;
 
- virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
-                                      CORBA::Boolean isPublished,
+ virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
                                       CORBA::Boolean isMultiFile,
                                       CORBA::Boolean& isValidScript);
 
index 488b07f74a9d4fa87aa5c6fd111c63070a5e5351..04469f922adc464f1a2dc28451e461a33feb87c2 100644 (file)
@@ -332,7 +332,7 @@ SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(bool isPublished,
   CORBA::Boolean aValidScript = true; // VSR: maybe should be false by default ???
 
   if ( !CORBA::is_nil( _engine ) )
-    aStream = _engine->DumpPython(st.in(), isPublished, isMultiFile, aValidScript);
+    aStream = _engine->DumpPython(isPublished, isMultiFile, aValidScript);
 
   SALOMEDSImpl_TMPFile* aTMPFile = new Engines_TMPFile_i(aStream._retn());
   theStreamLength = aTMPFile->Size();
index a9fae3dae14faf9dbeb30d0cc4950f6f98837b05..dd39cc41a8bc87b694fc2375f52771af05568ca8 100644 (file)
@@ -2049,11 +2049,9 @@ std::string SALOMEDSImpl_Study::_GetStudyVariablesScript()
  *  Purpose  :
  */
 //============================================================================
-std::string SALOMEDSImpl_Study::_GetNoteBookAccess(const std::string& theStudyVar)
+std::string SALOMEDSImpl_Study::_GetNoteBookAccess()
 {
-  std::string notebook = "import salome_notebook\n";
-  notebook += _GetNoteBookAccessor() + " = salome_notebook.NoteBook(" + theStudyVar + ")" ;
-  return notebook;
+  return std::string("import salome_notebook\n");
 }
 
 bool SALOMEDSImpl_Study::IsLocked()
@@ -2368,15 +2366,11 @@ bool SALOMEDSImpl_Study::DumpStudy(const std::string& thePath,
   sfp << "import sys" << std::endl;
   sfp << "import " << aBatchModeScript << std::endl << std::endl;
 
-  std::string aStudyVar = "salome.myStudy";
   // initialization function
   sfp << aBatchModeScript << ".salome_init()" << std::endl;
-  if ( !isMultiFile ) {
-    sfp << "theStudy = " << aStudyVar << std::endl << std::endl;
-    aStudyVar = "theStudy";
-  }
+
   // notebook initialization
-  sfp << _GetNoteBookAccess(aStudyVar) << std::endl;
+  sfp << _GetNoteBookAccess() << std::endl;
 
   // extend sys.path with the directory where the script is being dumped to
   sfp << "sys.path.insert( 0, r\'" << thePath << "\')" << std::endl << std::endl;
@@ -2484,7 +2478,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const std::string& thePath,
 
       //Add to the main script a call to RebuildData of the generated by the component the Python script
       sfp << "import " << aScriptName << std::endl;
-      sfp << aScriptName << ".RebuildData(" << aBatchModeScript << ".myStudy)" << std::endl;
+      sfp << aScriptName << ".RebuildData()" << std::endl;
     }
     else
       sfp << sfp2.str();
index bd8f55faf9b491937c06c28a5e69d892c6adf346..297a3c738259799ca246070d58fd56ea54e7c7b6 100644 (file)
@@ -89,7 +89,7 @@ private:
 
   std::string _GetStudyVariablesScript();
   std::string _GetNoteBookAccessor();
-  std::string _GetNoteBookAccess(const std::string& theStudyVar);
+  std::string _GetNoteBookAccess();
 
 public: