TCollection_AsciiString aBatchModeScript = "salome";
//Output to the main Study script required Python modules import, set sys.path and add a creation of the study.
+ fp << GetDumpStudyComment().ToCString() << endl << endl;
fp << "import sys" << endl;
fp << "import " << aBatchModeScript << "\n" << endl;
- fp << "sys.path.append(\'" << thePath << "\')\n" << endl;
+ fp << "sys.path.insert( 0, \'" << thePath << "\')\n" << endl;
Handle(TColStd_HSequenceOfAsciiString) aSeqOfFileNames = new TColStd_HSequenceOfAsciiString;
//Iterate all components and create the componponents specific scripts.
+ bool isOk = true;
int aLength = aSeq.Length();
for(int i = 1; i <= aLength; i++) {
bool isValidScript;
long aStreamLength = 0;
unsigned char* aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength);
+ if ( !isValidScript )
+ isOk = false;
//Create a file that will contain the component specific script
fstream fp2;
}
fp.close();
- return true;
+ return isOk;
+}
+
+//=======================================================================
+//function : GetDumpStudyComment
+//purpose : return a header comment for a DumpStudy script
+//=======================================================================
+
+TCollection_AsciiString SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName)
+{
+ TCollection_AsciiString txt
+ ("### This file is generated by SALOME automatically by dump python funcitonality");
+ if ( theComponentName )
+ txt += TCollection_AsciiString(" of ") + (char*) theComponentName + " component";
+ return txt;
}
void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO,