Fix mixed Python dump of a new and a closed study

This commit is contained in:
eap 2018-08-01 18:41:11 +03:00
parent a8d98187a5
commit 35012b0a3d
3 changed files with 21 additions and 19 deletions

View File

@ -1120,7 +1120,7 @@ bool SMESHGUI_GroupDlg::onApply()
myGroupOnFilter = myMesh->CreateGroupFromFilter(aType, myGroupOnFilter = myMesh->CreateGroupFromFilter(aType,
myName->text().toUtf8(), myName->text().toUtf8(),
myFilter); myFilter);
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter ); resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
isCreation = true; isCreation = true;
} }

View File

@ -4971,6 +4971,9 @@ void SMESH_Gen_i::Close( SALOMEDS::SComponent_ptr theComponent )
// remove the tmp files meshes are loaded from // remove the tmp files meshes are loaded from
SMESH_PreMeshInfo::RemoveStudyFiles_TMP_METHOD( theComponent ); SMESH_PreMeshInfo::RemoveStudyFiles_TMP_METHOD( theComponent );
// Clean trace of API methods calls
CleanPythonTrace();
return; return;
} }

View File

@ -678,33 +678,33 @@ namespace SMESH
cout << "Exception in SMESH_Gen_i::DumpPython(): " << text << endl; cout << "Exception in SMESH_Gen_i::DumpPython(): " << text << endl;
#endif #endif
} }
}
//======================================================================= //=======================================================================
//function : RemoveTabulation //function : RemoveTabulation
//purpose : //purpose :
//======================================================================= //=======================================================================
void RemoveTabulation( TCollection_AsciiString& theScript ) void RemoveTabulation( TCollection_AsciiString& theScript )
{
std::string aString( theScript.ToCString() );
std::string::size_type aPos = 0;
while( aPos < aString.length() )
{ {
aPos = aString.find( "\n\t", aPos ); std::string aString( theScript.ToCString() );
if( aPos == std::string::npos ) std::string::size_type aPos = 0;
break; while( aPos < aString.length() )
aString.replace( aPos, 2, "\n" ); {
aPos++; aPos = aString.find( "\n\t", aPos );
if( aPos == std::string::npos )
break;
aString.replace( aPos, 2, "\n" );
aPos++;
}
theScript = aString.c_str();
} }
theScript = aString.c_str();
} }
//======================================================================= //=======================================================================
//function : DumpPython //function : DumpPython
//purpose : //purpose :
//======================================================================= //=======================================================================
Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Boolean isPublished, Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Boolean isPublished,
CORBA::Boolean isMultiFile, CORBA::Boolean isMultiFile,
CORBA::Boolean& isValidScript) CORBA::Boolean& isValidScript)
{ {
SALOMEDS::Study_var aStudy = getStudyServant(); SALOMEDS::Study_var aStudy = getStudyServant();
@ -995,10 +995,9 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
std::list< TCollection_AsciiString > lines; // lines of a script std::list< TCollection_AsciiString > lines; // lines of a script
std::list< TCollection_AsciiString >::iterator linesIt; std::list< TCollection_AsciiString >::iterator linesIt;
if ( isPublished ) lines.push_back( aSMESHGen + " = smeshBuilder.New()" );
lines.push_back( aSMESHGen + " = smeshBuilder.New()" ); if ( !isPublished )
else lines.push_back( aSMESHGen + ".SetEnablePublish( False )" );
lines.push_back( aSMESHGen + " = smeshBuilder.New(False)" );
lines.push_back( helper + "aFilterManager = " + aSMESHGen + ".CreateFilterManager()" ); lines.push_back( helper + "aFilterManager = " + aSMESHGen + ".CreateFilterManager()" );
lines.push_back( helper + "aMeasurements = " + aSMESHGen + ".CreateMeasurements()" ); lines.push_back( helper + "aMeasurements = " + aSMESHGen + ".CreateMeasurements()" );