1 // PARAVIS : ParaView wrapper SALOME module
3 // Copyright (C) 2010-2013 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.
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();
157 void saveTrace(const char* theName);
159 pqServer* getActiveServer();
161 virtual void createPreferences();
163 virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
166 void onImportFromVisu(QString theEntry);
169 //! Initialize ParaView if not yet done (once per session)
170 static bool pvInit();
172 //! Create actions for ParaView GUI operations
173 void pvCreateActions();
175 //! Create menus for ParaView GUI operations duplicating menus in pqMainWindow ParaView class
176 void pvCreateMenus();
178 //! Create toolbars for ParaView GUI operations duplicating toolbars in pqMainWindow ParaView class
179 void pvCreateToolBars();
181 //! Create dock widgets for ParaView widgets
182 void setupDockWidgets();
184 //! Save states of dockable ParaView widgets
185 void saveDockWidgetsState();
187 //! Restore states of dockable ParaView widgets
188 void restoreDockWidgetsState();
190 //! Shows or hides ParaView view window
191 void showView( bool );
193 //! Returns QMenu object for a given menu id
194 QMenu* getMenu( const int );
196 //! Discover help project files from the resources.
197 QString getHelpFileName();
199 void deleteTemporaryFiles();
201 //QList<QToolBar*> getParaViewToolbars();
203 //! Create actions for ParaViS
204 void createActions();
206 //! Create menus for ParaViS
209 //! Load selected state
210 void loadSelectedState(bool toClear);
212 //! update macros state
215 //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
216 void storeCommonWindowsState();
218 //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
219 void restoreCommonWindowsState();
221 //! run Python command (either in SALOME's Python interpreter, or in ParaView's Python's interpreter)
222 void execPythonCommand(const QString& cmd, bool inSalomeConsole=false);
226 void showHelpForProxy( const QString&, const QString& );
230 void endWaitCursor();
232 // void buildToolbarsMenu();
234 //void showParaViewHelp();
235 //void showHelp(const QString& url);
237 void onFinishedAddingServer(pqServer*);
238 void onDataRepresentationCreated(pqDataRepresentation*);
239 void onDataRepresentationUpdated();
240 void onVariableChanged(pqVariableType, const QString);
241 void onRepresentationChanged(pqRepresentation*);
243 void onStartProgress();
244 void onEndProgress();
246 void onRestartTrace();
248 void onNewParaViewWindow();
250 void onSaveMultiState();
252 void onCleanAddState();
258 virtual bool activateModule( SUIT_Study* );
259 virtual bool deactivateModule( SUIT_Study* );
260 virtual void onApplicationClosed( SUIT_Application* );
261 virtual void studyClosed( SUIT_Study* );
264 virtual void onModelOpened();
267 void timerEvent(QTimerEvent *event);
270 class pqImplementation;
271 pqImplementation* Implementation;
273 int mySelectionControlsTb;
276 int myToolbarsMenuId;
280 typedef QMap<QWidget*, bool> WgMap;
283 WgMap myToolbarBreaks;
284 QList<QMenu*> myMenus;
286 typedef QMap<int, bool> DockWindowMap;
287 DockWindowMap myCommonMap;
289 QStringList myTemporaryFiles;
291 QtMsgHandler myOldMsgHandler;
293 vtkEventQtSlotConnect *VTKConnect;
295 pqPythonScriptEditor* myTraceWindow;
299 static pqPVApplicationCore* MyCoreApp;
302 #endif // PVGUI_Module_H