return true;
if ( myModule )
- myModule->deactivateModule( activeStudy() );
-
+ {
+ if ( !myModule->deactivateModule( activeStudy() ) )
+ {
+ // ....
+ }
+ }
myModule = mod;
if ( myModule ){
prev = dm;
}
}
- myModule->activateModule( activeStudy() );
+ if ( !myModule->activateModule( activeStudy() ) )
+ {
+ myModule->setMenuShown( false );
+ myModule->setToolShown( false );
+ SUIT_MessageBox::error1( desktop(), tr( "ERROR_TLT" ), tr( "ERROR_ACTIVATE_MODULE_MSG" ).arg( myModule->moduleName() ), tr( "BUT_OK" ) );
+ myModule = 0;
+ return false;
+ }
}
updateCommandsStatus();
return myApp;
}
-void CAM_Module::activateModule( SUIT_Study* study )
+bool CAM_Module::activateModule( SUIT_Study* study )
{
+ return true;
}
-void CAM_Module::deactivateModule( SUIT_Study* )
+bool CAM_Module::deactivateModule( SUIT_Study* )
{
+ return true;
}
void CAM_Module::studyClosed( SUIT_Study* study )
virtual void updateCommandsStatus() {};
public slots:
- virtual void activateModule( SUIT_Study* );
- virtual void deactivateModule( SUIT_Study* );
+ virtual bool activateModule( SUIT_Study* );
+ virtual bool deactivateModule( SUIT_Study* );
virtual void studyClosed( SUIT_Study* );
virtual void studyChanged( SUIT_Study*, SUIT_Study* );
* Activation of the module.
* Inherited from CAM_Module.
*/
-void SALOME_PYQT_Module::activateModule( SUIT_Study* theStudy )
+bool SALOME_PYQT_Module::activateModule( SUIT_Study* theStudy )
{
MESSAGE( "SALOME_PYQT_Module::activateModule" );
- SalomeApp_Module::activateModule( theStudy );
+ bool res = SalomeApp_Module::activateModule( theStudy );
+
+ if ( !res )
+ return res;
// activate menus, toolbars, etc
setMenuShown( true );
// connect desktop activation signal
connect( application()->desktop(), SIGNAL( activated() ), this, SLOT( onDesktopActivated() ) );
+
+ return true;
}
/*!
* Deactivation of the module.
* Inherited from CAM_Module.
*/
-void SALOME_PYQT_Module::deactivateModule( SUIT_Study* theStudy )
+bool SALOME_PYQT_Module::deactivateModule( SUIT_Study* theStudy )
{
MESSAGE( "SALOME_PYQT_Module::deactivateModule" );
- SalomeApp_Module::deactivateModule( theStudy );
+ bool res = SalomeApp_Module::deactivateModule( theStudy );
// deactivate menus, toolbars, etc
setMenuShown( false );
// disconnect desktop activation signal
disconnect( application()->desktop(), SIGNAL( activated() ), this, SLOT( onDesktopActivated() ) );
+
+ return res;
}
/*!
public slots:
/* activation */
- void activateModule( SUIT_Study* );
+ virtual bool activateModule( SUIT_Study* );
/* deactivation */
- void deactivateModule( SUIT_Study* );
+ virtual bool deactivateModule( SUIT_Study* );
/******************************
* Internal methods
resMgr->raiseTranslators( name() );
}
-void SalomeApp_Module::activateModule( SUIT_Study* study )
+bool SalomeApp_Module::activateModule( SUIT_Study* study )
{
- CAM_Module::activateModule( study );
+ bool res = CAM_Module::activateModule( study );
- if ( application() && application()->resourceMgr() )
+ if ( res && application() && application()->resourceMgr() )
application()->resourceMgr()->raiseTranslators( name() );
+
+ return res;
}
-void SalomeApp_Module::deactivateModule( SUIT_Study* )
+bool SalomeApp_Module::deactivateModule( SUIT_Study* )
{
+ return true;
}
void SalomeApp_Module::selectionChanged()
virtual void selectionChanged();
public slots:
- virtual void activateModule( SUIT_Study* );
- virtual void deactivateModule( SUIT_Study* );
+ virtual bool activateModule( SUIT_Study* );
+ virtual bool deactivateModule( SUIT_Study* );
void MenuItem();
protected slots: