#include "PVGUI_ViewManager.h"
#include "PVGUI_ViewWindow.h"
#include "PVGUI_Tools.h"
-#include "PVGUI_ParaViewSettingsPane.h"
+//#include "PVGUI_ParaViewSettingsPane.h"
#include "PVGUI_OutputWindowAdapter.h"
#include <SUIT_DataBrowser.h>
#include <pqCollaborationBehavior.h>
#include <pqDataRepresentation.h>
#include <pqPipelineRepresentation.h>
-#include <pqLookupTableManager.h>
+//#include <pqLookupTableManager.h>
#include <pqDisplayColorWidget.h>
#include <pqColorToolbar.h>
#include <pqScalarBarVisibilityReaction.h>
#include <pqStandardPropertyWidgetInterface.h>
+#include <pqStandardViewFrameActionsImplementation.h>
#include <pqViewStreamingBehavior.h>
#include <PARAVIS_version.h>
#include <pqCrashRecoveryBehavior.h>
#include <pqDataTimeStepBehavior.h>
#include <pqDefaultViewBehavior.h>
-#include <pqDeleteBehavior.h>
#include <pqObjectPickingBehavior.h>
#include <pqPersistentMainWindowStateBehavior.h>
#include <pqPipelineContextMenuBehavior.h>
#include <pqPluginActionGroupBehavior.h>
#include <pqPluginDockWidgetsBehavior.h>
#include <pqPluginManager.h>
-#include <pqPVNewSourceBehavior.h>
#include <pqSpreadSheetVisibilityBehavior.h>
-#include <pqStandardViewModules.h>
#include <pqUndoRedoBehavior.h>
-#include <pqViewFrameActionsBehavior.h>
#include <pqServerManagerObserver.h>
+#include <pqVerifyRequiredPluginBehavior.h>
+#include <pqFixPathsInStateFilesBehavior.h>
+#include <pqPluginSettingsBehavior.h>
+#include <pqPropertiesPanel.h>
+
+#include <pqApplyBehavior.h>
#include <vtkClientServerInterpreterInitializer.h>
+// Trace related
+#include <vtkNew.h>
+#include <vtkSMTrace.h>
+#include <vtkSMSessionProxyManager.h>
+#include <vtkSMParaViewPipelineController.h>
//----------------------------------------------------------------------------
pqPVApplicationCore* PVGUI_Module::MyCoreApp = 0;
//pqPluginManager* pgm = pqApplicationCore::instance()->getPluginManager();
pqInterfaceTracker* pgm = pqApplicationCore::instance()->interfaceTracker();
- // * adds support for standard paraview views.
- pgm->addInterface(new pqStandardViewModules(pgm));
- //pgm->addInterface(new pqStandardSummaryPanelImplementation(pgm));
+ // Register standard types of property widgets.
pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm));
+ // Register standard types of view-frame actions.
+ pgm->addInterface(new pqStandardViewFrameActionsImplementation(pgm));
// Load plugins distributed with application.
pqApplicationCore::instance()->loadDistributedPlugins();
// Define application behaviors.
//new pqQtMessageHandlerBehavior(this);
new pqDataTimeStepBehavior(this);
- new pqViewFrameActionsBehavior(this);
new pqSpreadSheetVisibilityBehavior(this);
new pqPipelineContextMenuBehavior(this);
- new pqObjectPickingBehavior(this); // NEW in 4.1
+ new pqObjectPickingBehavior(this);
new pqDefaultViewBehavior(this);
- new pqAlwaysConnectedBehavior(this);
- new pqPVNewSourceBehavior(this);
- new pqDeleteBehavior(this);
new pqUndoRedoBehavior(this);
+ new pqAlwaysConnectedBehavior(this);
new pqCrashRecoveryBehavior(this);
new pqAutoLoadPluginXMLBehavior(this);
new pqPluginDockWidgetsBehavior(aDesktop);
- //new pqVerifyRequiredPluginBehavior(this);
+ new pqVerifyRequiredPluginBehavior(this);
new pqPluginActionGroupBehavior(aDesktop);
- //new pqFixPathsInStateFilesBehavior(this);
+ new pqFixPathsInStateFilesBehavior(this);
new pqCommandLineOptionsBehavior(this);
new pqPersistentMainWindowStateBehavior(aDesktop);
- new pqObjectPickingBehavior(aDesktop);
new pqCollaborationBehavior(this);
- //new pqMultiServerBehavior(this);
new pqViewStreamingBehavior(this);
+ new pqPluginSettingsBehavior(this);
+
+ pqApplyBehavior* applyBehavior = new pqApplyBehavior(this);
+ foreach (pqPropertiesPanel* ppanel, aDesktop->findChildren<pqPropertiesPanel*>())
+ {
+ applyBehavior->registerPanel(ppanel);
+ }
+
// Setup quick-launch shortcuts.
QShortcut *ctrlSpace = new QShortcut(Qt::CTRL + Qt::Key_Space, aDesktop);
}
// Find Plugin Menus
- QList<QMenu*> currentMenus = aDesktop->findChildren<QMenu*>();
- QList<QMenu*>::iterator im;
- for (im = currentMenus.begin(); im != currentMenus.end(); ++im) {
- if(!activeMenus.contains(*im)) {
- myMenus.append(*im);
- }
- }
+ // [ABN] TODO: fix this - triggers a SEGFAULT at deactivation() time.
+// QList<QMenu*> currentMenus = aDesktop->findChildren<QMenu*>();
+// QList<QMenu*>::iterator im;
+// for (im = currentMenus.begin(); im != currentMenus.end(); ++im) {
+// if(!activeMenus.contains(*im)) {
+// QString s = (*im)->title();
+// std::cout << " MENU "<< s.toStdString() << std::endl;
+// myMenus.append(*im);
+// }
+// }
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
QString aPath = resMgr->stringValue("resources", "PARAVIS", QString());
}
void PVGUI_Module::onDataRepresentationCreated(pqDataRepresentation* data) {
- if(!data)
- return;
-
- if(!data->getLookupTable())
- return;
-
- SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
- if(!aResourceMgr)
- return;
-
- bool visible = aResourceMgr->booleanValue( "PARAVIS", "show_color_legend", false );
- pqLookupTableManager* lut_mgr = pqApplicationCore::instance()->getLookupTableManager();
-
- if(lut_mgr) {
- lut_mgr->setScalarBarVisibility(data,visible);
- }
-
- connect(data, SIGNAL(dataUpdated()), this, SLOT(onDataRepresentationUpdated()));
+// if(!data)
+// return;
+//
+// if(!data->getLookupTable())
+// return;
+//
+// SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+// if(!aResourceMgr)
+// return;
+//
+// bool visible = aResourceMgr->booleanValue( "PARAVIS", "show_color_legend", false );
+// pqLookupTableManager* lut_mgr = pqApplicationCore::instance()->getLookupTableManager();
+//
+// if(lut_mgr) {
+// lut_mgr->setScalarBarVisibility(data,visible);
+// }
+//
+// connect(data, SIGNAL(dataUpdated()), this, SLOT(onDataRepresentationUpdated()));
}
void PVGUI_Module::onDataRepresentationUpdated() {
}
}
-void PVGUI_Module::execPythonCommand(const QString& cmd, bool inSalomeConsole)
-{
- if ( inSalomeConsole ) {
- if ( PyInterp_Dispatcher::Get()->IsBusy() ) return;
- SalomeApp_Application* app =
- dynamic_cast< SalomeApp_Application* >(SUIT_Session::session()->activeApplication());
- PyConsole_Console* pyConsole = app->pythonConsole();
- if (pyConsole)
- pyConsole->exec(cmd);
- }
- else
- {
- pqPythonManager* manager = qobject_cast<pqPythonManager*>
- ( pqApplicationCore::instance()->manager( "PYTHON_MANAGER" ) );
- if ( manager )
- {
- pqPythonDialog* pyDiag = manager->pythonShellDialog();
- if ( pyDiag )
- {
- pqPythonShell* shell = pyDiag->shell();
- if ( shell ) {
- shell->executeScript(cmd);
- }
- }
- }
- }
-}
-
/*!
\brief Launches a tracing of current server
*/
void PVGUI_Module::timerEvent(QTimerEvent* te )
{
-#ifndef WNT
- if ( PyInterp_Dispatcher::Get()->IsBusy() )
- {
- // Reschedule for later
- MESSAGE("interpreter busy -> rescheduling trace start.");
- startTimer(500);
- }
- else
- {
+//#ifndef WNT
+// if ( PyInterp_Dispatcher::Get()->IsBusy() )
+// {
+// // Reschedule for later
+// MESSAGE("interpreter busy -> rescheduling trace start.");
+// startTimer(500);
+// }
+// else
+// {
MESSAGE("about to start trace....");
- execPythonCommand("from paraview import smtrace;smtrace.start_trace()", false);
+ startTrace();
MESSAGE("trace STARTED....");
- }
+// }
killTimer( te->timerId() );
-#endif
+//#endif
}
/*!
pqLoadDataReaction::loadData(aFiles);
}
+/**!
+ * Start trace invoking the newly introduced C++ API (PV 4.2)
+ * (inspired from pqTraceReaction::start())
+ */
+void PVGUI_Module::startTrace()
+{
+ vtkSMSessionProxyManager* pxm = pqActiveObjects::instance().activeServer()->proxyManager();
+
+ vtkSmartPointer<vtkSMProxy> proxy;
+ proxy.TakeReference(pxm->NewProxy("pythontracing", "PythonTraceOptions"));
+ if (proxy)
+ {
+ vtkNew<vtkSMParaViewPipelineController> controller;
+ controller->InitializeProxy(proxy);
+ }
+ vtkSMTrace* trace = vtkSMTrace::StartTrace();
+ if (proxy)
+ {
+ // Set manually the properties entered via the dialog box poping-up when requiring
+ // a trace start in PV4.2 (trace options)
+ trace->SetPropertiesToTraceOnCreate(vtkSMTrace::RECORD_USER_MODIFIED_PROPERTIES);
+ trace->SetFullyTraceSupplementalProxies(false);
+ }
+}
+
+void PVGUI_Module::stopTrace()
+{
+ vtkSMTrace::StopTrace();
+}
+
void PVGUI_Module::executeScript(const char *script)
{
#ifndef WNT
static const QString MYReplaceImportStr("except: from pvsimple import *");
QString PVGUI_Module::getTraceString()
{
- QString traceString;
-#ifndef WNT
- {
- PyLockWrapper lck; // Acquire GIL
-
- const char * code = "from paraview import smtrace;"
- "__smtraceString = smtrace.get_trace_string()";
- PyRun_SimpleString(code);
- // Now get the value of __smtraceString
- PyObject* main_module = PyImport_AddModule((char*)"__main__");
- PyObject* global_dict = PyModule_GetDict(main_module);
- PyObject* string_object = PyDict_GetItemString(global_dict, "__smtraceString");
- char* string_ptr = string_object ? PyString_AsString(string_object) : 0;
- if (string_ptr) {
- traceString = string_ptr;
- }
- } // release GIL
+ vtkSMTrace *tracer = vtkSMTrace::GetActiveTracer();
+ if (!tracer) // trace is not started
+ return QString("");
+ QString traceString(tracer->GetCurrentTrace());
+
+ // Replace import "paraview.simple" by "pvsimple"
if ((!traceString.isNull()) && traceString.length() != 0) {
int aPos = traceString.indexOf(MYReplaceStr);
while (aPos != -1) {
traceString = traceString.replace(aImportPos, MYReplaceImportStr.length(), "except:\n import pvsimple\n from pvsimple import *");
}
}
-#endif
+
return traceString;
}
SalomeApp_Study* activeStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
if(!activeStudy) return;
- // get SALOMEDS client study
+ // get SALOMEDS client study
_PTR(Study) aStudy = activeStudy->studyDS();
if(!aStudy) return;
void PVGUI_Module::createPreferences()
{
// Paraview settings tab
- int aParaViewSettingsTab = addPreference( tr( "TIT_PVIEWSETTINGS" ) );
- int aPanel = addPreference(QString(), aParaViewSettingsTab, LightApp_Preferences::UserDefined, "PARAVIS", "");
- setPreferenceProperty(aPanel, "content", (qint64)(new PVGUI_ParaViewSettingsPane()));
+// int aParaViewSettingsTab = addPreference( tr( "TIT_PVIEWSETTINGS" ) );
+// int aPanel = addPreference(QString(), aParaViewSettingsTab, LightApp_Preferences::UserDefined, "PARAVIS", "");
+// setPreferenceProperty(aPanel, "content", (qint64)(new PVGUI_ParaViewSettingsPane()));
// Paravis settings tab
int aParaVisSettingsTab = addPreference( tr( "TIT_PVISSETTINGS" ) );
*/
void PVGUI_Module::onRestartTrace()
{
- QString script = "from paraview import smtrace\n";
- script += "smtrace.stop_trace()\n";
- script += "smtrace.start_trace()\n";
- execPythonCommand(script, false);
+ stopTrace();
+ startTrace();
}
/*!
#include <pqMultiBlockInspectorPanel.h>
#include <pqProgressWidget.h>
#include <pqProgressManager.h>
-#include <pqObjectInspectorWidget.h>
-#include <pqDisplayProxyEditorWidget.h>
+//#include <pqDisplayProxyEditorWidget.h>
+#include <pqPropertiesPanel.h>
-#include <pqAlwaysConnectedBehavior.h>
#include <pqApplicationCore.h>
-#include <pqAutoLoadPluginXMLBehavior.h>
-#include <pqCommandLineOptionsBehavior.h>
-#include <pqCrashRecoveryBehavior.h>
-#include <pqDataTimeStepBehavior.h>
-#include <pqDefaultViewBehavior.h>
-#include <pqDeleteBehavior.h>
-#include <pqPersistentMainWindowStateBehavior.h>
-#include <pqPluginActionGroupBehavior.h>
-#include <pqPluginDockWidgetsBehavior.h>
#include <pqPluginManager.h>
-#include <pqPVNewSourceBehavior.h>
-#include <pqSpreadSheetVisibilityBehavior.h>
-#include <pqStandardViewModules.h>
-#include <pqUndoRedoBehavior.h>
-#include <pqViewFrameActionsBehavior.h>
#include <pqParaViewMenuBuilders.h>
#include <pqCollaborationPanel.h>
#include <pqMemoryInspectorPanel.h>
/*!
\brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc.
- ParaView pqMainWIndowCore class is fully responsible for these dock widgets' contents.
+ ParaView pqMainWindowCore class is fully responsible for these dock widgets' contents.
+ ==> To update this function, see the reference set up of ParaView in Application/Paraview/ParaviewMainWindow.ui
*/
void PVGUI_Module::setupDockWidgets()
{
pipelineBrowserDock->setWidget(browser);
myDockWidgets[pipelineBrowserDock] = true;
- //Object inspector
- QDockWidget* objectInspectorDock = new QDockWidget( tr( "TTL_OBJECT_INSPECTOR" ), desk );
- objectInspectorDock->setObjectName("objectInspectorDock");
- objectInspectorDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
- desk->addDockWidget( Qt::LeftDockWidgetArea, objectInspectorDock );
+ // Properties dock (previously called OBJECT_INSPECTOR)
+ QDockWidget* propertiesDock = new QDockWidget( tr( "TTL_OBJECT_INSPECTOR" ), desk );
+ propertiesDock->setObjectName("propertiesDock");
+ propertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
+ desk->addDockWidget( Qt::LeftDockWidgetArea, propertiesDock );
- pqObjectInspectorWidget* objectInspectorWidget = new pqObjectInspectorWidget(objectInspectorDock);
- objectInspectorDock->setObjectName("objectInspectorWidget");
- objectInspectorWidget->setShowOnAccept(true);
- objectInspectorDock->setWidget(objectInspectorWidget);
- connect( objectInspectorWidget, SIGNAL( helpRequested(const QString&, const QString&) ), this, SLOT( showHelpForProxy(const QString&, const QString&) ) );
- myDockWidgets[objectInspectorDock] = true;
+ pqPropertiesPanel* propertiesPanel = new pqPropertiesPanel(propertiesDock);
+ propertiesDock->setObjectName("propertiesPanel");
+ propertiesDock->setWidget(propertiesPanel);
+ connect( propertiesPanel, SIGNAL( helpRequested(const QString&, const QString&) ), this, SLOT( showHelpForProxy(const QString&, const QString&) ) );
+ myDockWidgets[propertiesDock] = true;
//Display Dock
- QDockWidget* displayDock = new QDockWidget( tr( "TTL_DISPLAY" ), desk );
- displayDock->setObjectName("displayDock");
- QWidget* displayWidgetFrame = new QWidget(displayDock);
- displayWidgetFrame->setObjectName("displayWidgetFrame");
- displayDock->setWidget(displayWidgetFrame);
-
- QScrollArea* displayScrollArea = new QScrollArea(displayWidgetFrame);
- displayScrollArea->setObjectName("displayScrollArea");
- displayScrollArea->setWidgetResizable(true);
-
- QVBoxLayout* verticalLayout = new QVBoxLayout(displayWidgetFrame);
- verticalLayout->setSpacing(0);
- verticalLayout->setContentsMargins(0, 0, 0, 0);
-
- pqDisplayProxyEditorWidget* displayWidget = new pqDisplayProxyEditorWidget(displayDock);
- displayWidget->setObjectName("displayWidget");
- displayScrollArea->setWidget(displayWidget);
- verticalLayout->addWidget(displayScrollArea);
-
- myDockWidgets[displayDock] = true;
+// QDockWidget* displayDock = new QDockWidget( tr( "TTL_DISPLAY" ), desk );
+// displayDock->setObjectName("displayDock");
+// QWidget* displayWidgetFrame = new QWidget(displayDock);
+// displayWidgetFrame->setObjectName("displayWidgetFrame");
+// displayDock->setWidget(displayWidgetFrame);
+//
+// QScrollArea* displayScrollArea = new QScrollArea(displayWidgetFrame);
+// displayScrollArea->setObjectName("displayScrollArea");
+// displayScrollArea->setWidgetResizable(true);
+//
+// QVBoxLayout* verticalLayout = new QVBoxLayout(displayWidgetFrame);
+// verticalLayout->setSpacing(0);
+// verticalLayout->setContentsMargins(0, 0, 0, 0);
+//
+// pqDisplayProxyEditorWidget* displayWidget = new pqDisplayProxyEditorWidget(displayDock);
+// displayWidget->setObjectName("displayWidget");
+// displayScrollArea->setWidget(displayWidget);
+// verticalLayout->addWidget(displayScrollArea);
+//
+// myDockWidgets[displayDock] = true;
// information dock
QDockWidget* informationDock = new QDockWidget(tr( "TTL_INFORMATION" ), desk);
myDockWidgets[informationDock] = true;
desk->setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);
- desk->tabifyDockWidget(objectInspectorDock, displayDock);
- desk->tabifyDockWidget(objectInspectorDock, informationDock);
- objectInspectorDock->raise();
-
+ desk->tabifyDockWidget(propertiesDock, informationDock);
+ propertiesDock->raise();
// Statistic View
QDockWidget* statisticsViewDock = new QDockWidget( tr( "TTL_STATISTICS_VIEW" ), desk );