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 #include CORBA_SERVER_HEADER(PARAVIS_Gen)
38 #include <pqVariableType.h>
46 class pqMainWindowCore;
47 class vtkEventQtSlotConnect;
48 class pqPythonScriptEditor;
49 class pqPVApplicationCore;
50 class pqDataRepresentation;
51 class pqRepresentation;
52 class PVViewer_GUIElements;
53 class PVViewer_EngineWrapper;
55 class PVGUI_Module : public SalomeApp_Module
104 CreateCustomFilterId,
105 ManageCustomFiltersId,
109 ManagePluginsExtensionsId,
112 RecordTestScreenshotId,
127 // Menu "Window" - "New Window"
130 // "Save state" ParaVis module root object popup
133 // "Add state" and "Reload state" popups
135 CleanAndAddStatePopupId,
137 // "Rename" and "Delete" popups (Object Browser)
146 virtual void initialize( CAM_Application* );
147 virtual void windows( QMap<int, int>& ) const;
149 virtual QString engineIOR() const; // to be removed when becoming Light
151 void openFile(const char* theName);
152 void executeScript(const char *script);
153 void saveParaviewState(const char* theFileName);
154 void loadParaviewState(const char* theFileName);
155 void clearParaviewState();
157 QString getTraceString();
160 void saveTrace(const char* theName);
162 pqServer* getActiveServer();
164 virtual void createPreferences();
166 virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
168 inline static PVViewer_EngineWrapper * GetEngine();
169 inline static pqPVApplicationCore * GetPVApplication();
171 virtual CAM_DataModel* createDataModel();
174 //void onImportFromVisu(QString theEntry);
177 void deleteTemporaryFiles();
179 //! Create actions for ParaView GUI operations
180 void pvCreateActions();
182 //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
183 void pvCreateMenus();
185 //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
186 void pvCreateToolBars();
188 //! Create dock widgets for ParaView widgets
189 void setupDockWidgets();
191 //! Save states of dockable ParaView widgets
192 void saveDockWidgetsState();
194 //! Restore states of dockable ParaView widgets
195 void restoreDockWidgetsState();
197 //! Shows or hides ParaView view window
198 void showView( bool );
200 //! Returns QMenu object for a given menu id
201 QMenu* getMenu( const int );
203 //! Discover help project files from the resources.
204 QString getHelpFileName();
206 //! Create actions for ParaViS
207 void createActions();
209 //! Create menus for ParaViS
212 //! Load selected state
213 void loadSelectedState(bool toClear);
215 //! Get list of embedded macros files
216 QStringList getEmbeddedMacrosList();
218 //! update macros state
221 //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
222 void storeCommonWindowsState();
224 //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
225 void restoreCommonWindowsState();
229 void showHelpForProxy( const QString&, const QString& );
233 void endWaitCursor();
235 // void buildToolbarsMenu();
237 //void showParaViewHelp();
238 //void showHelp(const QString& url);
240 void onDataRepresentationUpdated();
242 void onStartProgress();
243 void onEndProgress();
245 void onRestartTrace();
247 void onNewParaViewWindow();
249 void onSaveMultiState();
251 void onCleanAddState();
257 virtual bool activateModule( SUIT_Study* );
258 virtual bool deactivateModule( SUIT_Study* );
259 virtual void onApplicationClosed( SUIT_Application* );
260 virtual void studyClosed( SUIT_Study* );
263 virtual void onModelOpened();
264 virtual void onPushTraceTimer();
265 virtual void onInitTimer();
268 int mySelectionControlsTb;
271 int myToolbarsMenuId;
275 typedef QMap<QWidget*, bool> WgMap;
278 WgMap myToolbarBreaks;
279 QList<QMenu*> myMenus;
281 typedef QMap<int, bool> DockWindowMap;
282 DockWindowMap myCommonMap;
284 QStringList myTemporaryFiles;
286 QtMsgHandler myOldMsgHandler;
288 vtkEventQtSlotConnect *VTKConnect;
290 pqPythonScriptEditor* myTraceWindow;
294 //! Single shot timer used to connect to the PVServer, and start the trace.
295 QTimer * myInitTimer;
297 //! Timer used to regularly push the Python trace to the engine.
298 QTimer * myPushTraceTimer;
300 PVViewer_GUIElements * myGuiElements;
302 static PARAVIS_ORB::PARAVIS_Gen_var MyEngine;
305 #endif // PVGUI_Module_H