From 9ad5720146298d5b3e523a6eca0214de55f94afd Mon Sep 17 00:00:00 2001 From: abn Date: Fri, 19 Sep 2014 15:42:55 +0200 Subject: [PATCH] Adding option to skip the connection to an external server. --- src/PVGUI/PVGUI_Module.cxx | 13 +++++++------ src/PVGUI/view/PVViewer_ViewManager.cxx | 13 ++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index d4f7cc9a..f1f9b836 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -126,6 +126,10 @@ #include #include +// TO REMOVE: +#include + + //---------------------------------------------------------------------------- PVGUI_Module* ParavisModule = 0; @@ -402,7 +406,6 @@ void PVGUI_Module::initialize( CAM_Application* app ) if(!isStop) { // Start a timer to schedule asap: - // - the connection to the server // - the trace start myInitTimer = new QTimer(aDesktop); QObject::connect(myInitTimer, SIGNAL(timeout()), this, SLOT(onInitTimer()) ); @@ -451,14 +454,10 @@ void PVGUI_Module::onDataRepresentationUpdated() { } /*! - \brief Initialisation timer event - fired only once, after the GUI loop is ready. - See creation in initialize(). + \brief Initialisation timer event - trace start up */ void PVGUI_Module::onInitTimer() { -#ifndef PARAVIS_WITH_FULL_CORBA -// connectToExternalPVServer(); -#endif startTrace(); } @@ -959,6 +958,8 @@ void PVGUI_Module::createPreferences() int aParaVisSettingsTab = addPreference( tr( "TIT_PVISSETTINGS" ) ); addPreference( tr( "PREF_STOP_TRACE" ), aParaVisSettingsTab, LightApp_Preferences::Bool, "PARAVIS", "stop_trace"); + addPreference( tr( "PREF_NO_EXT_PVSERVER" ), aParaVisSettingsTab, LightApp_Preferences::Bool, "PARAVIS", "no_ext_pv_server"); + int aSaveType = addPreference(tr( "PREF_SAVE_TYPE_LBL" ), aParaVisSettingsTab, LightApp_Preferences::Selector, "PARAVIS", "savestate_type"); diff --git a/src/PVGUI/view/PVViewer_ViewManager.cxx b/src/PVGUI/view/PVViewer_ViewManager.cxx index ae644210..4ce11704 100644 --- a/src/PVGUI/view/PVViewer_ViewManager.cxx +++ b/src/PVGUI/view/PVViewer_ViewManager.cxx @@ -117,7 +117,7 @@ bool PVViewer_ViewManager::ParaviewInitApp(SUIT_Desktop * aDesktop) PyConsole_Interp* pyInterp = app->pythonConsole()->getInterp(); { PyLockWrapper aGil; - std::string cmd = "import paraview; paraview.fromGUI = True;"; + std::string cmd = "import paraview;paraview.fromGUI = True"; pyInterp->run(cmd.c_str()); } @@ -169,11 +169,9 @@ void PVViewer_ViewManager::ParaviewCleanup() pqApplicationCore::instance()->settings()->sync(); pqPVApplicationCore * app = GetPVApplication(); - // [ABN] : TODO review this, this triggers an ugly crash (Python thread state mix-up) - // at SALOME's exit. // Schedule destruction of PVApplication singleton: -// if (app) -// app->deleteLater(); + if (app) + app->deleteLater(); } PARAVIS_ORB::PARAVIS_Gen_var PVViewer_ViewManager::GetEngine() @@ -189,6 +187,11 @@ PARAVIS_ORB::PARAVIS_Gen_var PVViewer_ViewManager::GetEngine() bool PVViewer_ViewManager::ConnectToExternalPVServer(SUIT_Desktop* aDesktop) { + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + bool noConnect = aResourceMgr->booleanValue( "PARAVIS", "no_ext_pv_server", false ); + if (noConnect) + return true; + pqServer* server = pqActiveObjects::instance().activeServer(); if (server && server->isRemote()) { -- 2.39.2