SALOME_PYQT_Module::SALOME_PYQT_Module()
: SalomeApp_Module( __DEFAULT_NAME__ ),
myModule( 0 ),
- myXmlHandler ( 0 )
+ myXmlHandler ( 0 ),
+ myLastActivateStatus( false )
{
}
// Posting the request
PyInterp_Dispatcher::Get()->Exec( new ActivateReq( theStudy, this ) );
+ if ( !lastActivationStatus() )
+ return false;
+
// activate menus, toolbars, etc
setMenuShown( true );
setToolShown( true );
return SalomeApp_Module::deactivateModule( theStudy );
}
+/*!
+ * Returns the status of last trying of module activation.
+ * Before fisrt activation - status is false
+*/
+bool SALOME_PYQT_Module::lastActivationStatus() const
+{
+ return myLastActivateStatus;
+}
+
/*!
Preferences changing (application) - called when preference is changed
*/
// call Python module's activate() method (for the new modules)
if(PyObject_HasAttrString(myModule , "activate")){
- PyObjWrapper res1( PyObject_CallMethod( myModule, "activate", "" ) );
- if( !res1 ) {
- PyErr_Print();
- }
+ PyObject* res1 = PyObject_CallMethod( myModule, "activate", "" );
+ if( !res1 || !PyBool_Check( res1 ) )
+ {
+ PyErr_Print();
+ //= true: for support of old modules
+ myLastActivateStatus = true;
+ }
+ else
+ {
+ //detect return status
+ myLastActivateStatus = PyObject_IsTrue( res1 );
+ }
}
}
QMap<int, int> myWindowsMap;
/* compatible view managers list */
QStringList myViewMgrList;
+
+ /* status of last trying of module activation*/
+ bool myLastActivateStatus;
/******************************
* Construction/destruction
void init ( CAM_Application* );
/* internal activation */
void activate ( SUIT_Study* );
+
+ /* getting status of last module activation */
+ bool lastActivationStatus() const;
+
/* internal deactivation */
void deactivate ( SUIT_Study* );
/* customization */