From: vsr Date: Fri, 27 May 2022 11:29:05 +0000 (+0300) Subject: bos #29467 SALOME GUI logger X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fjfa%2F29467_gui_log_file;p=modules%2Fgui.git bos #29467 SALOME GUI logger --- diff --git a/src/CAM/CAM_Application.cxx b/src/CAM/CAM_Application.cxx index d3bfadf17..4c29fd082 100644 --- a/src/CAM/CAM_Application.cxx +++ b/src/CAM/CAM_Application.cxx @@ -458,17 +458,21 @@ bool CAM_Application::activateModule( CAM_Module* mod ) if ( myModule ) { - if ( !myModule->deactivateModule( activeStudy() ) ) + if ( myModule->deactivateModule( activeStudy() ) ) { - // .... - } + logUserEvent( tr( "MODULE_DEACTIVATED" ).arg( myModule->moduleName() ) ); + } } myModule = mod; if ( myModule ){ // Connect the module to the active study myModule->connectToStudy( dynamic_cast( activeStudy() ) ); - if ( !myModule->activateModule( activeStudy() ) ) + if ( myModule->activateModule( activeStudy() ) ) + { + logUserEvent( tr( "MODULE_ACTIVATED" ).arg( myModule->moduleName() ) ); + } + else { myModule->setMenuShown( false ); myModule->setToolShown( false ); diff --git a/src/CAM/resources/CAM_msg_en.ts b/src/CAM/resources/CAM_msg_en.ts index fb54357e4..ca34b81a5 100644 --- a/src/CAM/resources/CAM_msg_en.ts +++ b/src/CAM/resources/CAM_msg_en.ts @@ -35,5 +35,13 @@ OPERATION_APPLIED operation applied + + MODULE_ACTIVATED + Module %1 activated + + + MODULE_DEACTIVATED + Module %1 deactivated + diff --git a/src/CAM/resources/CAM_msg_fr.ts b/src/CAM/resources/CAM_msg_fr.ts index 09e8fecd3..d097cac43 100644 --- a/src/CAM/resources/CAM_msg_fr.ts +++ b/src/CAM/resources/CAM_msg_fr.ts @@ -15,5 +15,33 @@ MODULE_ROOT_OBJECT_TOOLTIP %1 objet-racine du module + + ACTION_TRIGGERED + l'action est déclenchée + + + ACTION_TOGGLED + l'action est basculée + + + ACTION_ON + on + + + ACTION_OFF + off + + + OPERATION_APPLIED + opération appliquée + + + MODULE_ACTIVATED + Module %1 activé + + + MODULE_DEACTIVATED + Module %1 désactivé + diff --git a/src/CAM/resources/CAM_msg_ja.ts b/src/CAM/resources/CAM_msg_ja.ts index c01382392..5d6a11e25 100644 --- a/src/CAM/resources/CAM_msg_ja.ts +++ b/src/CAM/resources/CAM_msg_ja.ts @@ -15,5 +15,33 @@ MODULE_ROOT_OBJECT_TOOLTIP %1 module root object + + ACTION_TRIGGERED + action is triggered + + + ACTION_TOGGLED + action is toggled + + + ACTION_ON + on + + + ACTION_OFF + off + + + OPERATION_APPLIED + operation applied + + + MODULE_ACTIVATED + Module %1 activated + + + MODULE_DEACTIVATED + Module %1 deactivated + diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index 795b8593d..b3c1c6311 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -5107,3 +5107,23 @@ void SalomePyQt::logAction( QAction* action, const QString& moduleName ) }; ProcessVoidEvent( new TEvent( action, moduleName ) ); } + +/*! + \brief Enable/disable action logging. +*/ +void SalomePyQt::setActionLoggingEnabled( bool enabled ) +{ + class TEvent: public SALOME_Event + { + bool myEnabled; + public: + TEvent( bool theEnabled ) : myEnabled( theEnabled ) {} + virtual void Execute() + { + LightApp_Module* module = getActiveModule(); + if ( module ) + module->setActionLoggingEnabled( myEnabled ); + } + }; + ProcessVoidEvent( new TEvent( enabled ) ); +} diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index 7643b2d07..b5015d3e6 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -379,6 +379,7 @@ public: static void logUserEvent( const QString& ); static void logAction( QAction*, const QString& = QString() ); + static void setActionLoggingEnabled( bool ); }; #endif // SALOME_PYQT_H diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index 67c0b5e1c..5c620647b 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -498,4 +498,5 @@ public: static void logUserEvent( const QString& ) /ReleaseGIL/ ; static void logAction( QAction*, const QString& = QString() ) /ReleaseGIL/ ; + static void setActionLoggingEnabled( bool ) /ReleaseGIL/ ; };