From: Anthony Geay Date: Thu, 24 Aug 2017 09:20:14 +0000 (+0200) Subject: Multi server mode for PARAVIS. This allow to integrate modules using local visualizat... X-Git-Tag: V8_4_0a2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3c92c56013c414ce3b637835d145f2126eb9bcf7;p=modules%2Fgui.git Multi server mode for PARAVIS. This allow to integrate modules using local visualization with PV. --- diff --git a/src/PVViewer/CMakeLists.txt b/src/PVViewer/CMakeLists.txt index 623550d73..05910b481 100644 --- a/src/PVViewer/CMakeLists.txt +++ b/src/PVViewer/CMakeLists.txt @@ -61,6 +61,7 @@ SET(_moc_HEADERS PVViewer_ViewWindow.h PVViewer_Behaviors.h PVViewer_GUIElements.h + PVViewer_InitSingleton.h ) # header files / no moc processing @@ -96,6 +97,7 @@ SET(_other_SOURCES PVViewer_Behaviors.cxx PVViewer_GUIElements.cxx PVViewer_Core.cxx + PVViewer_InitSingleton.cxx ) # sources / to compile diff --git a/src/PVViewer/PVViewer_Core.cxx b/src/PVViewer/PVViewer_Core.cxx index 8f9abaafc..993d6b249 100644 --- a/src/PVViewer/PVViewer_Core.cxx +++ b/src/PVViewer/PVViewer_Core.cxx @@ -65,7 +65,7 @@ bool PVViewer_Core::ParaviewInitApp(QMainWindow * aDesktop, LogWindow * logWindo char** argv = 0; QString aOptions = getenv("PARAVIEW_OPTIONS"); QStringList aOptList = aOptions.split(":", QString::SkipEmptyParts); - argv = new char*[aOptList.size() + 1]; + argv = new char*[aOptList.size() + 2]; QStringList args = QApplication::arguments(); argv[0] = (args.size() > 0)? strdup(args[0].toLatin1().constData()) : strdup("paravis"); argc++; @@ -74,6 +74,7 @@ bool PVViewer_Core::ParaviewInitApp(QMainWindow * aDesktop, LogWindow * logWindo argv[argc] = strdup( aStr.toLatin1().constData() ); argc++; } + argv[argc++] = strdup("--multi-servers"); MyCoreApp = new pqPVApplicationCore (argc, argv); if (MyCoreApp->getOptions()->GetHelpSelected() || MyCoreApp->getOptions()->GetUnknownArgument() || diff --git a/src/PVViewer/PVViewer_InitSingleton.cxx b/src/PVViewer/PVViewer_InitSingleton.cxx new file mode 100644 index 000000000..538e0d085 --- /dev/null +++ b/src/PVViewer/PVViewer_InitSingleton.cxx @@ -0,0 +1,38 @@ +// Copyright (C) 2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony GEAY (EDF R&D) + +#include "PVViewer_InitSingleton.h" +#include "PVViewer_Core.h" +#include "PVViewer_ViewManager.h" + +bool PVViewer_InitSingleton::IS_INIT=false; + +void PVViewer_InitSingleton::Init(QMainWindow *aDesktop, LogWindow *logWindow) +{ + if(IS_INIT) + return ; + PVViewer_Core::ParaviewInitApp(aDesktop,logWindow); + // Finish ParaView set up: behaviors, connection and configurations. + const QString configPath(PVViewer_ViewManager::GetPVConfigPath()); + PVViewer_Core::ParaviewInitBehaviors(true,aDesktop); + PVViewer_ViewManager::ConnectToExternalPVServer(aDesktop); + PVViewer_Core::ParaviewLoadConfigurations(configPath); + IS_INIT=true; +} diff --git a/src/PVViewer/PVViewer_InitSingleton.h b/src/PVViewer/PVViewer_InitSingleton.h new file mode 100644 index 000000000..93eba85b5 --- /dev/null +++ b/src/PVViewer/PVViewer_InitSingleton.h @@ -0,0 +1,42 @@ +// Copyright (C) 2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony GEAY (EDF R&D) + +#ifndef __PVVIEWER_INITSINGLETON_H__ +#define __PVVIEWER_INITSINGLETON_H__ + +#include "PVViewer.h" + +class QMainWindow; +class LogWindow; + +/** + * This class deals with initialization of SALOME_Session to make it a PV based application. + * The initialization must be done only once. + * It allows multi initializator ParaView visu modules other than PARAVIS. + */ +class PVVIEWER_EXPORT PVViewer_InitSingleton +{ +public: + static void Init(QMainWindow *aDesktop, LogWindow *logWindow); +private: + static bool IS_INIT; +}; + +#endif /* SRC_PVVIEWER_PVVIEWER_CORE_H_ */ diff --git a/src/PVViewer/PVViewer_ViewManager.cxx b/src/PVViewer/PVViewer_ViewManager.cxx index 9c0f6004c..42a794799 100644 --- a/src/PVViewer/PVViewer_ViewManager.cxx +++ b/src/PVViewer/PVViewer_ViewManager.cxx @@ -23,6 +23,7 @@ #include "PVViewer_ViewModel.h" #include "PVViewer_GUIElements.h" #include "PVViewer_Core.h" +#include "PVViewer_InitSingleton.h" #include "PVServer_ServiceWrapper.h" #include @@ -49,7 +50,7 @@ PVViewer_ViewManager::PVViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* des setTitle( tr( "PARAVIEW_VIEW_TITLE" ) ); // Initialize minimal paraview stuff (if not already done) - PVViewer_Core::ParaviewInitApp(desk, logWindow); + PVViewer_InitSingleton::Init(desk, logWindow); connect( desk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ), this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); diff --git a/src/PVViewer/PVViewer_ViewWindow.cxx b/src/PVViewer/PVViewer_ViewWindow.cxx index f26f9a745..f2c7f9221 100644 --- a/src/PVViewer/PVViewer_ViewWindow.cxx +++ b/src/PVViewer/PVViewer_ViewWindow.cxx @@ -59,13 +59,6 @@ PVViewer_ViewWindow::PVViewer_ViewWindow( SUIT_Desktop* theDesktop, PVViewer_Vie // This is mandatory, see setParent() method in Qt 4 documentation myPVMgr->show(); setCentralWidget( myPVMgr ); - - // Finish ParaView set up: behaviors, connection and configurations. - const QString configPath(PVViewer_ViewManager::GetPVConfigPath()); - PVViewer_Core::ParaviewInitBehaviors(true, theDesktop); - PVViewer_ViewManager::ConnectToExternalPVServer(theDesktop); - PVViewer_Core::ParaviewLoadConfigurations(configPath); - // Hide toolbars PVViewer_GUIElements * pvge = PVViewer_GUIElements::GetInstance(myDesktop); pvge->setToolBarVisible(false);