#include <SalomeApp_Study.h>
#include <SALOME_ListIO.hxx>
#include <SALOMEDS_Tool.hxx>
+#include <PyInterp_Interp.h>
#include <PyInterp_Dispatcher.h>
#include <PyConsole_Console.h>
#include <pqHelpReaction.h>
#include <vtkOutputWindow.h>
#include <pqPluginManager.h>
-//#include <vtkPVPluginInformation.h>
#include "pqInterfaceTracker.h"
#include <pqSettings.h>
#include <pqPythonDialog.h>
#include <pqPythonManager.h>
#include <pqPythonShell.h>
-//#include <pqBrandPluginsLoader.h>
#include <pqLoadDataReaction.h>
#include <vtkEventQtSlotConnect.h>
#include <pqPythonScriptEditor.h>
-#include <pqStandardSummaryPanelImplementation.h>
#include <pqCollaborationBehavior.h>
#include <pqDataRepresentation.h>
#include <pqPipelineRepresentation.h>
#include <pqColorToolbar.h>
#include <pqScalarBarVisibilityReaction.h>
#include <pqStandardPropertyWidgetInterface.h>
-#include <pqMultiServerBehavior.h>
#include <pqViewStreamingBehavior.h>
#include <PARAVIS_version.h>
#include <vtkPVConfig.h>
-#include <PVGUI_MatplotlibMathTextUtilities.h>
#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
-/*
- * Make sure all the kits register their classes with vtkInstantiator.
- * Since ParaView uses Tcl wrapping, all of VTK is already compiled in
- * anyway. The instantiators will add no more code for the linker to
- * collect.
- */
-
-//#include <vtkCommonInstantiator.h>
-//#include <vtkFilteringInstantiator.h>
-//#include <vtkGenericFilteringInstantiator.h>
-//#include <vtkIOInstantiator.h>
-//#include <vtkImagingInstantiator.h>
-//#include <vtkInfovisInstantiator.h>
-//#include <vtkGraphicsInstantiator.h>
-
-//#include <vtkRenderingInstantiator.h>
-//#include <vtkVolumeRenderingInstantiator.h>
-//#include <vtkHybridInstantiator.h>
-//#include <vtkParallelInstantiator.h>
-
#include <pqAlwaysConnectedBehavior.h>
#include <pqApplicationCore.h>
#include <pqAutoLoadPluginXMLBehavior.h>
{
}
-
-
/*!
\brief Initialize module. Creates menus, prepares context menu, etc.
\param app SALOME GUI application instance
*/
void PVGUI_Module::initialize( CAM_Application* app )
{
- //VTN: Disable conflict with python initialization for MatPlot.
- PVGUI_MatplotlibMathTextUtilities::Disable();
+ // [ABN]: patched in ParaView's sources.
+ // PVGUI_MatplotlibMathTextUtilities::Disable();
SalomeApp_Module::initialize( app );
// * adds support for standard paraview views.
pgm->addInterface(new pqStandardViewModules(pgm));
- pgm->addInterface(new pqStandardSummaryPanelImplementation(pgm));
+ //pgm->addInterface(new pqStandardSummaryPanelImplementation(pgm));
pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm));
// Load plugins distributed with application.
new pqViewFrameActionsBehavior(this);
new pqSpreadSheetVisibilityBehavior(this);
new pqPipelineContextMenuBehavior(this);
+ new pqObjectPickingBehavior(this); // NEW in 4.1
new pqDefaultViewBehavior(this);
new pqAlwaysConnectedBehavior(this);
new pqPVNewSourceBehavior(this);
new pqPersistentMainWindowStateBehavior(aDesktop);
new pqObjectPickingBehavior(aDesktop);
new pqCollaborationBehavior(this);
- new pqMultiServerBehavior(this);
+ //new pqMultiServerBehavior(this);
new pqViewStreamingBehavior(this);
// Setup quick-launch shortcuts.
QList<QDockWidget*>::iterator i;
for (i = currentDocks.begin(); i != currentDocks.end(); ++i) {
if(!activeDocks.contains(*i)) {
- myDockWidgets[*i] = false; // hidden by default
- (*i)->hide();
+ myDockWidgets[*i] = false; // hidden by default
+ (*i)->hide();
}
}
QList<QMenu*>::iterator im;
for (im = currentMenus.begin(); im != currentMenus.end(); ++im) {
if(!activeMenus.contains(*im)) {
- myMenus.append(*im);
+ myMenus.append(*im);
}
}
// we need to start trace after connection is done
connect(pqApplicationCore::instance()->getObjectBuilder(), SIGNAL(finishedAddingServer(pqServer*)),
- this, SLOT(onFinishedAddingServer(pqServer*)));
+ this, SLOT(onFinishedAddingServer(pqServer*)));
connect(pqApplicationCore::instance()->getObjectBuilder(), SIGNAL(dataRepresentationCreated(pqDataRepresentation*)),
this, SLOT(onDataRepresentationCreated(pqDataRepresentation*)));
SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
bool isStop = aResourceMgr->booleanValue( "PARAVIS", "stop_trace", false );
- // start timer to activate trace in a proper moment
- if(!isStop)
- startTimer( 1000 );
+ // start a timer to schedule the trace start asap:
+ if(!isStop)
+ startTimer( 0 );
this->VTKConnect = vtkEventQtSlotConnect::New();
if(pvs) {
vtkPVProgressHandler* ph = pvs->GetProgressHandler();
if(ph) {
- this->VTKConnect->Connect(ph, vtkCommand::StartEvent,
- this, SLOT(onStartProgress()));
- this->VTKConnect->Connect(ph, vtkCommand::EndEvent,
- this, SLOT(onEndProgress()));
+ this->VTKConnect->Connect(ph, vtkCommand::StartEvent,
+ this, SLOT(onStartProgress()));
+ this->VTKConnect->Connect(ph, vtkCommand::EndEvent,
+ this, SLOT(onEndProgress()));
}
}
}
connect(&pqActiveObjects::instance(),
- SIGNAL(representationChanged(pqRepresentation*)),
- this, SLOT(onRepresentationChanged(pqRepresentation*)));
+ SIGNAL(representationChanged(pqRepresentation*)),
+ this, SLOT(onRepresentationChanged(pqRepresentation*)));
}
void PVGUI_Module::onStartProgress()
void PVGUI_Module::execPythonCommand(const QString& cmd, bool inSalomeConsole)
{
- if ( PyInterp_Dispatcher::Get()->IsBusy() ) return;
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*>
+ 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);
- }
- }
+ if ( manager )
+ {
+ pqPythonDialog* pyDiag = manager->pythonShellDialog();
+ if ( pyDiag )
+ {
+ pqPythonShell* shell = pyDiag->shell();
+ if ( shell ) {
+ shell->executeScript(cmd);
+ }
+ }
+ }
}
- }
}
/*!
void PVGUI_Module::timerEvent(QTimerEvent* te )
{
#ifndef WNT
- execPythonCommand("from paraview import smtrace\nsmtrace.start_trace()\n", false);
+ 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);
+ MESSAGE("trace STARTED....");
+ }
killTimer( te->timerId() );
#endif
}
for (int i = 0; i < anActns.size(); ++i) {
QAction* a = anActns.at(i);
if(a)
- a->setVisible(true);
+ a->setVisible(true);
}
}
for (int i = 0; i < anActns.size(); ++i) {
QAction* a = anActns.at(i);
if(a)
- a->setVisible(false);
+ a->setVisible(false);
}
}
#endif
}
+///**
+// * Debug function printing out the given interpreter's execution context
+// */
+//void printInterpContext(PyInterp_Interp * interp )
+//{
+// // Extract __smtraceString from interpreter's context
+// const PyObject* ctxt = interp->getExecutionContext();
+//
+// PyObject* lst = PyDict_Keys((PyObject *)ctxt);
+// Py_ssize_t siz = PyList_GET_SIZE(lst);
+// for (Py_ssize_t i = 0; i < siz; i++)
+// {
+// PyObject * elem = PyList_GetItem(lst, i);
+// if (PyString_Check(elem))
+// {
+// std::cout << "At pos:" << i << ", " << PyString_AsString(elem) << std::endl;
+// }
+// else
+// std::cout << "At pos:" << i << ", not a string!" << std::endl;
+// }
+// Py_XDECREF(lst);
+//}
+
/*!
\brief Returns trace string
*/
{
QString traceString;
#ifndef WNT
- pqPythonManager* manager = qobject_cast<pqPythonManager*>(
- pqApplicationCore::instance()->manager("PYTHON_MANAGER"));
- if (manager) {
- pqPythonDialog* pyDiag = manager->pythonShellDialog();
- if (pyDiag) {
- pyDiag->runString("from paraview import smtrace\n"
- "__smtraceString = smtrace.get_trace_string()\n");
- pyDiag->shell()->makeCurrent();
- 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) {
+ {
+ 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;
- }
- pyDiag->shell()->releaseControl();
}
- }
+ } // release GIL
+
if ((!traceString.isNull()) && traceString.length() != 0) {
int aPos = traceString.indexOf(MYReplaceStr);
while (aPos != -1) {
//rnv: imp 21712: [CEA 581] Preference to display legend by default
int aDispColoreLegend = addPreference( tr( "PREF_SHOW_COLOR_LEGEND" ), aParaVisSettingsTab,
- LightApp_Preferences::Bool, "PARAVIS", "show_color_legend");
+ LightApp_Preferences::Bool, "PARAVIS", "show_color_legend");
}
/*!
else {
// Try to get state object
_PTR(SObject) stateSObj =
- studyDS->FindObjectID(entry.toLatin1().constData());
+ studyDS->FindObjectID(entry.toLatin1().constData());
if (!stateSObj) {
- return;
+ return;
}
// Check local id
_PTR(GenericAttribute) anAttr;
if (!stateSObj->FindAttribute(anAttr, "AttributeLocalID")) {
- return;
+ return;
}
_PTR(AttributeLocalID) anID(anAttr);
if (anID->Value() == PVSTATEID) {
- // Paraview state object
- theMenu->addSeparator();
- theMenu->addAction(action(AddStatePopupId));
- theMenu->addAction(action(CleanAndAddStatePopupId));
- theMenu->addSeparator();
- theMenu->addAction(action(ParaVisRenameId));
- theMenu->addAction(action(ParaVisDeleteId));
+ // Paraview state object
+ theMenu->addSeparator();
+ theMenu->addAction(action(AddStatePopupId));
+ theMenu->addAction(action(CleanAndAddStatePopupId));
+ theMenu->addSeparator();
+ theMenu->addAction(action(ParaVisRenameId));
+ theMenu->addAction(action(ParaVisDeleteId));
}
}
}
}
else {
SUIT_MessageBox::critical(getApp()->desktop(),
- tr("ERR_ERROR"),
- tr("ERR_STATE_CANNOT_BE_RESTORED"));
+ tr("ERR_ERROR"),
+ tr("ERR_STATE_CANNOT_BE_RESTORED"));
}
}
for (int i = 0; i < aWidget.size() ; i++ ) {
if( aWidget[i] ) {
connect( aWidget[i], SIGNAL ( variableChanged ( pqVariableType, const QString ) ),
- this, SLOT(onVariableChanged( pqVariableType, const QString) ), Qt::UniqueConnection );
+ this, SLOT(onVariableChanged( pqVariableType, const QString) ), Qt::UniqueConnection );
}
}
}
PVGUI_EXPORT char* getModuleVersion() {
return (char*)PARAVIS_VERSION_STR;
}
-
}
#include <pqApplicationCore.h>
#include <pqComparativeVisPanel.h>
#include <pqPipelineBrowserWidget.h>
-//#include <pqProxyTabWidget.h>
#include <pqProxyInformationWidget.h>
#include <pqSettings.h>
#include <pqDataInformationWidget.h>
#include <pqPVAnimationWidget.h>
-#include <pqSelectionInspectorWidget.h>
+#include <pqFindDataSelectionDisplayFrame.h>
+#include <pqMultiBlockInspectorPanel.h>
#include <pqProgressWidget.h>
#include <pqProgressManager.h>
#include <pqObjectInspectorWidget.h>
#include <pqParaViewMenuBuilders.h>
#include <pqCollaborationPanel.h>
#include <pqMemoryInspectorPanel.h>
+#include <pqColorMapEditor.h>
class ResizeHelper : public pqPVAnimationWidget
{
desk->tabifyDockWidget(animationViewDock, statisticsViewDock);
- // Selection view
- QDockWidget* selectionInspectorDock = new QDockWidget( tr( "TTL_SELECTION_INSPECTOR" ), desk );
- selectionInspectorDock->setObjectName("selectionInspectorDock");
- selectionInspectorDock->setAllowedAreas( Qt::AllDockWidgetAreas );
- desk->addDockWidget( Qt::LeftDockWidgetArea, selectionInspectorDock );
- pqSelectionInspectorPanel* aSelInspector = new pqSelectionInspectorWidget(selectionInspectorDock);
- selectionInspectorDock->setWidget(aSelInspector);
- myDockWidgets[selectionInspectorDock] = false; // hidden by default
+ // Selection inspector
+ QDockWidget* selectionDisplayDock = new QDockWidget( tr( "TTL_SELECTION_INSPECTOR" ), desk );
+ selectionDisplayDock->setObjectName("selectionInspectorDock");
+ selectionDisplayDock->setAllowedAreas( Qt::AllDockWidgetAreas );
+ desk->addDockWidget( Qt::LeftDockWidgetArea, selectionDisplayDock );
+ pqFindDataSelectionDisplayFrame* aSelInspector = new pqFindDataSelectionDisplayFrame(selectionDisplayDock);
+ selectionDisplayDock->setWidget(aSelInspector);
+ myDockWidgets[selectionDisplayDock] = false; // hidden by default
+
+ // Multi-block inspector
+ QDockWidget* multiBlockInspectorPanelDock = new QDockWidget( tr( "TTL_MUTLI_BLOCK_INSPECTOR" ), desk );
+ multiBlockInspectorPanelDock->setObjectName("multiBlockInspectorPanelDock");
+ desk->addDockWidget( Qt::LeftDockWidgetArea, multiBlockInspectorPanelDock );
+ pqMultiBlockInspectorPanel* mbi_panel = new pqMultiBlockInspectorPanel( multiBlockInspectorPanelDock );
+ multiBlockInspectorPanelDock->setWidget(mbi_panel);
+ myDockWidgets[multiBlockInspectorPanelDock] = false; // hidden by default
// Comparative View
QDockWidget* comparativePanelDock = new QDockWidget( tr( "TTL_COMPARATIVE_VIEW_INSPECTOR" ), desk );
collaborationPanelDock->setWidget(collaborationPanel);
desk->addDockWidget(Qt::RightDockWidgetArea, collaborationPanelDock);
myDockWidgets[collaborationPanelDock] = false; // hidden by default
+
+ // Color map editor
+ QDockWidget* colorMapEditorDock = new QDockWidget( tr( "TTL_COLOR_MAP_EDITOR" ), desk );
+ colorMapEditorDock->setObjectName("colorMapEditorDock");
+ desk->addDockWidget( Qt::LeftDockWidgetArea, colorMapEditorDock );
+ pqColorMapEditor* cmed_panel = new pqColorMapEditor( colorMapEditorDock );
+ colorMapEditorDock->setWidget(cmed_panel);
+ myDockWidgets[colorMapEditorDock] = false; // hidden by default
+
// Memory inspector dock
QDockWidget* memoryInspectorDock = new QDockWidget(tr( "TTL_MEMORY_INSPECTOR" ), desk);
statisticsViewDock->hide();
comparativePanelDock->hide();
animationViewDock->hide();
- selectionInspectorDock->hide();
+ multiBlockInspectorPanelDock->hide();
+ selectionDisplayDock->hide();
collaborationPanelDock->hide();
memoryInspectorDock->hide();
+ colorMapEditorDock->hide();
}
/*!