From: mpv Date: Fri, 7 Feb 2020 14:39:25 +0000 (+0300) Subject: Allow in SHAPERSTUDY python dump to store files in the same folder with the exported... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2a27be80ba84648a6695486524fcd222aab4be26;p=modules%2Fyacs.git Allow in SHAPERSTUDY python dump to store files in the same folder with the exported script. --- diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 9488ca344..74e422e3d 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -644,6 +644,10 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin in boolean isPublished, in boolean isMultiFile) raises(StudyInvalidReference); +/*! \brief Returns the folder of the python script which is currently dumped. +*/ + string GetDumpPath(); + /*! \brief Get an AttributeParameter used to store common parameters for given %theSavePoint. \param theID identifies a common parameters set (Example: "Interface Applicative") diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index b7f8654d3..ce0914533 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -1154,6 +1154,16 @@ CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath, return ret; } +//============================================================================ +/*! Function : GetDumpPath +* Purpose : +*/ +//============================================================================ +char* SALOMEDS_Study_i::GetDumpPath() +{ + return CORBA::string_dup(_impl->GetDumpPath().c_str()); +} + //============================================================================ /*! Function : GetCommonParameters * Purpose : diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index ad39fde89..330f54b7c 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -340,6 +340,8 @@ public: CORBA::Boolean isPublished, CORBA::Boolean isMultiFile); + virtual char* GetDumpPath(); + virtual SALOMEDSImpl_Study* GetImpl() { return _impl; } virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 05fa40fb4..8a31a84d1 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -2151,6 +2151,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const std::string& thePath, _errorCode = std::string("Can't create a file ")+aFileName; return false; } + _dumpPath = thePath; std::stringstream sfp; @@ -2304,9 +2305,18 @@ bool SALOMEDSImpl_Study::DumpStudy(const std::string& thePath, fp.close(); + _dumpPath.clear(); + return isOk; } +// Returns the folder of the python script which is currently dumped +std::string SALOMEDSImpl_Study::GetDumpPath() +{ + return _dumpPath; +} + + //======================================================================= //function : GetDumpStudyComment //purpose : return a header comment for a DumpStudy script diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx index 036c142ae..014c0f7bf 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx @@ -72,6 +72,7 @@ private: SALOMEDSImpl_UseCaseBuilder* _useCaseBuilder; SALOMEDSImpl_AbstractCallback* _notifier; SALOMEDSImpl_AbstractCallback* _genObjRegister; + std::string _dumpPath; // path (folder) to the python file which is currently dumped std::map _mapOfSO; std::map _mapOfSCO; @@ -248,6 +249,9 @@ public: SALOMEDSImpl_DriverFactory* theFactory); static std::string GetDumpStudyComment(const char* theComponentName = 0); + + // Returns the folder of the python script which is currently dumped + std::string GetDumpPath(); virtual DF_Document* GetDocument() { return _doc; }