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 pqMainWindowCore;
49 class vtkEventQtSlotConnect;
50 class pqPythonScriptEditor;
51 class pqPVApplicationCore;
52 class pqDataRepresentation;
53 class pqRepresentation;
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;
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();
158 void saveTrace(const char* theName);
160 pqServer* getActiveServer();
162 virtual void createPreferences();
164 virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
166 inline static PARAVIS_ORB::PARAVIS_Gen_var GetEngine() { return PVGUI_ViewerModel::GetEngine(); }
169 //void onImportFromVisu(QString theEntry);
172 void deleteTemporaryFiles();
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 //! Create actions for ParaViS
202 void createActions();
204 //! Create menus for ParaViS
207 //! Load selected state
208 void loadSelectedState(bool toClear);
210 //! Get list of embedded macros files
211 QStringList getEmbeddedMacrosList();
213 //! update macros state
216 //! store visibility of the common dockable windows (OB, PyConsole, ... etc.)
217 void storeCommonWindowsState();
219 //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
220 void restoreCommonWindowsState();
222 //! run Python command (either in SALOME's Python interpreter, or in ParaView's Python's interpreter)
223 void execPythonCommand(const QString& cmd, bool inSalomeConsole=false);
227 void showHelpForProxy( const QString&, const QString& );
231 void endWaitCursor();
233 // void buildToolbarsMenu();
235 //void showParaViewHelp();
236 //void showHelp(const QString& url);
238 void onFinishedAddingServer(pqServer*);
239 void onDataRepresentationCreated(pqDataRepresentation*);
240 void onDataRepresentationUpdated();
241 void onVariableChanged(pqVariableType, const QString);
242 void onRepresentationChanged(pqRepresentation*);
244 void onStartProgress();
245 void onEndProgress();
247 void onRestartTrace();
249 void onNewParaViewWindow();
251 void onSaveMultiState();
253 void onCleanAddState();
259 virtual bool activateModule( SUIT_Study* );
260 virtual bool deactivateModule( SUIT_Study* );
261 virtual void onApplicationClosed( SUIT_Application* );
262 virtual void studyClosed( SUIT_Study* );
265 virtual void onModelOpened();
266 virtual void onPushTraceTimer();
267 virtual void onInitTimer();
270 int mySelectionControlsTb;
273 int myToolbarsMenuId;
277 typedef QMap<QWidget*, bool> WgMap;
280 WgMap myToolbarBreaks;
281 QList<QMenu*> myMenus;
283 typedef QMap<int, bool> DockWindowMap;
284 DockWindowMap myCommonMap;
286 QStringList myTemporaryFiles;
288 QtMsgHandler myOldMsgHandler;
290 vtkEventQtSlotConnect *VTKConnect;
292 pqPythonScriptEditor* myTraceWindow;
296 //! Single shot timer used to connect to the PVServer, and start the trace.
297 QTimer * myInitTimer;
299 //! Timer used to regularly push the Python trace to the engine.
300 QTimer * myPushTraceTimer;
303 #endif // PVGUI_Module_H