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>
34 #include <pqVariableType.h>
42 class pqTabbedMultiViewWidget;
43 class pqMainWindowCore;
44 class vtkEventQtSlotConnect;
45 class pqPythonScriptEditor;
46 class pqPVApplicationCore;
47 class pqDataRepresentation;
48 class pqRepresentation;
50 class PyConsole_Interp;
52 class PVGUI_Module : public SalomeApp_Module
101 CreateCustomFilterId,
102 ManageCustomFiltersId,
106 ManagePluginsExtensionsId,
109 RecordTestScreenshotId,
124 // Menu "Window" - "New Window"
127 // "Save state" ParaVis module root object popup
130 // "Add state" and "Reload state" popups
132 CleanAndAddStatePopupId,
134 // "Rename" and "Delete" popups (Object Browser)
143 virtual void initialize( CAM_Application* );
144 virtual void windows( QMap<int, int>& ) const;
146 pqTabbedMultiViewWidget* getMultiViewManager() const;
148 virtual QString engineIOR() const;
150 void openFile(const char* theName);
151 void executeScript(const char *script);
152 void saveParaviewState(const char* theFileName);
153 void loadParaviewState(const char* theFileName);
154 void clearParaviewState();
156 QString getTraceString();
159 void saveTrace(const char* theName);
161 pqServer* getActiveServer();
163 virtual void createPreferences();
165 virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
168 void onImportFromVisu(QString theEntry);
171 //! Initialize ParaView if not yet done (once per session)
172 static bool pvInit();
174 //! Create actions for ParaView GUI operations
175 void pvCreateActions();
177 //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
178 void pvCreateMenus();
180 //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
181 void pvCreateToolBars();
183 //! Create dock widgets for ParaView widgets
184 void setupDockWidgets();
186 //! Save states of dockable ParaView widgets
187 void saveDockWidgetsState();
189 //! Restore states of dockable ParaView widgets
190 void restoreDockWidgetsState();
192 //! Shows or hides ParaView view window
193 void showView( bool );
195 //! Returns QMenu object for a given menu id
196 QMenu* getMenu( const int );
198 //! Discover help project files from the resources.
199 QString getHelpFileName();
201 void deleteTemporaryFiles();
203 //QList<QToolBar*> getParaViewToolbars();
205 //! Create actions for ParaViS
206 void createActions();
208 //! Create menus for ParaViS
211 //! Load selected state
212 void loadSelectedState(bool toClear);
214 //! Get list of embedded macros files
215 QStringList getEmbeddedMacrosList();
217 //! update macros state
220 //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
221 void storeCommonWindowsState();
223 //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
224 void restoreCommonWindowsState();
228 void showHelpForProxy( const QString&, const QString& );
232 void endWaitCursor();
234 // void buildToolbarsMenu();
236 //void showParaViewHelp();
237 //void showHelp(const QString& url);
239 void onFinishedAddingServer(pqServer*);
240 void onDataRepresentationCreated(pqDataRepresentation*);
241 void onDataRepresentationUpdated();
242 void onVariableChanged(pqVariableType, const QString);
243 void onRepresentationChanged(pqRepresentation*);
245 void onStartProgress();
246 void onEndProgress();
248 void onRestartTrace();
250 void onNewParaViewWindow();
252 void onSaveMultiState();
254 void onCleanAddState();
260 virtual bool activateModule( SUIT_Study* );
261 virtual bool deactivateModule( SUIT_Study* );
262 virtual void onApplicationClosed( SUIT_Application* );
263 virtual void studyClosed( SUIT_Study* );
266 virtual void onModelOpened();
269 void timerEvent(QTimerEvent *event);
272 class pqImplementation;
273 pqImplementation* Implementation;
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 pqPythonScriptEditor* myTraceWindow;
301 static pqPVApplicationCore* MyCoreApp;
304 #endif // PVGUI_Module_H