]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Moved PVViewer code from PARAVIS into GUI.
authorabn <adrien.bruneton@cea.fr>
Mon, 29 Sep 2014 14:55:13 +0000 (16:55 +0200)
committerabn <adrien.bruneton@cea.fr>
Mon, 29 Sep 2014 14:55:13 +0000 (16:55 +0200)
34 files changed:
CMakeLists.txt
SalomeGUIConfig.cmake.in
adm_local/cmake_files/CMakeLists.txt
adm_local/cmake_files/FindSalomeParaView.cmake [new file with mode: 0644]
src/CMakeLists.txt
src/LightApp/CMakeLists.txt
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/LightApp/LightApp_Module.cxx
src/LightApp/resources/LightApp.ini
src/LightApp/resources/LightApp.xml
src/LightApp/resources/LightApp_msg_en.ts
src/PVViewer/CMakeLists.txt [new file with mode: 0644]
src/PVViewer/PVViewer_Behaviors.cxx [new file with mode: 0644]
src/PVViewer/PVViewer_Behaviors.h [new file with mode: 0644]
src/PVViewer/PVViewer_EngineWrapper.cxx [new file with mode: 0644]
src/PVViewer/PVViewer_EngineWrapper.h [new file with mode: 0644]
src/PVViewer/PVViewer_GUIElements.cxx [new file with mode: 0644]
src/PVViewer/PVViewer_GUIElements.h [new file with mode: 0644]
src/PVViewer/PVViewer_LogWindowAdapter.cxx [new file with mode: 0644]
src/PVViewer/PVViewer_LogWindowAdapter.h [new file with mode: 0644]
src/PVViewer/PVViewer_ViewManager.cxx [new file with mode: 0644]
src/PVViewer/PVViewer_ViewManager.h [new file with mode: 0644]
src/PVViewer/PVViewer_ViewModel.cxx [new file with mode: 0644]
src/PVViewer/PVViewer_ViewModel.h [new file with mode: 0644]
src/PVViewer/PVViewer_ViewWindow.cxx [new file with mode: 0644]
src/PVViewer/PVViewer_ViewWindow.h [new file with mode: 0644]
src/SALOME_PYQT/SalomePyQt/CMakeLists.txt
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx
src/SALOME_PYQT/SalomePyQt/SalomePyQt.h
src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip
src/SalomeApp/CMakeLists.txt
src/SalomeApp/SalomeApp_PyInterp.cxx
src/SalomeApp/resources/SalomeApp.ini

index bc15a54bdb4942e3495cd0517d78533f9b33754e..274140c448887ad528b8a98283fb324cf6e13c5b 100755 (executable)
@@ -73,11 +73,12 @@ OPTION(SALOME_USE_GRAPHICSVIEW "Enable GraphicsView visualization (Mandatory in
 OPTION(SALOME_USE_PLOT2DVIEWER "Enable Plot2D visualization (Mandatory in classic configurations)" ON)
 OPTION(SALOME_USE_PYCONSOLE "Enable Python GUI interface (Mandatory in classic configurations)" ON)
 OPTION(SALOME_USE_QXGRAPHVIEWER "Enable QX graph visualization (Mandatory in classic configurations)" ON)
+OPTION(SALOME_USE_PVVIEWER "Enable ParaView visualization (Mandatory in classic configurations)" ON)
 CMAKE_DEPENDENT_OPTION(SALOME_USE_SALOMEOBJECT "Enable Salome Object (Mandatory in classic configurations)" ON
                        "SALOME_LIGHT_ONLY" ON)
 OPTION(SALOME_USE_SINGLE_DESKTOP "Enable multiple document interface" ON)
 
-MARK_AS_ADVANCED(SALOME_LIGHT_ONLY SALOME_USE_VTKVIEWER SALOME_USE_GRAPHICSVIEW)
+MARK_AS_ADVANCED(SALOME_LIGHT_ONLY SALOME_USE_VTKVIEWER SALOME_USE_GRAPHICSVIEW SALOME_USE_PVVIEWER)
 MARK_AS_ADVANCED(SALOME_USE_SALOMEOBJECT SALOME_USE_OCCVIEWER SALOME_USE_GLVIEWER SALOME_USE_PLOT2DVIEWER)
 MARK_AS_ADVANCED(SALOME_USE_PYCONSOLE SALOME_USE_QXGRAPHVIEWER)
 MARK_AS_ADVANCED(SALOME_USE_SINGLE_DESKTOP)
@@ -167,9 +168,17 @@ IF(SALOME_USE_PLOT2DVIEWER)
 ELSE()
   ADD_DEFINITIONS("-DDISABLE_PLOT2DVIEWER")
 ENDIF()
+IF (SALOME_USE_PVVIEWER)
+  FIND_PACKAGE(SalomeParaView)
+  SALOME_LOG_OPTIONAL_PACKAGE(ParaView SALOME_USE_PVVIEWER)
+ELSE()
+  ADD_DEFINITIONS("-DDISABLE_PVVIEWER")
+ENDIF()
+
 IF (NOT SALOME_USE_GRAPHICSVIEW)
   ADD_DEFINITIONS("-DDISABLE_GRAPHICSVIEW")
 ENDIF()
+
 IF(SALOME_USE_PYCONSOLE)
   # Build with obsolete Python module's methods
   ADD_DEFINITIONS(-DCALL_OLD_METHODS)
@@ -322,6 +331,12 @@ IF(SALOME_USE_GRAPHICSVIEW)
        GraphicsView)
 ENDIF(SALOME_USE_GRAPHICSVIEW)
 
