Salome HOME
bos #29467 SALOME GUI logger
authorPascal Obry <pascal.obry@edf.fr>
Thu, 9 Feb 2023 12:12:14 +0000 (13:12 +0100)
committerPascal Obry <pascal.obry@edf.fr>
Tue, 5 Sep 2023 09:36:26 +0000 (11:36 +0200)
src/CAM/CAM_Application.cxx
src/CAM/resources/CAM_msg_en.ts
src/CAM/resources/CAM_msg_fr.ts
src/CAM/resources/CAM_msg_ja.ts
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx
src/SALOME_PYQT/SalomePyQt/SalomePyQt.h
src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip

index 1473f6ff2e013c428c40992afcc4c3041e867e06..2735234a15bb57f95225e4117abe27236d97fff1 100644 (file)
@@ -464,9 +464,9 @@ bool CAM_Application::activateModule( CAM_Module* mod )
 
   if ( myModule )
   {
-    if ( !myModule->deactivateModule( activeStudy() ) )
+    if ( myModule->deactivateModule( activeStudy() ) )
     {
-      // ???
+      logUserEvent( tr( "MODULE_DEACTIVATED" ).arg( myModule->moduleName() ) );
     }
     moduleDeactivated( myModule );
   }
@@ -476,7 +476,11 @@ bool CAM_Application::activateModule( CAM_Module* mod )
   {
     // Connect the module to the active study
     myModule->connectToStudy( dynamic_cast<CAM_Study*>( activeStudy() ) );
-    if ( !myModule->activateModule( activeStudy() ) )
+    if ( myModule->activateModule( activeStudy() ) )
+    {
+      logUserEvent( tr( "MODULE_ACTIVATED" ).arg( myModule->moduleName() ) );
+    }
+    else
     {
       myModule->setMenuShown( false );
       myModule->setToolShown( false );
index fb54357e4d9f608896819db0a746d1ad6387d767..ca34b81a5a4aaf1d55e56c3ea4f3566afa2259ac 100644 (file)
         <source>OPERATION_APPLIED</source>
         <translation>operation applied</translation>
     </message>
+    <message>
+        <source>MODULE_ACTIVATED</source>
+        <translation>Module %1 activated</translation>
+    </message>
+    <message>
+        <source>MODULE_DEACTIVATED</source>
+        <translation>Module %1 deactivated</translation>
+    </message>
 </context>
 </TS>
index 09e8fecd3f7bbfdc1a095a77f9175cfede092c7d..d097cac4352e8cfb10b2e9108085b35c2254d9ed 100644 (file)
         <source>MODULE_ROOT_OBJECT_TOOLTIP</source>
         <translation>%1 objet-racine du module</translation>
     </message>
+    <message>
+        <source>ACTION_TRIGGERED</source>
+        <translation>l&apos;action est déclenchée</translation>
+    </message>
+    <message>
+        <source>ACTION_TOGGLED</source>
+        <translation>l&apos;action est basculée</translation>
+    </message>
+    <message>
+        <source>ACTION_ON</source>
+        <translation>on</translation>
+    </message>
+    <message>
+        <source>ACTION_OFF</source>
+        <translation>off</translation>
+    </message>
+    <message>
+        <source>OPERATION_APPLIED</source>
+        <translation>opération appliquée</translation>
+    </message>
+    <message>
+        <source>MODULE_ACTIVATED</source>
+        <translation>Module %1 activé</translation>
+    </message>
+    <message>
+        <source>MODULE_DEACTIVATED</source>
+        <translation>Module %1 désactivé</translation>
+    </message>
 </context>
 </TS>
index c013823929552277094f2d3bb670aab8cc502bcd..5d6a11e2539e819ff04ec91bca7604cc65cba1b8 100644 (file)
       <source>MODULE_ROOT_OBJECT_TOOLTIP</source>
       <translation>%1 module root object</translation>
     </message>
+    <message>
+        <source>ACTION_TRIGGERED</source>
+        <translation>action is triggered</translation>
+    </message>
+    <message>
+        <source>ACTION_TOGGLED</source>
+        <translation>action is toggled</translation>
+    </message>
+    <message>
+        <source>ACTION_ON</source>
+        <translation>on</translation>
+    </message>
+    <message>
+        <source>ACTION_OFF</source>
+        <translation>off</translation>
+    </message>
+    <message>
+        <source>OPERATION_APPLIED</source>
+        <translation>operation applied</translation>
+    </message>
+    <message>
+        <source>MODULE_ACTIVATED</source>
+        <translation>Module %1 activated</translation>
+    </message>
+    <message>
+        <source>MODULE_DEACTIVATED</source>
+        <translation>Module %1 deactivated</translation>
+    </message>
   </context>
 </TS>
index 25efe528da1fd8165f57e18b5424be241d771667..9d990cc115408f35253aa7c37000d8445270b936 100644 (file)
@@ -5144,3 +5144,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 ) );
+}
index 38a3801febaf88ba58f50ceed3e2c6e3a149aa61..6aebda770b242ba561cd01c414c3324c5bdad14b 100644 (file)
@@ -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
index 6f6d5fc37c29fc116d09f2bd40499dffcf908d4c..7d314c7f4b662fc1315e1916eaf1b552d5f1b1d4 100644 (file)
@@ -498,4 +498,5 @@ public:
 
   static void              logUserEvent( const QString& ) /ReleaseGIL/ ;
   static void              logAction( QAction*, const QString& = QString() ) /ReleaseGIL/ ;
+  static void              setActionLoggingEnabled( bool ) /ReleaseGIL/ ;
 };