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 PyConsole_Interp;
58 class PVGUI_Module : public SalomeApp_Module
107 CreateCustomFilterId,
108 ManageCustomFiltersId,
112 ManagePluginsExtensionsId,
115 RecordTestScreenshotId,
130 // Menu "Window" - "New Window"
133 // "Save state" ParaVis module root object popup
136 // "Add state" and "Reload state" popups
138 CleanAndAddStatePopupId,
140 // "Rename" and "Delete" popups (Object Browser)
149 static PARAVIS_ORB::PARAVIS_Gen_var GetEngine();
151 virtual void initialize( CAM_Application* );
152 virtual void windows( QMap<int, int>& ) const;
154 pqTabbedMultiViewWidget* getMultiViewManager() const;
156 virtual QString engineIOR() const;
158 void openFile(const char* theName);
159 void executeScript(const char *script);
160 void saveParaviewState(const char* theFileName);
161 void loadParaviewState(const char* theFileName);
162 void clearParaviewState();
164 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 //! 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 void deleteTemporaryFiles();
209 //QList<QToolBar*> getParaViewToolbars();
211 //! Create actions for ParaViS
212 void createActions();
214 //! Create menus for ParaViS
217 //! Load selected state
218 void loadSelectedState(bool toClear);
220 //! Get list of embedded macros files
221 QStringList getEmbeddedMacrosList();
223 //! update macros state
226 //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
227 void storeCommonWindowsState();
229 //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
230 void restoreCommonWindowsState();
232 //! run Python command (either in SALOME's Python interpreter, or in ParaView's Python's interpreter)
233 void execPythonCommand(const QString& cmd, bool inSalomeConsole=false);
235 //! Connect to the external PVServer, using the PARAVIS engine to launch it if it is not
237 bool connectToExternalPVServer();
241 void showHelpForProxy( const QString&, const QString& );
245 void endWaitCursor();
247 // void buildToolbarsMenu();
249 //void showParaViewHelp();
250 //void showHelp(const QString& url);
252 void onFinishedAddingServer(pqServer*);
253 void onDataRepresentationCreated(pqDataRepresentation*);
254 void onDataRepresentationUpdated();
255 void onVariableChanged(pqVariableType, const QString);
256 void onRepresentationChanged(pqRepresentation*);
258 void onStartProgress();
259 void onEndProgress();
261 void onRestartTrace();
263 void onNewParaViewWindow();
265 void onSaveMultiState();
267 void onCleanAddState();
273 virtual bool activateModule( SUIT_Study* );
274 virtual bool deactivateModule( SUIT_Study* );
275 virtual void onApplicationClosed( SUIT_Application* );
276 virtual void studyClosed( SUIT_Study* );
279 virtual void onModelOpened();
280 virtual void onPushTraceTimer();
283 void timerEvent(QTimerEvent *event);
286 class pqImplementation;
287 pqImplementation* Implementation;
289 int mySelectionControlsTb;
292 int myToolbarsMenuId;
296 typedef QMap<QWidget*, bool> WgMap;
299 WgMap myToolbarBreaks;
300 QList<QMenu*> myMenus;
302 typedef QMap<int, bool> DockWindowMap;
303 DockWindowMap myCommonMap;
305 QStringList myTemporaryFiles;
307 QtMsgHandler myOldMsgHandler;
309 vtkEventQtSlotConnect *VTKConnect;
311 pqPythonScriptEditor* myTraceWindow;
315 static pqPVApplicationCore* MyCoreApp;
317 static PARAVIS_ORB::PARAVIS_Gen_var myEngine;
319 QTimer * myPushTraceTimer;
322 #endif // PVGUI_Module_H