+# ParaView viewer specific targets:
+IF(SALOME_USE_PVVIEWER)
+  LIST(APPEND _${PROJECT_NAME}_exposed_targets PVViewer)
+ENDIF()
+
+
 # Python-based packages specific targets:
 IF(SALOME_USE_PYCONSOLE)
   LIST(APPEND _${PROJECT_NAME}_exposed_targets 
index a2807ff0d041c5e96ec0f410df86d01da5a5ac38..a7ee85bbe10f3c43951b5fa5c187f90d2b9d1c10 100644 (file)
@@ -58,6 +58,7 @@ SET(SALOME_USE_VTKVIEWER      @SALOME_USE_VTKVIEWER@)
 SET(SALOME_USE_PLOT2DVIEWER   @SALOME_USE_PLOT2DVIEWER@)
 SET(SALOME_USE_GRAPHICSVIEW   @SALOME_USE_GRAPHICSVIEW@)
 SET(SALOME_USE_QXGRAPHVIEWER  @SALOME_USE_QXGRAPHVIEWER@)
+SET(SALOME_USE_PVVIEWER       @SALOME_USE_PVVIEWER@)
 SET(SALOME_USE_PYCONSOLE      @SALOME_USE_PYCONSOLE@)
 SET(SALOME_USE_SALOMEOBJECT   @SALOME_USE_SALOMEOBJECT@)
 SET(SALOME_USE_SINGLE_DESKTOP @SALOME_USE_SINGLE_DESKTOP@)
@@ -88,6 +89,9 @@ ENDIF()
 IF (NOT SALOME_USE_GRAPHICSVIEW)
   LIST(APPEND GUI_DEFINITIONS "-DDISABLE_GRAPHICSVIEW")
 ENDIF()
+IF (NOT SALOME_USE_PVVIEWER)
+  LIST(APPEND GUI_DEFINITIONS "-DDISABLE_PVVIEWER")
+ENDIF()
 IF(NOT SALOME_USE_PYCONSOLE)
   LIST(APPEND GUI_DEFINITIONS "-DDISABLE_PYCONSOLE")
 ENDIF()
@@ -207,6 +211,7 @@ SET(GUI_ToolsGUI ToolsGUI)
 SET(GUI_ViewerTools ViewerTools)
 SET(GUI_ViewerData ViewerData)
 SET(GUI_VTKViewer VTKViewer)
+SET(GUI_PVViewer PVViewer)
 SET(GUI_vtkEDFOverloads vtkEDFOverloads)
 SET(GUI_vtkTools vtkTools)
 SET(GUI_SalomeGuiHelpers SalomeGuiHelpers)
index 0525b99f2fe12c06f349d1eba601b2520be27e75..19b67cbecc964d9996cec30af932f29be1df54f1 100755 (executable)
@@ -35,6 +35,7 @@ SET(_adm_data
   FindSalomeSIP.cmake
   FindSalomeGUI.cmake
   FindSalomeOpenGL.cmake
+  FindSalomeParaView.cmake
   UsePyQt4.cmake
   UseQt4Ext.cmake
 )
diff --git a/adm_local/cmake_files/FindSalomeParaView.cmake b/adm_local/cmake_files/FindSalomeParaView.cmake
new file mode 100644 (file)
index 0000000..e7497ef
--- /dev/null
@@ -0,0 +1,30 @@
+# 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
+#
+# Author: Adrien Bruneton
+#
+
+# Graphviz detection for salome
+#
+#  !! Please read the generic detection procedure in SalomeMacros.cmake !!
+#
+
+SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(ParaView PARAVIEW_USE_FILE 4)
+#MARK_AS_ADVANCED()
+
+INCLUDE(${PARAVIEW_USE_FILE})
index 54e4e19ad5386e60b806027dd0761ad9ab41906d..3e0001ecaf2af45e9488830d86088a146a7e0fef 100755 (executable)
@@ -85,6 +85,12 @@ IF(SALOME_USE_GRAPHICSVIEW)
   SET(SUBDIRS_GRAPHICSVIEW GraphicsView)
 ENDIF(SALOME_USE_GRAPHICSVIEW)
 
+# ParaView Viewer
+IF(SALOME_USE_PVVIEWER)
+  SET(SUBDIRS_PVVIEWER PVViewer)
+ENDIF()
+
+
 ##
 # Python-based packages
 ##
@@ -119,6 +125,7 @@ SET(SUBDIRS
   ${SUBDIRS_OCCVIEWER}
   ${SUBDIRS_PLOT2DVIEWER}
   ${SUBDIRS_QXGRAPHVIEWER}
+  ${SUBDIRS_PVVIEWER}
   ${SUBDIRS_GRAPHICSVIEW}
   ${SUBDIRS_PYCONSOLE}
   ${SUBDIRS_LIGHT}
index 736648da946ae33c7d81eea09cb706ea6acff418..ea154893ac7dcda1fb0cb15d495299b4bf9a47be 100755 (executable)
@@ -71,6 +71,9 @@ ENDIF()
 IF(SALOME_USE_QXGRAPHVIEWER)
   INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/QxScene)
 ENDIF()
+IF(SALOME_USE_PVVIEWER)
+  INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/PVViewer)
+ENDIF()
 IF(SALOME_USE_PYCONSOLE)
   INCLUDE_DIRECTORIES(
     ${PYTHON_INCLUDE_DIRS}
index edc93cedadcbe59bd338826eb7221eceacc9a458..9328eda7379eea9db7752cc41d72c34af73ccad8 100644 (file)
   #include "LightApp_GVSelector.h"
 #endif
 
+#ifndef DISABLE_PVVIEWER
+  #include "PVViewer_ViewManager.h"
+  #include "PVViewer_ViewWindow.h"
+  #include "PVViewer_ViewModel.h"
+#endif
+
+
 #define VISIBILITY_COLUMN_WIDTH 25
 
 #include <QDir>
@@ -729,6 +736,9 @@ void LightApp_Application::createActions()
 #ifndef DISABLE_GRAPHICSVIEW
   createActionForViewer( NewGraphicsViewId, newWinMenu, QString::number( 5 ), Qt::ALT+Qt::Key_R );
 #endif
+#ifndef DISABLE_PVVIEWER
+  createActionForViewer( NewPVViewId, newWinMenu, QString::number( 6 ), Qt::ALT+Qt::Key_W );
+#endif
 
   createAction( RenameId, tr( "TOT_RENAME" ), QIcon(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ),
                 Qt::ALT+Qt::SHIFT+Qt::Key_R, desk, false, this, SLOT( onRenameWindow() ) );
@@ -848,6 +858,11 @@ void LightApp_Application::onNewWindow()
   case NewGraphicsViewId:
     type = GraphicsView_Viewer::Type();
     break;
+#endif
+#ifndef DISABLE_PVVIEWER
+  case NewPVViewId:
+    type = PVViewer_Viewer::Type();
+    break;
 #endif
   }
 
@@ -993,6 +1008,12 @@ void LightApp_Application::updateCommandsStatus()
   if( a )
     a->setEnabled( activeStudy() );
 #endif
