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();
163 void saveTrace(const char* theName);
165 pqServer* getActiveServer();
167 virtual void createPreferences();
169 virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
172 //void onImportFromVisu(QString theEntry);
175 void deleteTemporaryFiles();
177 //! Initialize ParaView if not yet done (once per session)
178 static bool pvInit();
180 //! Create actions for ParaView GUI operations
181 void pvCreateActions();
183 //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
184 void pvCreateMenus();
186 //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
187 void pvCreateToolBars();
189 //! Create dock widgets for ParaView widgets
190 void setupDockWidgets();
192 //! Save states of dockable ParaView widgets
193 void saveDockWidgetsState();
195 //! Restore states of dockable ParaView widgets
196 void restoreDockWidgetsState();
198 //! Shows or hides ParaView view window
199 void showView( bool );
201 //! Returns QMenu object for a given menu id
202 QMenu* getMenu( const int );
204 //! Discover help project files from the resources.
205 QString getHelpFileName();
207 //! Create actions for ParaViS
208 void createActions();
210 //! Create menus for ParaViS
213 //! Load selected state
214 void loadSelectedState(bool toClear);
216 //! Get list of embedded macros files
217 QStringList getEmbeddedMacrosList();
219 //! update macros state
222 //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
223 void storeCommonWindowsState();
225 //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
226 void restoreCommonWindowsState();
228 //! run Python command (either in SALOME's Python interpreter, or in ParaView's Python's interpreter)
229 void execPythonCommand(const QString& cmd, bool inSalomeConsole=false);
231 //! Connect to the external PVServer, using the PARAVIS engine to launch it if it is not
233 bool connectToExternalPVServer();
237 void showHelpForProxy( const QString&, const QString& );
241 void endWaitCursor();
243 // void buildToolbarsMenu();
245 //void showParaViewHelp();
246 //void showHelp(const QString& url);
248 void onFinishedAddingServer(pqServer*);
249 void onDataRepresentationCreated(pqDataRepresentation*);
250 void onDataRepresentationUpdated();
251 void onVariableChanged(pqVariableType, const QString);
252 void onRepresentationChanged(pqRepresentation*);
254 void onStartProgress();
255 void onEndProgress();
257 void onRestartTrace();
259 void onNewParaViewWindow();
261 void onSaveMultiState();
263 void onCleanAddState();
269 virtual bool activateModule( SUIT_Study* );
270 virtual bool deactivateModule( SUIT_Study* );
271 virtual void onApplicationClosed( SUIT_Application* );
272 virtual void studyClosed( SUIT_Study* );
275 virtual void onModelOpened();
276 virtual void onPushTraceTimer();
277 virtual void onInitTimer();
280 int mySelectionControlsTb;
283 int myToolbarsMenuId;
287 typedef QMap<QWidget*, bool> WgMap;
290 WgMap myToolbarBreaks;
291 QList<QMenu*> myMenus;
293 typedef QMap<int, bool> DockWindowMap;
294 DockWindowMap myCommonMap;
296 QStringList myTemporaryFiles;
298 QtMsgHandler myOldMsgHandler;
300 vtkEventQtSlotConnect *VTKConnect;
302 static pqPVApplicationCore* MyCoreApp;
303 static PARAVIS_ORB::PARAVIS_Gen_var myEngine;
306 pqPythonScriptEditor* myTraceWindow;
310 //! Single shot timer used to connect to the PVServer, and start the trace.
311 QTimer * myInitTimer;
313 //! Timer used to regularly push the Python trace to the engine.
314 QTimer * myPushTraceTimer;
317 #endif // PVGUI_Module_H