return QString();
}
+QString HYDROData_Entity::GetObjPyName() const
+{
+ return GetName().replace(" ", "_");
+}
+
void HYDROData_Entity::SetName(const QString& theName)
{
TDataStd_Name::Set(myLab, TCollection_ExtendedString(theName.toLatin1().constData()));
}
QStringList HYDROData_Entity::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+{
+ QStringList anEmptyList;
+ return anEmptyList;
+}
+
+QStringList HYDROData_Entity::dumpObjectCreation( MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList;
return aResList;
QString aDocName = aDocument->GetDocPyName();
- QString aName = GetName();
+ QString aName = GetObjPyName();
aResList << QString( "%1 = %2.CreateObject( %3 );" )
.arg( aName ).arg( aDocName ).arg( getPyTypeID() );
aResList << QString( "%1.SetName( \"%2\" );" )
- .arg( aName ).arg( aName );
+ .arg( aName ).arg( GetName() );
aResList << QString( "" );
return aResList;
if ( theRefObject.IsNull() )
return;
- QString aRefObjName = theRefObject->GetName();
+ QString aRefObjName = theRefObject->GetObjPyName();
if ( aRefObjName.isEmpty() )
return;
if ( anIsToSetObject )
{
+ QString anObjName = GetObjPyName();
theScript << QString( "%1.%2( %3 );" )
- .arg( GetName() ).arg( theMethod ).arg( aRefObjName );
+ .arg( anObjName ).arg( theMethod ).arg( aRefObjName );
}
}
+void HYDROData_Entity::setPythonObjectColor( QStringList& theScript,
+ const QColor& theColor,
+ const QColor& theDefaultColor,
+ const QString& theMethod ) const
+{
+ if ( theColor == theDefaultColor )
+ return; //Do not set the color for object if it like default
+
+ QString anObjName = GetObjPyName();
+ theScript << QString( "%1.%2( QColor( %3, %4, %5, %6 ) );" )
+ .arg( anObjName ).arg( theMethod )
+ .arg( theColor.red() ).arg( theColor.green() )
+ .arg( theColor.blue() ).arg( theColor.alpha() );
+}
+