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;
51 class PVGUI_Module : public SalomeApp_Module
100 CreateCustomFilterId,
101 ManageCustomFiltersId,
105 ManagePluginsExtensionsId,
108 RecordTestScreenshotId,
123 // Menu "Window" - "New Window"
126 // "Save state" ParaVis module root object popup
129 // "Add state" and "Reload state" popups
131 CleanAndAddStatePopupId,
133 // "Rename" and "Delete" popups (Object Browser)
142 virtual void initialize( CAM_Application* );
143 virtual void windows( QMap<int, int>& ) const;
145 pqTabbedMultiViewWidget* getMultiViewManager() const;
147 virtual QString engineIOR() const;
149 void openFile(const char* theName);
150 void executeScript(const char *script);
151 void saveParaviewState(const char* theFileName);
152 void loadParaviewState(const char* theFileName);
153 void clearParaviewState();
155 QString getTraceString();
156 void saveTrace(const char* theName);
158 pqServer* getActiveServer();
160 virtual void createPreferences();
162 virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
165 void onImportFromVisu(QString theEntry);
168 //! Initialize ParaView if not yet done (once per session)
169 static bool pvInit();
171 //! Create actions for ParaView GUI operations
172 void pvCreateActions();
174 //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
175 void pvCreateMenus();
177 //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
178 void pvCreateToolBars();
180 //! Create dock widgets for ParaView widgets
181 void setupDockWidgets();
183 //! Save states of dockable ParaView widgets
184 void saveDockWidgetsState();
186 //! Restore states of dockable ParaView widgets
187 void restoreDockWidgetsState();
189 //! Shows or hides ParaView view window
190 void showView( bool );
192 //! Returns QMenu object for a given menu id
193 QMenu* getMenu( const int );
195 //! Discover help project files from the resources.
196 QString getHelpFileName();
198 void deleteTemporaryFiles();
200 //QList<QToolBar*> getParaViewToolbars();
202 //! Create actions for ParaViS
203 void createActions();
205 //! Create menus for ParaViS
208 //! Load selected state
209 void loadSelectedState(bool toClear);
211 //! Get list of embedded macros files
212 QStringList getEmbeddedMacrosList();
214 //! update macros state
217 //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
218 void storeCommonWindowsState();
220 //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
221 void restoreCommonWindowsState();
223 //! run Python command
224 void execPythonCommand(const QString& cmd, bool inSalomeConsole = false);
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