1 // PARAVIS : ParaView wrapper SALOME module
3 // Copyright (C) 2010-2014 CEA/DEN, EDF R&D
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : PVGUI_Module.h
22 // Author : Sergey ANIKIN
26 #ifndef PVGUI_Module_H
27 #define PVGUI_Module_H
29 #include <SalomeApp_Module.h>
30 #include "SALOMEconfig.h"
31 #include CORBA_SERVER_HEADER(SALOMEDS)
32 #ifndef PARAVIS_WITH_FULL_CORBA
33 # include CORBA_SERVER_HEADER(PARAVIS_Gen)
40 #include <pqVariableType.h>
48 class pqTabbedMultiViewWidget;
49 class pqMainWindowCore;
50 class vtkEventQtSlotConnect;
51 class pqPythonScriptEditor;
52 class pqPVApplicationCore;
53 class pqDataRepresentation;
54 class pqRepresentation;
56 class PVGUI_Module : public SalomeApp_Module
105 CreateCustomFilterId,
106 ManageCustomFiltersId,
110 ManagePluginsExtensionsId,
113 RecordTestScreenshotId,
128 // Menu "Window" - "New Window"
131 // "Save state" ParaVis module root object popup
134 // "Add state" and "Reload state" popups
136 CleanAndAddStatePopupId,
138 // "Rename" and "Delete" popups (Object Browser)
147 static PARAVIS_ORB::PARAVIS_Gen_var GetEngine();
149 virtual void initialize( CAM_Application* );
150 virtual void windows( QMap<int, int>& ) const;
152 // pqTabbedMultiViewWidget* getMultiViewManager() const;
154 virtual QString engineIOR() const;
156 void openFile(const char* theName);
157 void executeScript(const char *script);
158 void saveParaviewState(const char* theFileName);
159 void loadParaviewState(const char* theFileName);
160 void clearParaviewState();
162 QString getTraceString();
165 void saveTrace(const char* theName);
167 pqServer* getActiveServer();
169 virtual void createPreferences();
171 virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
174 //void onImportFromVisu(QString theEntry);
177 void deleteTemporaryFiles();
179 //! Initialize ParaView if not yet done (once per session)
180 static bool pvInit();
182 //! Create actions for ParaView GUI operations
183 void pvCreateActions();
185 //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
186 void pvCreateMenus();
188 //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
189 void pvCreateToolBars();
191 //! Create dock widgets for ParaView widgets
192 void setupDockWidgets();
194 //! Save states of dockable ParaView widgets
195 void saveDockWidgetsState();
197 //! Restore states of dockable ParaView widgets
198 void restoreDockWidgetsState();
200 //! Shows or hides ParaView view window
201 void showView( bool );
203 //! Returns QMenu object for a given menu id
204 QMenu* getMenu( const int );
206 //! Discover help project files from the resources.
207 QString getHelpFileName();
209 //! Create actions for ParaViS
210 void createActions();
212 //! Create menus for ParaViS
215 //! Load selected state
216 void loadSelectedState(bool toClear);
218 //! Get list of embedded macros files
219 QStringList getEmbeddedMacrosList();
221 //! update macros state
224 //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
225 void storeCommonWindowsState();
227 //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
228 void restoreCommonWindowsState();
230 //! Connect to the external PVServer, using the PARAVIS engine to launch it if it is not
232 bool connectToExternalPVServer();
236 void showHelpForProxy( const QString&, const QString& );
240 void endWaitCursor();
242 // void buildToolbarsMenu();
244 //void showParaViewHelp();
245 //void showHelp(const QString& url);
247 void onDataRepresentationUpdated();
249 void onStartProgress();
250 void onEndProgress();
252 void onRestartTrace();
254 void onNewParaViewWindow();
256 void onSaveMultiState();
258 void onCleanAddState();
264 virtual bool activateModule( SUIT_Study* );
265 virtual bool deactivateModule( SUIT_Study* );
266 virtual void onApplicationClosed( SUIT_Application* );
267 virtual void studyClosed( SUIT_Study* );
270 virtual void onModelOpened();
271 virtual void onPushTraceTimer();
272 virtual void onInitTimer();
275 int mySelectionControlsTb;
278 int myToolbarsMenuId;
282 typedef QMap<QWidget*, bool> WgMap;
285 WgMap myToolbarBreaks;
286 QList<QMenu*> myMenus;
288 typedef QMap<int, bool> DockWindowMap;
289 DockWindowMap myCommonMap;
291 QStringList myTemporaryFiles;
293 QtMsgHandler myOldMsgHandler;
295 vtkEventQtSlotConnect *VTKConnect;
297 static pqPVApplicationCore* MyCoreApp;
298 static PARAVIS_ORB::PARAVIS_Gen_var myEngine;
301 pqPythonScriptEditor* myTraceWindow;
305 //! Single shot timer used to connect to the PVServer, and start the trace.
306 QTimer * myInitTimer;
308 //! Timer used to regularly push the Python trace to the engine.
309 QTimer * myPushTraceTimer;
312 #endif // PVGUI_Module_H