]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
bos #29467 SALOME GUI logger jfa/29467_gui_log_file
authorvsr <vsr@opencascade.com>
Fri, 27 May 2022 11:29:05 +0000 (14:29 +0300)
committervsr <vsr@opencascade.com>
Fri, 27 May 2022 11:29:05 +0000 (14:29 +0300)
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 d3bfadf1785c88b25a7da8959613a142b391760d..4c29fd082af2a866fa63b5a64834a047a6090d93 100644 (file)
@@ -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<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 795b8593d0050e0ebd70c8e3a3061996e276697e..b3c1c631131c471771c98d2e8875fbb58fe615e7 100644 (file)
@@ -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 ) );
+}
index 7643b2d07f4efa15d30d40132c205a1a4e313b38..b5015d3e6ab1842286ca5dc497d245a7cb186b14 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 67c0b5e1c6b310577b66b82cb6bde23fa09565ec..5c620647bb3447ea05a2d2d56972fdd4c0515791 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/ ;
 };