bool res = false;
if ( !modName.isEmpty() )
{
+ setProperty("activateModule", true);
CAM_Module* mod = module( modName );
if ( !mod )
mod = loadModule( modName );
if ( mod )
res = activateModule( mod );
+ setProperty("activateModule", QVariant());
}
else
res = activateModule( 0 );
if ( !vtype.isEmpty() )
getViewManager( vtype, true );
}
+ else if ( message.toLower().startsWith("register_module_in_study" ) ) {
+ QString moduleName = message.split( sectionSeparator ).last();
+ // Check name of current activating module name in order to avoid ciclik
+ // call because of messages
+ if (!property("activateModule").toBool()) {
+ CAM_Module* mod = module(moduleName);
+ if (!mod)
+ mod = module(moduleTitle(moduleName));
+ if (!mod) {
+ mod = loadModule(moduleName);
+ if (!mod)
+ mod = loadModule(moduleTitle(moduleName));
+ if (mod) {
+ addModule(mod);
+ }
+ }
+ if (mod) {
+ CAM_Study* anActiveStudy = dynamic_cast<CAM_Study*>(activeStudy());
+ if (anActiveStudy) {
+ mod->connectToStudy(anActiveStudy);
+ LightApp_DataModel* aDM = dynamic_cast<LightApp_DataModel*>(mod->dataModel());
+ if(aDM) {
+ aDM->initRootObject();
+ }
+ }
+ }
+ }
+ }
else {
QStringList data = message.split( sectionSeparator );
if ( data.count() > 1 ) {
int groupId() const;
void registerColumn( SUIT_DataBrowser*, const QString&, const int );
void unregisterColumn( SUIT_DataBrowser*, const QString& );
+ //! For initialization of the data model and registration of SComponent when study is created
+ //! but module was not activated.
+ virtual void initRootObject() {};
signals:
void opened();
bool res;
{
SUIT_OverrideCursor wc;
+ ensureShaperIsActivated();
res = appStudy->dump( aFileName, toPublish, isMultiFile, toSaveGUI );
}
if ( !res )
}
#endif // DISABLE_PYCONSOLE
+
+void SalomeApp_Application::ensureShaperIsActivated()
+{
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
+ _PTR(Study) studyDS = getStudy();
+ if ( study && studyDS )
+ {
+ _PTR(SObject) shaper = studyDS->FindObjectByPath("/Shaper"); // non null result if shaper data is present in the study
+ bool shaperIsActive = false;
+ QList<CAM_DataModel*> models;
+ study->dataModels( models );
+ for( int i = 0; i < models.count() && !shaperIsActive; i++ )
+ shaperIsActive = models[i]->module()->moduleName() == "Shaper";
+
+ if (shaper && !shaperIsActive)
+ onDesktopMessage("register_module_in_study/Shaper");
+ }
+}
private:
void createExtraActions();
+ void ensureShaperIsActivated();
private:
#ifndef DISABLE_PYCONSOLE