]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Implementation of the 0022155: EDF 1977 PARAVIS: Add a button "Re-initialize Trace...
authorrnv <rnv@opencascade.com>
Mon, 20 May 2013 06:26:07 +0000 (06:26 +0000)
committerrnv <rnv@opencascade.com>
Mon, 20 May 2013 06:26:07 +0000 (06:26 +0000)
src/PVGUI/PVGUI_Module.cxx
src/PVGUI/PVGUI_Module.h
src/PVGUI/PVGUI_Module_actions.cxx
src/PVGUI/resources/PARAVIS_msg_en.ts

index 12de4d66b8db6de3e824845a5e2d67056ccd3206..88c42baea58ea7f5aa4797f8ff8307d5e394c335 100644 (file)
@@ -1326,6 +1326,9 @@ void PVGUI_Module::contextMenuPopup(const QString& theClient, QMenu* theMenu, QS
   }
 }
 
+/*!
+  \brief. Show ParaView python trace.
+*/
 void PVGUI_Module::onShowTrace()
 {
   if (!myTraceWindow) {
@@ -1337,6 +1340,31 @@ void PVGUI_Module::onShowTrace()
   myTraceWindow->activateWindow();
 }
 
+
+/*!
+  \brief. Re-initialize ParaView python trace.
+*/
+void PVGUI_Module::onRestartTrace()
+{
+  PyInterp_Dispatcher* aDispatcher = PyInterp_Dispatcher::Get();
+  if ( !aDispatcher->IsBusy() ) {
+    pqPythonManager* manager = qobject_cast<pqPythonManager*>
+       ( pqApplicationCore::instance()->manager( "PYTHON_MANAGER" ) );
+    if ( manager )  {
+      pqPythonDialog* pyDiag = manager->pythonShellDialog();
+        if ( pyDiag ) {
+          pqPythonShell* shell = pyDiag->shell();
+            if ( shell ) {
+              QString script = "from paraview import smtrace\n";
+              script += "smtrace.stop_trace()\n";
+              script += "smtrace.start_trace()\n";
+              shell->executeScript(script);
+            }
+        }
+    }
+  }
+}
+
 /*!
   \brief Show ParaView view.
 */
index 15f87ef9f8ed0568afee66c86442501df0b62e18..90c331469d2c7504017045ad88a388b2e37eb4fc 100644 (file)
@@ -113,6 +113,7 @@ class PVGUI_Module : public SalomeApp_Module
         OutputWindowId,
         PythonShellId,
         ShowTraceId,
+        RestartTraceId,
 
         // Menu "Help" 
         AboutParaViewId,
@@ -232,6 +233,7 @@ private slots:
   void onStartProgress();
   void onEndProgress();
   void onShowTrace();
+  void onRestartTrace();
 
   void onNewParaViewWindow();
 
index 3752d6edcd712a4c403609f2d72912d663972adc..ff751c69aec2d09dd4a2aedec5a31ac548b80236 100644 (file)
@@ -373,6 +373,13 @@ void PVGUI_Module::pvCreateActions()
   connect(anAction, SIGNAL(triggered()), this, SLOT(onShowTrace()));
   registerAction(ShowTraceId, anAction);
 
+  //Show Trace
+  anAction = new QAction(tr("MEN_RESTART_TRACE"), this);
+  anAction->setToolTip(tr("TOP_RESTART_TRACE"));
+  anAction->setStatusTip(tr("STB_RESTART_TRACE"));
+  connect(anAction, SIGNAL(triggered()), this, SLOT(onRestartTrace()));
+  registerAction(RestartTraceId, anAction);
+
   // --- Menu "Help"
 
   // About
@@ -521,6 +528,7 @@ void PVGUI_Module::pvCreateMenus()
   createMenu( PythonShellId, aToolsMnu );
   createMenu( separator(), aToolsMnu );
   createMenu( ShowTraceId, aToolsMnu );
+  createMenu( RestartTraceId, aToolsMnu );
 
   // --- Menu "Help"
 
index 9a8bc0d0e0d5e36a8d1ead5218833a12ae3488c3..83fe4e6119e538cff3feff860ea0f0d1dfaf6b41 100644 (file)
         <source>STB_SHOW_TRACE</source>
         <translation>Show Trace</translation>
     </message>
+    <message>
+        <source>MEN_RESTART_TRACE</source>
+        <translation>Re-initialize Trace</translation>
+    </message>
+    <message>
+        <source>TOP_RESTART_TRACE</source>
+        <translation>Re-initialize Trace</translation>
+    </message>
+    <message>
+        <source>STB_RESTART_TRACE</source>
+        <translation>Re-initialize Trace</translation>
+    </message>
 </context>
 <context>
     <name>PVGUI_ViewManager</name>