Additional fix for the issue "16219: EDF PAL 469: "RemoveFromStudy" Function": dump hideInStudy(obj) command in the python script for the unpublished objects

This commit is contained in:
rnv 2011-04-15 08:55:44 +00:00
parent 4ee02ad97e
commit e941da46a5
3 changed files with 28 additions and 0 deletions

View File

@ -727,6 +727,23 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
aScript += anEntryToCmd->second;
}
//RNV: issue 16219: EDF PAL 469: "RemoveFromStudy" Function
//Add unpublish command if need
TCollection_AsciiString unpublishCmd("\n");
if(isMultiFile)
unpublishCmd += "\t";
unpublishCmd += "geompy.hideInStudy(";
for (aStEntry2ObjDataPtrIt = aStEntry2ObjDataPtr.begin();
aStEntry2ObjDataPtrIt != aStEntry2ObjDataPtr.end();
++aStEntry2ObjDataPtrIt)
{
TObjectData* data = aStEntry2ObjDataPtrIt->second;
if ( data->_unpublished && !data->_pyName.IsEmpty() ) {
aScript += unpublishCmd + data->_pyName + ")";
}
}
//aScript += "\n\tpass\n";
aScript += "\n";
aValidScript = true;

View File

@ -48,6 +48,7 @@ struct TObjectData
TCollection_AsciiString _studyEntry;
TCollection_AsciiString _name;
TCollection_AsciiString _pyName;
bool _unpublished;
};
class Handle_TDataStd_HArray1OfByte;

View File

@ -92,6 +92,16 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
objData._name = aName.in();
objData._entry = anEntry.in();
objData._studyEntry = aStudyEntry.in();
//Find Drawable Attribute
SALOMEDS::GenericAttribute_var aGenAttr;
if(aValue->FindAttribute(aGenAttr, "AttributeDrawable") ) {
SALOMEDS::AttributeDrawable_var aDrw = SALOMEDS::AttributeDrawable::_narrow(aGenAttr);
objData._unpublished = !aDrw->IsDrawable();
} else {
objData._unpublished = false;
}
objectDataVec.push_back( objData );
//Find attribute with list of used notebook variables