+
+#ifndef DISABLE_PVVIEWER
+  a = action( NewPVViewId );
+  if( a )
+    a->setEnabled( activeStudy() );
+#endif
 }
 
 /*!
@@ -1427,6 +1448,12 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType
     new LightApp_GVSelector( (GraphicsView_Viewer*)viewMgr->getViewModel(), mySelMgr );
   }
 #endif
+#ifndef DISABLE_PVVIEWER
+  if( vmType == PVViewer_Viewer::Type() )
+  {
+    viewMgr = new PVViewer_ViewManager( activeStudy(), desktop() );
+  }
+#endif
 #ifndef DISABLE_OCCVIEWER
   if( vmType == OCCViewer_Viewer::Type() )
   {
@@ -3923,6 +3950,9 @@ QStringList LightApp_Application::viewManagersTypes() const
 #ifndef DISABLE_QXGRAPHVIEWER
   aTypesList<<QxScene_Viewer::Type();
 #endif
+#ifndef DISABLE_PVVIEWER
+  aTypesList<<PVViewer_Viewer::Type();
+#endif
 #ifndef DISABLE_OCCVIEWER
   aTypesList<<OCCViewer_Viewer::Type();
 #endif
index 3e43869f4defdd53be0815de85ba0b128d06cb3a..51c6f3486e35f44a0b62ce4de2492ac7ecc60b40 100644 (file)
@@ -87,7 +87,7 @@ public:
          CloseId, CloseAllId, GroupAllId,
          PreferencesId, MRUId, ModulesListId,
          NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId,
-         NewQxSceneViewId, NewGraphicsViewId, StyleId, FullScreenId,
+         NewQxSceneViewId, NewGraphicsViewId, NewPVViewId, StyleId, FullScreenId,
          UserID };
 
 protected:
index 2127f020835172cb37488d7693dd7b74107294d8..45954c3824991b60db002248ed4fa6adc95d0142 100644 (file)
   #include <GLViewer_ViewFrame.h>
   #include <GLViewer_ViewPort.h>
 #endif
+#ifndef DISABLE_PVVIEWER
+  #include <PVViewer_ViewManager.h>
+  #include <PVViewer_ViewWindow.h>
+#endif
 #ifndef DISABLE_PLOT2DVIEWER
   #include <Plot2d_ViewWindow.h>
   #include <Plot2d_ViewFrame.h>
@@ -382,6 +386,10 @@ void LightApp_Module::update( const int theFlags )
 #ifndef DISABLE_GLVIEWER
         if ( viewWnd->inherits( "GLViewer_ViewFrame" ) )
           ( (GLViewer_ViewFrame*)viewWnd )->getViewPort()->onUpdate();
+#endif
+#ifndef DISABLE_PVVIEWER
+//        if ( viewWnd->inherits( "PVViewer_ViewWindow" ) )
+//          ( (PVViewer_ViewWindow*)viewWnd )->getViewPort()->onUpdate();
 #endif
       }
   }
index 7667c0ec6ce5eb9d698b9b70d39fc0c95784a3e4..7de00cdf59f6288c2afe2bd017bd8ddcb82b26c7 100755 (executable)
@@ -36,3 +36,5 @@ Plot2d = $(GUI_ROOT_DIR)/share/salome/resources/gui
 GLViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui
 OCCViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui
 VTKViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui
+PVViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui
+
index 35aaef3daf5658f505638bb874e45b0036a9f421..e058e9820ccf0e55d6af38786c2aa86b92007da0 100644 (file)
@@ -68,6 +68,7 @@
     <parameter name="GraphicsView" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="OCCViewer"    value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="VTKViewer"    value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
+       <parameter name="PVViewer"     value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>    
     <parameter name="QxSceneViewer" value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="PyConsole"    value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="SalomeApp"    value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
index 94dae2e0b35b4dcfd01ecfc83b0c03784d1ecde7..70a47fade0c6316078e11e46ebbeaa1d510317cc 100644 (file)
@@ -471,6 +471,10 @@ The changes will be applied on the next application session.</translation>
         <source>NEW_WINDOW_5</source>
         <translation>G&amp;raphics view</translation>
     </message>
+    <message>
+        <source>NEW_WINDOW_6</source>
+        <translation>ParaVie&amp;w view</translation>
+    </message>
     <message>
         <source>CREATING_NEW_WINDOW</source>
         <translation>Create new %1</translation>
diff --git a/src/PVViewer/CMakeLists.txt b/src/PVViewer/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c6f341e
--- /dev/null
@@ -0,0 +1,100 @@
+# 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}
+    ${CMAKE_SOURCE_DIR}/src/SUIT
+    ${CMAKE_SOURCE_DIR}/src/CAM
+    ${CMAKE_SOURCE_DIR}/src/STD
+    ${CMAKE_SOURCE_DIR}/src/LightApp
+    ${CMAKE_SOURCE_DIR}/src/SalomeApp
+    ${CMAKE_SOURCE_DIR}/src/Qtx
+    ${CMAKE_SOURCE_DIR}/src/Event
+    ${CMAKE_SOURCE_DIR}/src/PyInterp
+    ${CMAKE_SOURCE_DIR}/src/PyConsole
+    ${CMAKE_SOURCE_DIR}/src/LogWindow
+    )
+
+SET(_PARAVIEW_APP_COMPO_LIB
+  pqApplicationComponents
+  )
+
+ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
+ADD_DEFINITIONS(${OMNIORB_DEFINITIONS})
+
+SET(_link_LIBRARIES 
+  ${KERNEL_LDFLAGS} ${KERNEL_SALOMELocalTrace} 
+  ${GUI_LDFLAGS} ${GUI_SalomeApp} ${GUI_LightApp} ${GUI_suit} ${GUI_Event} 
+  ${_PARAVIEW_APP_COMPO_LIB}
+)
+
+# --- headers ---
+
+# header files / to be processed by moc
+SET(_moc_HEADERS
+  PVViewer_ViewManager.h
+  PVViewer_ViewModel.h
+  PVViewer_ViewWindow.h
+  PVViewer_Behaviors.h
+  PVViewer_GUIElements.h
+)
+
+# header files / no moc processing
+SET(_other_HEADERS
+  PVViewer_LogWindowAdapter.h
+  PVViewer_EngineWrapper.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
+  PVViewer_ViewManager.cxx
+  PVViewer_ViewModel.cxx
+  PVViewer_ViewWindow.cxx
+  PVViewer_LogWindowAdapter.cxx
+  PVViewer_Behaviors.cxx
+  PVViewer_GUIElements.cxx
+  PVViewer_EngineWrapper.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/PVViewer/PVViewer_Behaviors.cxx b/src/PVViewer/PVViewer_Behaviors.cxx
new file mode 100644 (file)
index 0000000..75fc467
--- /dev/null
@@ -0,0 +1,129 @@
+// 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
+//
+// Author: Adrien Bruneton (CEA)
+
+#include "PVViewer_Behaviors.h"
+
+#include <SUIT_Desktop.h>
+#include <SalomeApp_Module.h>
+
+#include <pqInterfaceTracker.h>
+#include <pqApplicationCore.h>
+#include <pqPluginManager.h>
+#include <pqStandardPropertyWidgetInterface.h>
+#include <pqStandardViewFrameActionsImplementation.h>
+#include <pqPropertiesPanel.h>
+
+#include <pqAlwaysConnectedBehavior.h>
+#include <pqAutoLoadPluginXMLBehavior.h>
+#include <pqCommandLineOptionsBehavior.h>
+#include <pqCrashRecoveryBehavior.h>
+#include <pqDataTimeStepBehavior.h>
+#include <pqDefaultViewBehavior.h>
+#include <pqObjectPickingBehavior.h>
+#include <pqPersistentMainWindowStateBehavior.h>
+#include <pqPipelineContextMenuBehavior.h>
+#include <pqPluginActionGroupBehavior.h>
+#include <pqPluginDockWidgetsBehavior.h>
+#include <pqSpreadSheetVisibilityBehavior.h>
+#include <pqUndoRedoBehavior.h>
+#include <pqViewStreamingBehavior.h>
+#include <pqCollaborationBehavior.h>
+#include <pqVerifyRequiredPluginBehavior.h>
+#include <pqPluginSettingsBehavior.h>
+#include <pqFixPathsInStateFilesBehavior.h>
+#include <pqApplyBehavior.h>
+
+#include <pqPropertiesPanel.h>
+
+int PVViewer_Behaviors::BehaviorLoadingLevel = 0;
+
+PVViewer_Behaviors::PVViewer_Behaviors(SUIT_Desktop * parent)
+  : QObject(static_cast<QObject *>(parent))
+{
+}
+
+/**! Instanciate minimal ParaView behaviors needed when using an instance of PVViewer.
+ * This method should be updated at each new version of ParaView with what is found in
+ *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
+ */
+void PVViewer_Behaviors::instanciateMinimalBehaviors(SUIT_Desktop * desk)
+{
+  if (BehaviorLoadingLevel < 1)
+    {
+      // Register ParaView interfaces.
+      pqInterfaceTracker* pgm = pqApplicationCore::instance()->interfaceTracker();
+
+      // Register standard types of property widgets.
+      pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm));
+      // Register standard types of view-frame actions.
+      pgm->addInterface(new pqStandardViewFrameActionsImplementation(pgm));
+
+      // Load plugins distributed with application.
+      pqApplicationCore::instance()->loadDistributedPlugins();
+
+      new pqDefaultViewBehavior(this);  // shows a 3D view as soon as a server connection is made
+      new pqAlwaysConnectedBehavior(this);  // client always connected to a server
+      new pqAutoLoadPluginXMLBehavior(this);  // auto load plugins
+      new pqVerifyRequiredPluginBehavior(this);
+      new pqPluginSettingsBehavior(this);
+      new pqFixPathsInStateFilesBehavior(this);
+      new pqCrashRecoveryBehavior(this);
+      new pqCommandLineOptionsBehavior(this);
+
+      BehaviorLoadingLevel = 1;
+    }
+}
+
+/**! Instanciate usual ParaView behaviors.
+ * This method should be updated at each new version of ParaView with what is found in
+ *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
+ */
+void PVViewer_Behaviors::instanciateAllBehaviors(SUIT_Desktop * desk)
+{
+  //    "new pqParaViewBehaviors(anApp->desktop(), this);"
+  // -> (which loads all standard ParaView behaviors at once) has to be replaced in order to
+  // exclude using of pqQtMessageHandlerBehaviour
+
+  // Define application behaviors.
+  if (BehaviorLoadingLevel < 1)
+    instanciateMinimalBehaviors(desk);
+
+  if (BehaviorLoadingLevel < 2)
+    {
+      //new pqQtMessageHandlerBehavior(this);   // THIS ONE TO EXCLUDE !! see comment above
+      new pqDataTimeStepBehavior(this);
+      new pqSpreadSheetVisibilityBehavior(this);
+      new pqPipelineContextMenuBehavior(this);
+      new pqUndoRedoBehavior(this);
+      new pqPluginDockWidgetsBehavior(desk);
+      new pqPluginActionGroupBehavior(desk);
+      new pqPersistentMainWindowStateBehavior(desk);
+      new pqObjectPickingBehavior(desk);
+      new pqCollaborationBehavior(this);
+      new pqViewStreamingBehavior(this);
+
+      pqApplyBehavior* applyBehavior = new pqApplyBehavior(this);
+      foreach (pqPropertiesPanel* ppanel, desk->findChildren<pqPropertiesPanel*>())
+      {
+        applyBehavior->registerPanel(ppanel);
+      }
+      BehaviorLoadingLevel = 2;
+    }
+}
diff --git a/src/PVViewer/PVViewer_Behaviors.h b/src/PVViewer/PVViewer_Behaviors.h
new file mode 100644 (file)
index 0000000..fa2d32a
--- /dev/null
@@ -0,0 +1,55 @@
+// 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
+//
+// Author: Adrien Bruneton (CEA)
+
+
+#ifndef PVGUIBEHAVIORS_H_
+#define PVGUIBEHAVIORS_H_
+
+#include <QObject>
+
+class SalomeApp_Module;
+class SUIT_Desktop;
+class pqPropertiesPanel;
+
+/**!
+ * PARAVIS behaviors - mimic what is done in
+ *    Qt/ApplicationComponents/pqParaViewBehaviors.cxx
+ * Except a few ones, behaviors are destroyed when the module is destroyed.
+ */
+class PVViewer_Behaviors: public QObject
+{
+  Q_OBJECT
+
+public:
+  PVViewer_Behaviors(SUIT_Desktop * parent);
+
+  void instanciateMinimalBehaviors(SUIT_Desktop * desk);
+  void instanciateAllBehaviors(SUIT_Desktop * desk);
+
+  virtual ~PVViewer_Behaviors() {}
+
+//public slots:
+//  void onEmulateApply();
+
+private:
+  static int BehaviorLoadingLevel;
+};
+
+#endif /* PVGUIBEHAVIORS_H_ */
diff --git a/src/PVViewer/PVViewer_EngineWrapper.cxx b/src/PVViewer/PVViewer_EngineWrapper.cxx
new file mode 100644 (file)
index 0000000..708d6bc
--- /dev/null
@@ -0,0 +1,91 @@
+// 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
+//
+// Author: Adrien Bruneton (CEA)
+
+#include "PVViewer_EngineWrapper.h"
+#include <Utils_SALOME_Exception.hxx>
+
+PVViewer_EngineWrapper * PVViewer_EngineWrapper::instance = NULL;
+
+PVViewer_EngineWrapper::PVViewer_EngineWrapper() :
+    paravisEngine(NULL)
+{
+//  const char * cmd = "import PARAVIS_utils;e=";
+  PyLockWrapper lock;
+  const char* code = "import PARAVIS_utils as pa;__enginePARAVIS=pa.getEngine()";
+  int ret = PyRun_SimpleString(const_cast<char*>(code));
+
+  if (ret == -1)
+    throw SALOME_Exception("Unable to retrieve PARAVIS engine!");
+
+  // Now get the reference to __engine and save the pointer.
+  PyObject* main_module = PyImport_AddModule((char*)"__main__");
+  PyObject* global_dict = PyModule_GetDict(main_module);
+  PyObjWrapper tmp(PyDict_GetItemString(global_dict, "__enginePARAVIS"));
+  paravisEngine = tmp;
+}
+
+
+PVViewer_EngineWrapper * PVViewer_EngineWrapper::GetInstance()
+{
+  if (!instance)
+    instance = new PVViewer_EngineWrapper();
+  return instance;
+}
+
+bool PVViewer_EngineWrapper::GetGUIConnected()
+{
+  PyLockWrapper lock;
+  PyObjWrapper obj(PyObject_CallMethod(paravisEngine, (char*)("GetGUIConnected"), NULL));
+  if (!obj)
+    {
+      PyErr_Print();
+      throw SALOME_Exception("Unable to invoke PARAVIS engine!");
+    }
+  return PyObject_IsTrue(obj);
+}
+
+void PVViewer_EngineWrapper::SetGUIConnected(bool isConnected)
+{
+  PyLockWrapper lock;
+
+  PyObjWrapper obj(PyObject_CallMethod(paravisEngine, (char*)("SetGUIConnected"),
+                                       (char *)"i", (int)isConnected ) );
+  if (!obj)
+    {
+      PyErr_Print();
+      throw SALOME_Exception("Unable to invoke PARAVIS engine!");
+    }
+}
+
+std::string PVViewer_EngineWrapper::FindOrStartPVServer(int port)
+{
+  PyLockWrapper lock;
+
+  PyObjWrapper obj(PyObject_CallMethod(paravisEngine, (char*)("FindOrStartPVServer"),
+                                         (char *)"i", port ) );
+  if (!obj)
+    {
+      PyErr_Print();
+      throw SALOME_Exception("Unable to invoke PARAVIS engine!");
+    }
+  char * s = PyString_AsString(obj);
+
+  return std::string(s);
+}
diff --git a/src/PVViewer/PVViewer_EngineWrapper.h b/src/PVViewer/PVViewer_EngineWrapper.h
new file mode 100644 (file)
index 0000000..328e120
--- /dev/null
@@ -0,0 +1,48 @@
+// 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
+//
+// Author: Adrien Bruneton (CEA)
+
+#ifndef PVVIEWERENGINEWRAPPER_H_
+#define PVVIEWERENGINEWRAPPER_H_
+
+#include <PyInterp_Utils.h>
+#include <string>
+
+/*!
+ * Class facilitating the access to the PARAVIS engine without having to link
+ * to it.
+ */
+class PVViewer_EngineWrapper
+{
+public:
+  static PVViewer_EngineWrapper * GetInstance();
+
+  bool GetGUIConnected();
+  void SetGUIConnected(bool isConnected);
+  std::string FindOrStartPVServer(int port);
+
+private:
+  PVViewer_EngineWrapper();
+  virtual ~PVViewer_EngineWrapper() {}
+
+  static PVViewer_EngineWrapper * instance;
+  PyObjWrapper paravisEngine;
+};
+
+#endif /* PVVIEWERENGINEWRAPPER_H_ */
diff --git a/src/PVViewer/PVViewer_GUIElements.cxx b/src/PVViewer/PVViewer_GUIElements.cxx
new file mode 100644 (file)
index 0000000..57e1c15
--- /dev/null
@@ -0,0 +1,102 @@
+// 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
+//
+// Author: Adrien Bruneton (CEA)
+
+#include "PVViewer_GUIElements.h"
+#include "SUIT_Desktop.h"
+
+#include <pqPropertiesPanel.h>
+#include <pqPipelineBrowserWidget.h>
+#include <pqParaViewMenuBuilders.h>
+
+#include <QMenu>
+#include <QList>
+#include <QAction>
+
+PVViewer_GUIElements * PVViewer_GUIElements::theInstance = 0;
+
+PVViewer_GUIElements::PVViewer_GUIElements(SUIT_Desktop* desk) :
+  propertiesPanel(0), pipelineBrowserWidget(0),
+  sourcesMenu(0)
+{
+  propertiesPanel = new pqPropertiesPanel(desk);
+  pipelineBrowserWidget  = new pqPipelineBrowserWidget(desk);
+
+  sourcesMenu = new QMenu(desk);
+  pqParaViewMenuBuilders::buildSourcesMenu(*sourcesMenu, desk);
+
+  filtersMenu = new QMenu(desk);
+  pqParaViewMenuBuilders::buildFiltersMenu(*filtersMenu, desk);
+
+  macrosMenu = new QMenu(desk);
+  pqParaViewMenuBuilders::buildMacrosMenu(*macrosMenu);
+}
+
+PVViewer_GUIElements * PVViewer_GUIElements::GetInstance(SUIT_Desktop* desk)
+{
+  if (! theInstance)
+    theInstance = new PVViewer_GUIElements(desk);
+  return theInstance;
+}
+
+void PVViewer_GUIElements::updateSourcesMenu(QMenu *menu)
+{
+  if (menu)
+    {
+      menu->clear();
+      QList<QAction *> act_list = sourcesMenu->actions();
+      foreach(QAction * a, act_list)
+      {
+        menu->addAction(a);
+      }
+    }
+}
+
+void PVViewer_GUIElements::updateFiltersMenu(QMenu *menu)
+{
+  if (menu)
+    {
+      menu->clear();
+      QList<QAction *> act_list = filtersMenu->actions();
+      foreach(QAction * a, act_list)
+      {
+        menu->addAction(a);
+      }
+    }
+}
+
+void PVViewer_GUIElements::updateMacrosMenu(QMenu *menu)
+{
+  if (menu)
+    {
+      menu->clear();
+      QList<QAction *> act_list = macrosMenu->actions();
+      foreach(QAction * a, act_list)
+      {
+        menu->addAction(a);
+      }
+    }
+}
+
+
+void PVViewer_GUIElements::onEmulateApply()
+{
+  if (propertiesPanel)
+    propertiesPanel->apply();
+}
diff --git a/src/PVViewer/PVViewer_GUIElements.h b/src/PVViewer/PVViewer_GUIElements.h
new file mode 100644 (file)
index 0000000..ca0634e
--- /dev/null
@@ -0,0 +1,71 @@
+// 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
+//
+// Author: Adrien Bruneton (CEA)
+
+#ifndef PVVIEWERGUIELEMENTS_H_
+#define PVVIEWERGUIELEMENTS_H_
+
+#include <QObject>
+
+class pqPropertiesPanel;
+class pqPipelineBrowserWidget;
+class SUIT_Desktop;
+class QMenu;
+
+/*!
+ * Some GUI elements of ParaView need to be instanciated in a proper order. This class
+ * holds all of them for the sake of clarity.
+ * For example sources menu should be built *before* loading ParaView's configuration, so that the
+ * list of sources gets properly populated.
+ */
+class PVViewer_GUIElements: public QObject
+{
+  Q_OBJECT
+
+public:
+  static PVViewer_GUIElements * GetInstance(SUIT_Desktop* desk);
+
+  pqPropertiesPanel * getPropertiesPanel() { return propertiesPanel; }
+  pqPipelineBrowserWidget * getPipelineBrowserWidget() { return pipelineBrowserWidget; }
+
+  // Update the sources menu from what was built in private member 'sourcesMenu'
+  void updateSourcesMenu(QMenu *);
+  void updateFiltersMenu(QMenu *);
+  void updateMacrosMenu(QMenu *);
+
+public slots:
+  void onEmulateApply();  // better use the slot from PVViewer_ViewManager if you want to trigger "Apply"
+
+private:
+  PVViewer_GUIElements(SUIT_Desktop* desk);
+  virtual ~PVViewer_GUIElements() {}
+
+  static PVViewer_GUIElements * theInstance;
+
+  // Widgets
+  pqPropertiesPanel * propertiesPanel;
+  pqPipelineBrowserWidget * pipelineBrowserWidget;
+
+  // Dummy QMenus receiving ParaView's reaction for automatic add when new sources are added
+  QMenu * sourcesMenu;
+  QMenu * filtersMenu;
+  QMenu * macrosMenu;
+};
+
+#endif /* PVVIEWERGUIELEMENTS_H_ */
diff --git a/src/PVViewer/PVViewer_LogWindowAdapter.cxx b/src/PVViewer/PVViewer_LogWindowAdapter.cxx
new file mode 100644 (file)
index 0000000..736b77b
--- /dev/null
@@ -0,0 +1,119 @@
+// 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 "PVViewer_LogWindowAdapter.h"
+
+#include <vtkObjectFactory.h>
+
+#include <LightApp_Application.h>
+#include <LogWindow.h>
+#include <SUIT_Session.h>
+#include <SALOME_Event.h>
+
+vtkStandardNewMacro(PVViewer_LogWindowAdapter);
+
+
+
+/*!
+ * Put the message in the log window. 
+ */
+class TEvent: public SALOME_Event {
+  LogWindow* myWindow;
+  QString    myMsg;
+  QColor     myColor;
+  int        myFlags;
+  public:
+  TEvent( LogWindow* theWindow,  const QString theMsg, const QColor theColor, const int flags) :
+    myWindow ( theWindow ),
+    myMsg ( theMsg ),
+    myColor ( theColor ),
+    myFlags (flags)
+  {}
+
+  virtual void Execute() {
+    if(myWindow)
+      myWindow->putMessage(myMsg, myColor, myFlags);
+  }
+};
+
+
+PVViewer_LogWindowAdapter::PVViewer_LogWindowAdapter() :
+  TextCount(0),
+  ErrorCount(0),
+  WarningCount(0),
+  GenericWarningCount(0)
+{
+}
+
+PVViewer_LogWindowAdapter::~PVViewer_LogWindowAdapter()
+{
+}
+
+const unsigned int PVViewer_LogWindowAdapter::getTextCount()
+{
+  return this->TextCount;
+}
+
+const unsigned int PVViewer_LogWindowAdapter::getErrorCount()
+{
+  return this->ErrorCount;
+}
+
+const unsigned int PVViewer_LogWindowAdapter::getWarningCount()
+{
+  return this->WarningCount;
+}
+
+const unsigned int PVViewer_LogWindowAdapter::getGenericWarningCount()
+{
+  return this->GenericWarningCount;
+}
+
+static LogWindow* getLogWindow()
+{
+  LogWindow* wnd = 0;
+  LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() );
+  if ( anApp )
+    wnd = anApp->logWindow();
+  return wnd;
+}
+
+void PVViewer_LogWindowAdapter::DisplayText(const char* text)
+{
+  ++this->TextCount;
+  ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::darkGreen, LogWindow::DisplayNormal ));
+}
+
+void PVViewer_LogWindowAdapter::DisplayErrorText(const char* text)
+{
+  ++this->ErrorCount;
+  ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::darkRed, LogWindow::DisplayNormal ));
+}
+
+void PVViewer_LogWindowAdapter::DisplayWarningText(const char* text)
+{
+  ++this->WarningCount;
+  ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::black, LogWindow::DisplayNormal ));
+}
+
+void PVViewer_LogWindowAdapter::DisplayGenericWarningText(const char* text)
+{
+  ++this->GenericWarningCount;
+  ProcessVoidEvent( new TEvent( getLogWindow() , text, Qt::black, LogWindow::DisplayNormal ));
+}
diff --git a/src/PVViewer/PVViewer_LogWindowAdapter.h b/src/PVViewer/PVViewer_LogWindowAdapter.h
new file mode 100644 (file)
index 0000000..cd8332a
--- /dev/null
@@ -0,0 +1,65 @@
+// 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
+//
+
+#ifndef _PVViewer_LogWindowAdapter_h
+#define _PVViewer_LogWindowAdapter_h
+
+#include <vtkOutputWindow.h>
+
+/*!
+vtkOutputWindow implementation that puts VTK output messages to SALOME log window.
+
+To use, create an instance of PVViewer_LogWindowAdapter and pass it to the
+vtkOutputWindow::setInstance() static method.
+
+This class is based on pqOutputWindow ParaView class.
+*/
+class PVViewer_LogWindowAdapter : public vtkOutputWindow
+{
+public:
+  static PVViewer_LogWindowAdapter *New();
+  vtkTypeMacro(PVViewer_LogWindowAdapter, vtkOutputWindow);
+
+  //! Returns the number of text messages received
+  const unsigned int getTextCount();
+  //! Returns the number of error messages received
+  const unsigned int getErrorCount();
+  //! Returns the number of warning messages received
+  const unsigned int getWarningCount();
+  //! Returns the number of generic warning messages received
+  const unsigned int getGenericWarningCount();
+
+private:
+  PVViewer_LogWindowAdapter();
+  PVViewer_LogWindowAdapter(const PVViewer_LogWindowAdapter&);
+  PVViewer_LogWindowAdapter& operator=(const PVViewer_LogWindowAdapter&);
+  ~PVViewer_LogWindowAdapter();
+
+  unsigned int TextCount;
+  unsigned int ErrorCount;
+  unsigned int WarningCount;
+  unsigned int GenericWarningCount;
+
+  virtual void DisplayText(const char*);
+  virtual void DisplayErrorText(const char*);
+  virtual void DisplayWarningText(const char*);
+  virtual void DisplayGenericWarningText(const char*);
+};
+
+#endif // !_PVViewer_LogWindowAdapter_h
diff --git a/src/PVViewer/PVViewer_ViewManager.cxx b/src/PVViewer/PVViewer_ViewManager.cxx
new file mode 100644 (file)
index 0000000..a0c819e
--- /dev/null
@@ -0,0 +1,260 @@
+// 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 "PVViewer_ViewManager.h"
+#include "PVViewer_ViewModel.h"
+#include "PVViewer_ViewWindow.h"
+#include "PVViewer_LogWindowAdapter.h"
+#include "PVViewer_GUIElements.h"
+#include "PVViewer_Behaviors.h"
+#include "PVViewer_EngineWrapper.h"
+
+#include <utilities.h>
+#include <SalomeApp_Application.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <PyInterp_Interp.h>
+#include <PyConsole_Interp.h>
+#include <PyConsole_Console.h>
+
+#include <QApplication>
+#include <QStringList>
+#include <QDir>
+
+#include <string>
+
+#include <pqOptions.h>
+#include <pqServer.h>
+#include <pqSettings.h>
+#include <pqServerDisconnectReaction.h>
+#include <pqPVApplicationCore.h>
+#include <pqTabbedMultiViewWidget.h>
+#include <pqActiveObjects.h>
+#include <pqServerConnectReaction.h>
+
+#include <pqParaViewMenuBuilders.h>
+#include <pqPipelineBrowserWidget.h>
+
+//---------- Static init -----------------
+pqPVApplicationCore* PVViewer_ViewManager::MyCoreApp = 0;
+bool PVViewer_ViewManager::ConfigLoaded = false;
+PVViewer_Behaviors * PVViewer_ViewManager::ParaviewBehaviors = NULL;
+
+/*!
+  Constructor
+*/
+PVViewer_ViewManager::PVViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* desk )
+: SUIT_ViewManager( study, desk, new PVViewer_Viewer() ),
+  desktop(desk)
+{
+  MESSAGE("PARAVIS - view manager created ...")
+  setTitle( tr( "PARAVIEW_VIEW_TITLE" ) );
+  // Initialize minimal paraview stuff (if not already done)
+  ParaviewInitApp(desk);
+
+//  connect(this, SIGNAL(viewCreated(SUIT_ViewWindow*)), this, SLOT(onPVViewCreated(SUIT_ViewWindow*)));
+}
+
+pqPVApplicationCore * PVViewer_ViewManager::GetPVApplication()
+{
+  return MyCoreApp;
+}
+
+/*!
+  \brief Static method, performs initialization of ParaView session.
+  \param fullSetup whether to instanciate all behaviors or just the minimal ones.
+  \return \c true if ParaView has been initialized successfully, otherwise false
+*/
+bool PVViewer_ViewManager::ParaviewInitApp(SUIT_Desktop * aDesktop)
+{
+  if ( ! MyCoreApp) {
+      // Obtain command-line arguments
+      int argc = 0;
+      char** argv = 0;
+      QString aOptions = getenv("PARAVIS_OPTIONS");
+      QStringList aOptList = aOptions.split(":", QString::SkipEmptyParts);
+      argv = new char*[aOptList.size() + 1];
+      QStringList args = QApplication::arguments();
+      argv[0] = (args.size() > 0)? strdup(args[0].toLatin1().constData()) : strdup("paravis");
+      argc++;
+
+      foreach (QString aStr, aOptList) {
+        argv[argc] = strdup( aStr.toLatin1().constData() );
+        argc++;
+      }
+      MyCoreApp = new pqPVApplicationCore (argc, argv);
+      if (MyCoreApp->getOptions()->GetHelpSelected() ||
+          MyCoreApp->getOptions()->GetUnknownArgument() ||
+          MyCoreApp->getOptions()->GetErrorMessage() ||
+          MyCoreApp->getOptions()->GetTellVersion()) {
+          return false;
+      }
+
+      // Direct VTK log messages to our SALOME window - TODO: review this
+      vtkOutputWindow::SetInstance(PVViewer_LogWindowAdapter::New());
+
+      new pqTabbedMultiViewWidget(); // registers a "MULTIVIEW_WIDGET" on creation
+
+      // At this stage, the pqPythonManager has been initialized, i.e. the current process has
+      // activated the embedded Python interpreter. "paraview" package has also been imported once already.
+      // Make sure the current process executes paraview's Python command with the "fromGUI" flag.
+      // This is used in pvsimple.py to avoid reconnecting the GUI thread to the pvserver (when
+      // user types "import pvsimple" in SALOME's console).
+      SalomeApp_Application* app =
+                  dynamic_cast< SalomeApp_Application* >(SUIT_Session::session()->activeApplication());
+      PyConsole_Interp* pyInterp = app->pythonConsole()->getInterp();
+      {
+        PyLockWrapper aGil;
+        std::string cmd = "import paraview;paraview.fromGUI = True";
+        pyInterp->run(cmd.c_str());
+      }
+
+      for (int i = 0; i < argc; i++)
+        free(argv[i]);
+      delete[] argv;
+  }
+  // Initialize GUI elements if needed:
+  PVViewer_GUIElements::GetInstance(aDesktop);
+  return true;
+}
+
+void PVViewer_ViewManager::ParaviewInitBehaviors(bool fullSetup, SUIT_Desktop* aDesktop)
+{
+  if (!ParaviewBehaviors)
+      ParaviewBehaviors = new PVViewer_Behaviors(aDesktop);
+
+  if(fullSetup)
+    ParaviewBehaviors->instanciateAllBehaviors(aDesktop);
+  else
+    ParaviewBehaviors->instanciateMinimalBehaviors(aDesktop);
+}
+
+void PVViewer_ViewManager::ParaviewLoadConfigurations()
+{
+  if (!ConfigLoaded)
+    {
+      SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+      QString aPath = resMgr->stringValue("resources", "PARAVIS", QString());
+      if (!aPath.isNull()) {
+          MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewFilters.xml");
+          MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewReaders.xml");
+          MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewSources.xml");
+          MyCoreApp->loadConfiguration(aPath + QDir::separator() + "ParaViewWriters.xml");
+      }
+      ConfigLoaded = true;
+    }
+}
+
+void PVViewer_ViewManager::ParaviewCleanup()
+{
+  // Disconnect from server
+  pqServer* server = pqActiveObjects::instance().activeServer();
+  if (server && server->isRemote())
+    {
+      MESSAGE("~PVViewer_Module(): Disconnecting from remote server ...");
+      pqServerDisconnectReaction::disconnectFromServer();
+    }
+
+  pqApplicationCore::instance()->settings()->sync();
+
+  pqPVApplicationCore * app = GetPVApplication();
+  // Schedule destruction of PVApplication singleton:
+  if (app)
+    app->deleteLater();
+}
+
+PVViewer_EngineWrapper * PVViewer_ViewManager::GetEngine()
+{
+  return PVViewer_EngineWrapper::GetInstance();
+}
+
+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())
+    {
+      // Already connected to an external server, do nothing
+      MESSAGE("connectToExternalPVServer(): Already connected to an external PVServer, won't reconnect.");
+      return false;
+    }
+
+  if (GetEngine()->GetGUIConnected())
+    {
+      // Should never be there as the above should already tell us that we are connected.
+      std::stringstream msg2;
+      msg2 << "Internal error while connecting to the pvserver.";
+      msg2 << "ParaView doesn't see a connection, but PARAVIS engine tells us there is already one!" << std::endl;
+      qWarning(msg2.str().c_str());  // will go to the ParaView console (see ParavisMessageOutput below)
+      SUIT_MessageBox::warning( aDesktop,
+                                      QString("Error connecting to PVServer"), QString(msg2.str().c_str()));
+      return false;
+    }
+
+  std::stringstream msg;
+
+  // Try to connect to the external PVServer - gives priority to an externally specified URL:
+  QString serverUrlEnv = getenv("PARAVIS_PVSERVER_URL");
+  std::string serverUrl;
+  if (!serverUrlEnv.isEmpty())
+    serverUrl = serverUrlEnv.toStdString();
+  else
+    {
+      // Get the URL from the engine (possibly starting the pvserver)
+      serverUrl = GetEngine()->FindOrStartPVServer(0);  // take the first free port
+    }
+
+  msg << "connectToExternalPVServer(): Trying to connect to the external PVServer '" << serverUrl << "' ...";
+  MESSAGE(msg.str());
+
+  if (!pqServerConnectReaction::connectToServer(pqServerResource(serverUrl.c_str())))
+    {
+      std::stringstream msg2;
+      msg2 << "Error while connecting to the requested pvserver '" << serverUrl;
+      msg2 << "'. Might use default built-in connection instead!" << std::endl;
+      qWarning(msg2.str().c_str());  // will go to the ParaView console (see ParavisMessageOutput below)
+      SUIT_MessageBox::warning( aDesktop,
+                                QString("Error connecting to PVServer"), QString(msg2.str().c_str()));
+      return false;
+    }
+  else
+    {
+      MESSAGE("connectToExternalPVServer(): Connected!");
+      GetEngine()->SetGUIConnected(true);
+    }
+  return true;
+}
+
+//void PVViewer_ViewManager::onPVViewCreated(SUIT_ViewWindow* w)
+//{
+//  PVViewer_ViewWindow * w2 = dynamic_cast<PVViewer_ViewWindow *>(w);
+//  Q_ASSERT(w2 != NULL);
+//  connect(w2, SIGNAL(applyRequest()), ParaviewBehaviors, SLOT(onEmulateApply()));
+//}
+
+void PVViewer_ViewManager::onEmulateApply()
+{
+  PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desktop);
+  guiElements->onEmulateApply();
+}
diff --git a/src/PVViewer/PVViewer_ViewManager.h b/src/PVViewer/PVViewer_ViewManager.h
new file mode 100644 (file)
index 0000000..78652de
--- /dev/null
@@ -0,0 +1,67 @@
+// 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
+//
+#ifndef PVViewer_VIEWMANAGER_H
+#define PVViewer_VIEWMANAGER_H
+
+#include <SUIT_ViewManager.h>
+
+class PVViewer_EngineWrapper;
+class SUIT_Desktop;
+class SUIT_Study;
+class SUIT_ViewWindow;
+class pqTabbedMultiViewWidget;
+class pqPVApplicationCore;
+class PVViewer_Behaviors;
+class pqPropertiesPanel;
+class pqPipelineBrowserWidget;
+
+class PVViewer_ViewManager : public SUIT_ViewManager
+{
+  Q_OBJECT
+
+public:
+  PVViewer_ViewManager( SUIT_Study*, SUIT_Desktop* );
+  ~PVViewer_ViewManager() {}
+
+  static pqPVApplicationCore * GetPVApplication();
+  static PVViewer_EngineWrapper * GetEngine();
+
+  //! Initialize ParaView if not yet done (once per session)
+  static bool   ParaviewInitApp(SUIT_Desktop* aDesktop);
+  static void   ParaviewInitBehaviors(bool fullSetup=false, SUIT_Desktop* aDesktop=0);
+  static void   ParaviewLoadConfigurations();
+  static void   ParaviewCleanup();
+
+  //! Connect to the external PVServer, using the PARAVIS engine to launch it if it is not
+  //! already up.
+  static bool   ConnectToExternalPVServer(SUIT_Desktop* aDesktop);
+
+public slots:
+//  void onPVViewCreated(SUIT_ViewWindow*);
+  void onEmulateApply();
+
+private:
+  static pqPVApplicationCore* MyCoreApp;
+  static bool ConfigLoaded;
+  static PVViewer_Behaviors * ParaviewBehaviors;
+
+  SUIT_Desktop * desktop;
+};
+
+#endif
diff --git a/src/PVViewer/PVViewer_ViewModel.cxx b/src/PVViewer/PVViewer_ViewModel.cxx
new file mode 100644 (file)
index 0000000..ef1771e
--- /dev/null
@@ -0,0 +1,45 @@
+// 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 "PVViewer_ViewModel.h"
+#include "PVViewer_ViewWindow.h"
+
+#include <utilities.h>
+#include <SUIT_Desktop.h>
+
+#include <SalomeApp_Application.h>
+
+//----------------------------------------
+PVViewer_Viewer::PVViewer_Viewer()
+:SUIT_ViewModel() 
+{
+  MESSAGE("PVViewer_Viewer: creating view model ...");
+}
+
+
+/*!
+  Create new instance of view window on desktop \a theDesktop.
+  \retval SUIT_ViewWindow* - created view window pointer.
+*/
+SUIT_ViewWindow* PVViewer_Viewer::createView(SUIT_Desktop* theDesktop)
+{
+  PVViewer_ViewWindow* aPVView = new PVViewer_ViewWindow(theDesktop, this);
+  return aPVView;
+}
+
diff --git a/src/PVViewer/PVViewer_ViewModel.h b/src/PVViewer/PVViewer_ViewModel.h
new file mode 100644 (file)
index 0000000..e70f663
--- /dev/null
@@ -0,0 +1,42 @@
+// 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
+//
+#if !defined(_PVViewer_VIEWMODEL_H)
+#define _PVViewer_VIEWMODEL_H
+
+#include <SUIT_ViewModel.h>
+
+class SUIT_ViewWindow;
+class SUIT_Desktop;
+class SUIT_Desktop;
+
+class PVViewer_Viewer: public SUIT_ViewModel
+{
+  Q_OBJECT
+
+public:
+  PVViewer_Viewer();
+  virtual ~PVViewer_Viewer() {}
+
+  virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
+  virtual QString getType() const { return Type(); }
+  static QString Type() { return "ParaView"; }
+};
+
+#endif // !defined(_PVViewer_VIEWMODEL_H)
+
diff --git a/src/PVViewer/PVViewer_ViewWindow.cxx b/src/PVViewer/PVViewer_ViewWindow.cxx
new file mode 100644 (file)
index 0000000..c7fff08
--- /dev/null
@@ -0,0 +1,110 @@
+// 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
+//
+// File   : PVViewer_ViewWindow.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
+#include "PVViewer_ViewWindow.h"
+#include "PVViewer_ViewManager.h"
+#include "PVViewer_GUIElements.h"
+
+#include <SUIT_ViewManager.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SUIT_Desktop.h>
+
+#include <pqTabbedMultiViewWidget.h>
+#include <pqApplicationCore.h>
+
+/*!
+  \class PVViewer_ViewWindow
+  \brief PVGUI view window.
+*/
+
+/*!
+  \brief Constructor.
+  \param theDesktop parent desktop window
+  \param theModel view model
+*/
+PVViewer_ViewWindow::PVViewer_ViewWindow( SUIT_Desktop* theDesktop, PVViewer_Viewer* theModel )
+  : SUIT_ViewWindow( theDesktop ), myPVMgr( 0 )
+{
+  myModel = theModel;
+  myPVMgr = qobject_cast<pqTabbedMultiViewWidget*>(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
+  if (myPVMgr) {
+    myPVMgr->setParent( this );
+    // This is mandatory, see setParent() method in Qt 4 documentation
+    myPVMgr->show();
+    setCentralWidget( myPVMgr );
+
+    // Finish ParaView set up: behaviors, connection and configurations.
+    PVViewer_ViewManager::ParaviewInitBehaviors(true, theDesktop);
+    PVViewer_ViewManager::ConnectToExternalPVServer(theDesktop);
+    PVViewer_ViewManager::ParaviewLoadConfigurations();
+  } else
+    qDebug("No multiViewManager defined");
+}
+
+/*!
+  \brief Destructor.
+  As pqViewManager persists through the whole session,
+  the destructor first removes it from the children of this PVViewer_ViewWindow
+  to prevent its unexpected deletion.
+*/
+PVViewer_ViewWindow::~PVViewer_ViewWindow()
+{
+  if ( myPVMgr ) {
+    myPVMgr->setParent( 0 );
+    myPVMgr->hide();
+    myPVMgr = 0;
+    setCentralWidget( 0 );
+  }
+}
+
+/*!
+  \brief Get the visual parameters of the view window.
+  \return visual parameters of this view window formatted to the string
+*/
+QString PVViewer_ViewWindow::getVisualParameters()
+{
+  return SUIT_ViewWindow::getVisualParameters();
+}
+
+/*!
+  \brief Restore visual parameters of the view window from the formated string
+  \param parameters view window visual parameters
+*/
+void PVViewer_ViewWindow::setVisualParameters( const QString& parameters )
+{
+  SUIT_ViewWindow::setVisualParameters( parameters );
+}
+
+
+/*!
+  \brief Returns the ParaView multi-view manager previously set with setMultiViewManager()
+*/
+pqTabbedMultiViewWidget* PVViewer_ViewWindow::getMultiViewManager() const
+{
+  return myPVMgr;
+}
+
+void PVViewer_ViewWindow::onEmulateApply()
+{
+  emit this->applyRequest();
+}
diff --git a/src/PVViewer/PVViewer_ViewWindow.h b/src/PVViewer/PVViewer_ViewWindow.h
new file mode 100644 (file)
index 0000000..e3ff387
--- /dev/null
@@ -0,0 +1,57 @@
+// 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
+//
+// File   : Plot2d_ViewWindow.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
+#ifndef PVViewer_VIEWWINDOW_H
+#define PVViewer_VIEWWINDOW_H
+
+#include <SUIT_ViewWindow.h>
+#include <QMap>
+
+class SUIT_Desktop;
+class PVViewer_Viewer;
+class pqTabbedMultiViewWidget;
+
+class PVViewer_ViewWindow : public SUIT_ViewWindow
+{
+  Q_OBJECT
+
+public:
+  PVViewer_ViewWindow( SUIT_Desktop*, PVViewer_Viewer* );
+  virtual ~PVViewer_ViewWindow();
+
+  virtual QString   getVisualParameters();
+  virtual void      setVisualParameters( const QString& );
+  
+  pqTabbedMultiViewWidget*    getMultiViewManager() const;
+
+signals:
+  void applyRequest();
+
+public slots:
+  void onEmulateApply();
+
+private:
+  PVViewer_Viewer*     myModel;
+  pqTabbedMultiViewWidget*    myPVMgr;
+};
+
+#endif // PLOT2D_VIEWWINDOW_H
index 540c27514ec55ce3f4c40b9fec443d482e0fcdfa..4246ca76b247f8c6c7d0426c7eca4a82e402629c 100755 (executable)
@@ -39,6 +39,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/LogWindow
   ${PROJECT_SOURCE_DIR}/src/OBJECT
   ${PROJECT_SOURCE_DIR}/src/OCCViewer
+  ${PROJECT_SOURCE_DIR}/src/PVViewer
   ${PROJECT_SOURCE_DIR}/src/ObjBrowser
   ${PROJECT_SOURCE_DIR}/src/Plot2d
   ${PROJECT_SOURCE_DIR}/src/PyInterp
index 75642bf48cc6c3bfe231bdb2af8d4748e37954e6..22099f8e4f2e951baef141de383a00394294f8f5 100644 (file)
@@ -41,6 +41,8 @@
 #include "OCCViewer_ViewWindow.h"
 #include "Plot2d_ViewManager.h"
 #include "Plot2d_ViewWindow.h"
+#include "PVViewer_ViewManager.h"
+#include "PVViewer_ViewModel.h"
 #include "QtxActionMenuMgr.h"
 #include "QtxWorkstack.h"
 #include "QtxTreeView.h"
@@ -55,6 +57,7 @@
 #include <QAction>
 #include <QApplication>
 #include <QPaintEvent>
+#include <QCoreApplication>
 
 /*!
   \brief Get the currently active application.
@@ -3826,6 +3829,26 @@ void SalomePyQt::setPlot2dFitRange(const int id, const double XMin, const double
        ProcessVoidEvent( new TPlot2dFitRange(id, XMin, XMax, YMin, YMax) ); 
 }
 
+//class TInitParaview: public SALOME_Event
+//{
+//public:
+//  TInitParaview() {}
+//  virtual void Execute() {
+//    LightApp_Application* anApp = getApplication();
+//    // Create PVViewer_ViewManager, which will initialize ParaView stuff
+//    PVViewer_ViewManager* viewMgr =
+//          dynamic_cast<PVViewer_ViewManager*>( anApp->getViewManager( PVViewer_Viewer::Type(), true ) );
+//  }
+//};
+//void SalomePyQt::initializeParaViewGUI()
+//{
+//  ProcessVoidEvent( new TInitParaview() );
+//}
+
+void SalomePyQt::processEvents()
+{
+  QCoreApplication::processEvents();
+}
 
 void SalomePyQt::setVisibilityState( const QString& theEntry, VisibilityState theState)
 {
index 68be1fafcdec7d4e9629dd94d6fab7cbaf0f6510..ba63049a243f2671dd1a50129dd91d59b58d379c 100644 (file)
@@ -295,6 +295,9 @@ public:
   static QList<double>     getPlot2dFitRangeCurrent(const int);
   static void              setPlot2dFitRange(const int, const double XMin, const double XMax, const double YMin, const double YMax);
 
+//  static void              initializeParaViewGUI();
+  static void              processEvents();
+
   // the following methods are obsolete
   static void              addStringSetting( const QString&, const QString&, bool = true );
   static void              addIntSetting   ( const QString&, const int,      bool = true );
@@ -307,6 +310,7 @@ public:
 
   static void              startPyLog(const QString&);
   static void              stopPyLog();
+
 };
 
 #endif // SALOME_PYQT_H
index 7759940000deba804a487e38807df5f65b448832..6344657816e1e62c498d642b6204e8e49eaaaf68 100644 (file)
@@ -465,6 +465,9 @@ public:
   static QList<double>     getPlot2dFitRangeCurrent(const int) /ReleaseGIL/ ;
   static void              setPlot2dFitRange(const int, const double XMin, const double XMax, const double YMin, const double YMax ) /ReleaseGIL/ ;
 
+  static void              processEvents();
+  
+
   static void              startPyLog(const QString&) /ReleaseGIL/ ;
   static void              stopPyLog() /ReleaseGIL/ ;
 };
index 0cbb035e0978fd3e56806016fb7277b1be2446eb..091eaf9c57b60a2e97835c20ca3f7ad5ca1732ca 100755 (executable)
@@ -110,6 +110,10 @@ IF(SALOME_USE_OCCVIEWER)
   ENDIF(SALOME_USE_SALOMEOBJECT)
 ENDIF()
 
+IF(SALOME_USE_PVVIEWER)
+  LIST(APPEND _link_LIBRARIES PVViewer)
+ENDIF()
+
 IF(SALOME_USE_SALOMEOBJECT)
   LIST(APPEND _link_LIBRARIES SalomeObject)
 ENDIF()
index 3adde1b6be2c319e0192abedb15dd88242be7f0d..94ffa6c7bb0ae7a42be5c64b577055e92b7e417b 100755 (executable)
@@ -74,6 +74,9 @@ int SalomeApp_PyInterp::beforeRun()
     ret = simpleRun( "salome.salome_init(0,1)", false );
     if (ret)
       return ret;
+    ret = simpleRun( "salome.fromEmbeddedConsole=True", false );
+    if (ret)
+      return ret;
   }
   return true;
 }
index 2b29ba29b2e53ce956c6eefa49fab20a930aac44..0ac8042167ee86112b023a8aa7c014520e063a63 100644 (file)
@@ -33,6 +33,7 @@ Plot2d = $(GUI_ROOT_DIR)/share/salome/resources/gui
 GLViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui
 OCCViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui
 VTKViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui
+PVViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui
 SVTK = $(GUI_ROOT_DIR)/share/salome/resources/gui
 LightApp = $(GUI_ROOT_DIR)/share/salome/resources/gui
 SalomeApp = $(GUI_ROOT_DIR)/share/salome/resources/gui