From 37f29369fb9b048ee4673cd8da4a3b9025156ca6 Mon Sep 17 00:00:00 2001 From: abn Date: Wed, 3 Sep 2014 16:12:49 +0200 Subject: [PATCH] Prepare move of the view part to GUI. --- CMakeLists.txt | 2 +- src/PVGUI/CMakeLists.txt | 24 +++--- src/PVGUI/PVGUI_Module.cxx | 28 +++---- src/PVGUI/PVGUI_Module.h | 13 ++- src/PVGUI/view/CMakeLists.txt | 80 +++++++++++++++++++ .../{ => view}/PVGUI_OutputWindowAdapter.cxx | 0 .../{ => view}/PVGUI_OutputWindowAdapter.h | 0 src/PVGUI/{ => view}/PVGUI_ViewManager.cxx | 0 src/PVGUI/{ => view}/PVGUI_ViewManager.h | 0 src/PVGUI/{ => view}/PVGUI_ViewModel.cxx | 3 + src/PVGUI/{ => view}/PVGUI_ViewModel.h | 0 src/PVGUI/{ => view}/PVGUI_ViewWindow.cxx | 0 src/PVGUI/{ => view}/PVGUI_ViewWindow.h | 0 src/Plugins/MEDReader/IO/vtkMEDReader.cxx | 2 +- 14 files changed, 119 insertions(+), 33 deletions(-) create mode 100644 src/PVGUI/view/CMakeLists.txt rename src/PVGUI/{ => view}/PVGUI_OutputWindowAdapter.cxx (100%) rename src/PVGUI/{ => view}/PVGUI_OutputWindowAdapter.h (100%) rename src/PVGUI/{ => view}/PVGUI_ViewManager.cxx (100%) rename src/PVGUI/{ => view}/PVGUI_ViewManager.h (100%) rename src/PVGUI/{ => view}/PVGUI_ViewModel.cxx (95%) rename src/PVGUI/{ => view}/PVGUI_ViewModel.h (100%) rename src/PVGUI/{ => view}/PVGUI_ViewWindow.cxx (100%) rename src/PVGUI/{ => view}/PVGUI_ViewWindow.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 172b7185..8a22a664 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -251,7 +251,7 @@ INCLUDE(CMakePackageConfigHelpers) # List of targets in this project we want to make visible to the rest of the world. # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup" IF(NOT SALOME_LIGHT_ONLY) - SET(_${PROJECT_NAME}_exposed_targets SalomeIDLPARAVIS PARAVIS) + SET(_${PROJECT_NAME}_exposed_targets SalomeIDLPARAVIS PARAVIS PVViewer) # Add all targets to the build-tree export set EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets} diff --git a/src/PVGUI/CMakeLists.txt b/src/PVGUI/CMakeLists.txt index 13ee65b6..2f54c2fd 100644 --- a/src/PVGUI/CMakeLists.txt +++ b/src/PVGUI/CMakeLists.txt @@ -30,8 +30,12 @@ INCLUDE_DIRECTORIES(${OMNIORB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/view ) +# Process viewer: +ADD_SUBDIRECTORY(view) + # additional preprocessor / compiler flags ADD_DEFINITIONS(${CAS_DEFINITIONS}) ADD_DEFINITIONS(${KERNEL_DEFINITIONS}) @@ -45,7 +49,7 @@ SET(_PARAVIEW_APP_COMPO_LIB SET(_link_LIBRARIES ${OMNIORB_LIBRARIES} ${QT_LIBRARIES} - ${CAS_KERNEL} +# ${CAS_KERNEL} ${PYTHON_LIBS} ${KERNEL_LDFLAGS} ${KERNEL_SalomeDS} ${KERNEL_SALOMELocalTrace} ${KERNEL_SalomeIDLKernel} ${KERNEL_SalomeNS} ${KERNEL_SalomeLifeCycleCORBA} ${KERNEL_SalomeContainer} ${KERNEL_TOOLSDS} @@ -54,6 +58,7 @@ SET(_link_LIBRARIES ${MED_SalomeIDLMED} ${_PARAVIEW_APP_COMPO_LIB} SalomeIDLPARAVIS + PVViewer ) # --- headers --- @@ -61,17 +66,16 @@ SET(_link_LIBRARIES # header files / to be processed by moc SET(_moc_HEADERS PVGUI_Module.h - PVGUI_ViewManager.h - PVGUI_ViewModel.h - PVGUI_ViewWindow.h +# PVGUI_ViewManager.h +# PVGUI_ViewModel.h +# PVGUI_ViewWindow.h PVGUI_ParaViewSettingsPane.h ) # header files / no moc processing SET(_other_HEADERS - PVGUI_OutputWindowAdapter.h +# PVGUI_OutputWindowAdapter.h PVGUI_Tools.h - #PVGUI_MatplotlibMathTextUtilities.h PV_I.h PARAVIS_Gen_i.hh PV_Events.h @@ -134,10 +138,10 @@ SET(_other_SOURCES PVGUI_Module.cxx PVGUI_Module_actions.cxx PVGUI_Module_widgets.cxx - PVGUI_ViewManager.cxx - PVGUI_ViewModel.cxx - PVGUI_ViewWindow.cxx - PVGUI_OutputWindowAdapter.cxx +# PVGUI_ViewManager.cxx +# PVGUI_ViewModel.cxx +# PVGUI_ViewWindow.cxx +# PVGUI_OutputWindowAdapter.cxx PVGUI_Tools.cxx PVGUI_ParaViewSettingsPane.cxx #PVGUI_MatplotlibMathTextUtilities.cxx diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index d906110a..54fe2586 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -163,8 +163,6 @@ //---------------------------------------------------------------------------- pqPVApplicationCore* PVGUI_Module::MyCoreApp = 0; -//PVGUI_OutputWindowAdapter* PVGUI_Module::pqImplementation::OutputWindowAdapter = 0; -//QPointer PVGUI_Module::pqImplementation::helpWindow = 0; PVGUI_Module* ParavisModule = 0; @@ -313,7 +311,6 @@ void paravisCleanUp() */ PVGUI_Module::PVGUI_Module() : SalomeApp_Module( "PARAVIS" ), - // Implementation( 0 ), mySelectionControlsTb( -1 ), mySourcesMenuId( -1 ), myFiltersMenuId( -1 ), @@ -381,9 +378,6 @@ PARAVIS_ORB::PARAVIS_Gen_var PVGUI_Module::GetEngine() */ void PVGUI_Module::initialize( CAM_Application* app ) { - // [ABN]: patched in ParaView's sources. - // PVGUI_MatplotlibMathTextUtilities::Disable(); - SalomeApp_Module::initialize( app ); // Create ParaViS actions @@ -410,9 +404,6 @@ void PVGUI_Module::initialize( CAM_Application* app ) // Remember current state of desktop toolbars QList foreignToolbars = aDesktop->findChildren(); - // Simulate ParaView client main window - //Implementation = new pqImplementation( aDesktop ); - setupDockWidgets(); pvCreateActions(); @@ -431,7 +422,6 @@ void PVGUI_Module::initialize( CAM_Application* app ) // * adds support for standard paraview views. pgm->addInterface(new pqStandardViewModules(pgm)); - //pgm->addInterface(new pqStandardSummaryPanelImplementation(pgm)); pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm)); // Load plugins distributed with application. @@ -559,10 +549,6 @@ void PVGUI_Module::initialize( CAM_Application* app ) connect(&pqActiveObjects::instance(), SIGNAL(representationChanged(pqRepresentation*)), this, SLOT(onRepresentationChanged(pqRepresentation*))); - -// MESSAGE("initialize(): Initializing PARAVIS's Python context ..."); -// execPythonCommand("import paraview.servermanager as sm; sm.fromGUI=True", false); -// MESSAGE("initialize(): Initialized."); } bool PVGUI_Module::connectToExternalPVServer() @@ -1081,12 +1067,26 @@ void PVGUI_Module::onApplicationClosed( SUIT_Application* theApp ) pqApplicationCore::instance()->settings()->sync(); int aAppsNb = SUIT_Session::session()->applications().size(); if (aAppsNb == 1) { + deleteTemporaryFiles(); MyCoreApp->deleteLater(); } CAM_Module::onApplicationClosed(theApp); } +/*! + \brief Deletes temporary files created during import operation from VISU +*/ +void PVGUI_Module::deleteTemporaryFiles() +{ + foreach(QString aFile, myTemporaryFiles) { + if (QFile::exists(aFile)) { + QFile::remove(aFile); + } + } +} + + /*! \brief Called when study is closed. diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index 5122d8df..e9becbde 100644 --- a/src/PVGUI/PVGUI_Module.h +++ b/src/PVGUI/PVGUI_Module.h @@ -172,6 +172,8 @@ public slots: //void onImportFromVisu(QString theEntry); private: + void deleteTemporaryFiles(); + //! Initialize ParaView if not yet done (once per session) static bool pvInit(); @@ -275,9 +277,6 @@ protected slots: virtual void onInitTimer(); private: - class pqImplementation; - pqImplementation* Implementation; - int mySelectionControlsTb; int mySourcesMenuId; int myFiltersMenuId; @@ -300,13 +299,13 @@ private: vtkEventQtSlotConnect *VTKConnect; - pqPythonScriptEditor* myTraceWindow; + static pqPVApplicationCore* MyCoreApp; + static PARAVIS_ORB::PARAVIS_Gen_var myEngine; - int myStateCounter; - static pqPVApplicationCore* MyCoreApp; + pqPythonScriptEditor* myTraceWindow; - static PARAVIS_ORB::PARAVIS_Gen_var myEngine; + int myStateCounter; //! Single shot timer used to connect to the PVServer, and start the trace. QTimer * myInitTimer; diff --git a/src/PVGUI/view/CMakeLists.txt b/src/PVGUI/view/CMakeLists.txt new file mode 100644 index 00000000..cd3c5c62 --- /dev/null +++ b/src/PVGUI/view/CMakeLists.txt @@ -0,0 +1,80 @@ +# Copyright (C) 2010-2014 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 +# + +INCLUDE(UseQt4Ext) + +# --- options --- + +INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS} + ${QT_INCLUDES} + ${CMAKE_CURRENT_SOURCE_DIR} + ) + +SET(_PARAVIEW_APP_COMPO_LIB + pqApplicationComponents + ) + +SET(_link_LIBRARIES + ${KERNEL_LDFLAGS} ${KERNEL_SALOMELocalTrace} + ${GUI_LDFLAGS} ${GUI_LightApp} ${GUI_suit} ${GUI_Event} ${_PARAVIEW_APP_COMPO_LIB} +) + +# --- headers --- + +# header files / to be processed by moc +SET(_moc_HEADERS + PVGUI_ViewManager.h + PVGUI_ViewModel.h + PVGUI_ViewWindow.h +) + +# header files / no moc processing +SET(_other_HEADERS + PVGUI_OutputWindowAdapter.h +) +# header files / to install +SET(PVViewer_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) + +# --- sources --- + +# sources / moc wrappings +QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) + +# sources / static +SET(_other_SOURCES + PVGUI_ViewManager.cxx + PVGUI_ViewModel.cxx + PVGUI_ViewWindow.cxx + PVGUI_OutputWindowAdapter.cxx + ) + +# sources / to compile +SET(PVViewer_SOURCES + ${_other_SOURCES} + ${_moc_SOURCES} + ) + +# --- rules --- +ADD_LIBRARY(PVViewer ${PVViewer_SOURCES}) + +TARGET_LINK_LIBRARIES(PVViewer ${_link_LIBRARIES}) +INSTALL(TARGETS PVViewer EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) + +# --- header and resources installation --- +INSTALL(FILES ${PVViewer_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) diff --git a/src/PVGUI/PVGUI_OutputWindowAdapter.cxx b/src/PVGUI/view/PVGUI_OutputWindowAdapter.cxx similarity index 100% rename from src/PVGUI/PVGUI_OutputWindowAdapter.cxx rename to src/PVGUI/view/PVGUI_OutputWindowAdapter.cxx diff --git a/src/PVGUI/PVGUI_OutputWindowAdapter.h b/src/PVGUI/view/PVGUI_OutputWindowAdapter.h similarity index 100% rename from src/PVGUI/PVGUI_OutputWindowAdapter.h rename to src/PVGUI/view/PVGUI_OutputWindowAdapter.h diff --git a/src/PVGUI/PVGUI_ViewManager.cxx b/src/PVGUI/view/PVGUI_ViewManager.cxx similarity index 100% rename from src/PVGUI/PVGUI_ViewManager.cxx rename to src/PVGUI/view/PVGUI_ViewManager.cxx diff --git a/src/PVGUI/PVGUI_ViewManager.h b/src/PVGUI/view/PVGUI_ViewManager.h similarity index 100% rename from src/PVGUI/PVGUI_ViewManager.h rename to src/PVGUI/view/PVGUI_ViewManager.h diff --git a/src/PVGUI/PVGUI_ViewModel.cxx b/src/PVGUI/view/PVGUI_ViewModel.cxx similarity index 95% rename from src/PVGUI/PVGUI_ViewModel.cxx rename to src/PVGUI/view/PVGUI_ViewModel.cxx index e2097db2..615b0415 100644 --- a/src/PVGUI/PVGUI_ViewModel.cxx +++ b/src/PVGUI/view/PVGUI_ViewModel.cxx @@ -19,6 +19,7 @@ #include "PVGUI_ViewModel.h" #include "PVGUI_ViewWindow.h" +#include "utilities.h" /*! Constructor @@ -26,8 +27,10 @@ PVGUI_Viewer::PVGUI_Viewer() :SUIT_ViewModel() { + MESSAGE("PVGUI_Viewer: creating view ..."); } + /*! Destructor */ diff --git a/src/PVGUI/PVGUI_ViewModel.h b/src/PVGUI/view/PVGUI_ViewModel.h similarity index 100% rename from src/PVGUI/PVGUI_ViewModel.h rename to src/PVGUI/view/PVGUI_ViewModel.h diff --git a/src/PVGUI/PVGUI_ViewWindow.cxx b/src/PVGUI/view/PVGUI_ViewWindow.cxx similarity index 100% rename from src/PVGUI/PVGUI_ViewWindow.cxx rename to src/PVGUI/view/PVGUI_ViewWindow.cxx diff --git a/src/PVGUI/PVGUI_ViewWindow.h b/src/PVGUI/view/PVGUI_ViewWindow.h similarity index 100% rename from src/PVGUI/PVGUI_ViewWindow.h rename to src/PVGUI/view/PVGUI_ViewWindow.h diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx index 769e87a4..6f214ff1 100644 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx @@ -328,7 +328,7 @@ int vtkMEDReader::RequestData(vtkInformation *request, vtkInformationVector **in } catch(INTERP_KERNEL::Exception& e) { - std::cerr << "Exception has been thrown in vtkMEDReader::RequestInformation : " << e.what() << std::endl; + std::cerr << "Exception has been thrown in vtkMEDReader::RequestData : " << e.what() << std::endl; return 0; } return 1; -- 2.39.2