From: Anthony Geay Date: Fri, 25 Aug 2017 07:05:47 +0000 (+0200) Subject: On the road X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9677aceacdcec5ba4a7027ee7acc54b7f1f943a1;p=modules%2Fgui.git On the road --- diff --git a/src/PVViewer/CMakeLists.txt b/src/PVViewer/CMakeLists.txt index 623550d73..77f578bb3 100644 --- a/src/PVViewer/CMakeLists.txt +++ b/src/PVViewer/CMakeLists.txt @@ -96,6 +96,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_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);