From c72d1ab7d481b593432629d52239e8e44e598c44 Mon Sep 17 00:00:00 2001 From: rnv Date: Mon, 20 May 2013 06:26:07 +0000 Subject: [PATCH] Implementation of the 0022155: EDF 1977 PARAVIS: Add a button "Re-initialize Trace" in the menu "Tools" issue. --- src/PVGUI/PVGUI_Module.cxx | 28 +++++++++++++++++++++++++++ src/PVGUI/PVGUI_Module.h | 2 ++ src/PVGUI/PVGUI_Module_actions.cxx | 8 ++++++++ src/PVGUI/resources/PARAVIS_msg_en.ts | 12 ++++++++++++ 4 files changed, 50 insertions(+) diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index 12de4d66..88c42bae 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -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 + ( 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. */ diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index 15f87ef9..90c33146 100644 --- a/src/PVGUI/PVGUI_Module.h +++ b/src/PVGUI/PVGUI_Module.h @@ -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(); diff --git a/src/PVGUI/PVGUI_Module_actions.cxx b/src/PVGUI/PVGUI_Module_actions.cxx index 3752d6ed..ff751c69 100644 --- a/src/PVGUI/PVGUI_Module_actions.cxx +++ b/src/PVGUI/PVGUI_Module_actions.cxx @@ -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" diff --git a/src/PVGUI/resources/PARAVIS_msg_en.ts b/src/PVGUI/resources/PARAVIS_msg_en.ts index 9a8bc0d0..83fe4e61 100644 --- a/src/PVGUI/resources/PARAVIS_msg_en.ts +++ b/src/PVGUI/resources/PARAVIS_msg_en.ts @@ -171,6 +171,18 @@ STB_SHOW_TRACE Show Trace + + MEN_RESTART_TRACE + Re-initialize Trace + + + TOP_RESTART_TRACE + Re-initialize Trace + + + STB_RESTART_TRACE + Re-initialize Trace + PVGUI_ViewManager -- 2.39.2