From: vsr Date: Tue, 30 Jan 2007 10:09:21 +0000 (+0000) Subject: Improvement NPAL14675: fix a bug: take into account that activate() method can be... X-Git-Tag: V3_2_5pre1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=904775a40411ebbcfd965273db4025f599fd5ef4;p=modules%2Fgui.git Improvement NPAL14675: fix a bug: take into account that activate() method can be not implemented in the Python module --- diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx index 0a83e03d4..3ce9be1fe 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx @@ -169,7 +169,7 @@ SALOME_PYQT_Module::SALOME_PYQT_Module() : SalomeApp_Module( __DEFAULT_NAME__ ), myModule( 0 ), myXmlHandler ( 0 ), - myLastActivateStatus( false ) + myLastActivateStatus( true ) { } @@ -252,6 +252,9 @@ bool SALOME_PYQT_Module::activateModule( SUIT_Study* theStudy ) if ( !res ) return res; + // reset the activation status to the default value + myLastActivateStatus = true; + // ActivateReq: request class for internal activate() operation class ActivateReq : public PyInterp_Request { @@ -830,17 +833,15 @@ void SALOME_PYQT_Module::activate( SUIT_Study* theStudy ) // call Python module's activate() method (for the new modules) if(PyObject_HasAttrString(myModule , "activate")){ 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 ); - } + if ( !res1 || !PyBool_Check( res1 ) ) { + PyErr_Print(); + //= true: for support of old modules + myLastActivateStatus = true; + } + else { + //detect return status + myLastActivateStatus = PyObject_IsTrue( res1 ); + } } }