]> SALOME platform Git repositories - modules/paravis.git/blob - src/PVGUI/PVGUI_Module_widgets.cxx
Salome HOME
Additional fix of INTPAL 52639: Creation of ParaView viewer makes Paraview toolbars...
[modules/paravis.git] / src / PVGUI / PVGUI_Module_widgets.cxx
1 // PARAVIS : ParaView wrapper SALOME module
2 //
3 // Copyright (C) 2010-2015  CEA/DEN, EDF R&D
4 //
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.
9 //
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.
14 //
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
18 //
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 // File   : PVGUI_Module_MenuActions.cxx
22 // Author : Margarita KARPUNINA
23 //
24
25 #include "PVGUI_Module.h"
26 #include "PVViewer_ViewManager.h"
27 #include "PVViewer_GUIElements.h"
28
29 #include <QtxActionToolMgr.h>
30 #include <LightApp_Application.h>
31 #include <SalomeApp_Application.h>   // // should ultimately be a LightApp only
32 #include <SUIT_Desktop.h>
33
34 #include <QApplication>
35 #include <QAction>
36 #include <QDockWidget>
37 #include <QToolBar>
38 #include <QStatusBar>
39 #include <QShortcut>
40 #include <QScrollArea>
41 #include <QVBoxLayout>
42 #include <QShowEvent>
43 #include <QToolButton>
44
45 #include <pqAnimationViewWidget.h> 
46 #include <pqAnimationWidget.h> 
47
48 #include <pqApplicationCore.h>
49 #include <pqComparativeVisPanel.h>
50 #include <pqPipelineBrowserWidget.h>
51 #include <pqProxyInformationWidget.h>
52 #include <pqSettings.h>
53 #include <pqDataInformationWidget.h>
54 #include <pqPVAnimationWidget.h>
55 #include <pqFindDataSelectionDisplayFrame.h>
56 #include <pqMultiBlockInspectorPanel.h>
57 #include <pqProgressWidget.h>
58 #include <pqProgressManager.h>
59 #include <pqPropertiesPanel.h>
60
61 #include <pqApplicationCore.h>
62 #include <pqPluginManager.h>
63 #include <pqParaViewMenuBuilders.h>
64 #include <pqCollaborationPanel.h>
65 #include <pqMemoryInspectorPanel.h>
66 #include <pqColorMapEditor.h>
67 #include <pqDeleteReaction.h>
68
69 #include <vtkPVGeneralSettings.h>
70
71 class ResizeHelper : public pqPVAnimationWidget
72 {
73   // TEMPORARY WORKAROUND AROUND PARAVIEW 3.14 BUG:
74   // WHEN ANIMATION VIEW IS RESIZED, ITS CONTENTS IS NOT PREPERLY RE-ARRANGED
75   // CAUSING SOME CONTROLS TO STAY NON-VISIBLE
76   // THIS BUG IS NATURALLY FIXED BY ADDING
77   //      this->updateGeometries();
78   // TO THE
79   //     void pqAnimationWidget::resizeEvent(QResizeEvent* e);
80   // BUT THIS CANNOT BE DONE DIRECTLY, SINCE CORRESPONDING API IS NOT PUBLIC
81   // THE ONLY WAY TO DO THIS BY SENDING SHOW EVENT TO THE WIDGET
82
83 public:
84   ResizeHelper( QWidget* parent ) : pqPVAnimationWidget( parent ) {}
85 protected:
86   void resizeEvent(QResizeEvent* e)
87   {
88     pqAnimationWidget* w = findChild<pqAnimationWidget*>( "pqAnimationWidget" );
89     if ( w ) {
90       QShowEvent e;
91       QApplication::sendEvent( w, &e );
92     }
93     pqPVAnimationWidget::resizeEvent( e );
94   }
95 };
96
97 /*!
98   \brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc.
99   ParaView pqMainWindowCore class is fully responsible for these dock widgets' contents.
100   ==> To update this function, see the reference set up of ParaView in Application/Paraview/ParaviewMainWindow.ui
101 */
102 void PVGUI_Module::setupDockWidgets()
103 {
104   SUIT_Desktop* desk = application()->desktop();
105   PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desk);
106  
107   desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
108   desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
109   desk->setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);
110
111   // Pipeline
112   QDockWidget* pipelineBrowserDock = new QDockWidget( tr( "TTL_PIPELINE_BROWSER" ), desk );
113   pipelineBrowserDock->setObjectName("pipelineBrowserDock");
114   pipelineBrowserDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
115   desk->addDockWidget( Qt::LeftDockWidgetArea, pipelineBrowserDock );
116   pqPipelineBrowserWidget* browser = guiElements->getPipelineBrowserWidget();
117   pipelineBrowserDock->setWidget(browser);
118   myDockWidgets[pipelineBrowserDock] = true;
119   pipelineBrowserDock->hide();
120
121   // PROPERTIES, DISPLAY and VIEW:
122   // See ParaViewMainWindow.cxx - those three panels can be separated or grouped.
123   pqSettings *settings = pqApplicationCore::instance()->settings();
124
125   //    Properties dock (previously called OBJECT_INSPECTOR)
126   QDockWidget* propertiesDock = new QDockWidget( tr( "TTL_OBJECT_INSPECTOR" ), desk );
127   propertiesDock->setObjectName("propertiesDock");
128   propertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
129   desk->addDockWidget( Qt::LeftDockWidgetArea, propertiesDock );
130
131   pqPropertiesPanel* propertiesPanel = guiElements->getPropertiesPanel();
132   propertiesDock->setWidget(propertiesPanel);
133   connect( propertiesPanel, SIGNAL( helpRequested(const QString&, const QString&) ),  this, SLOT( showHelpForProxy(const QString&, const QString&) ) );
134   //            hook delete to pqDeleteReaction.
135   QAction* tempDeleteAction = new QAction(this);
136   pqDeleteReaction* handler = new pqDeleteReaction(tempDeleteAction);
137   handler->connect(propertiesPanel, SIGNAL(deleteRequested(pqPipelineSource*)), SLOT(deleteSource(pqPipelineSource*)));
138   myDockWidgets[propertiesDock] = true;
139   propertiesDock->hide();
140
141   // Display dock
142   QDockWidget* displayPropertiesDock = new QDockWidget( tr( "TTL_DISPLAY" ), desk );
143   displayPropertiesDock->setObjectName("displayPropertiesDock");
144   displayPropertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
145   desk->addDockWidget( Qt::LeftDockWidgetArea, displayPropertiesDock );
146
147   pqPropertiesPanel* displayPropertiesPanel = new pqPropertiesPanel();
148   displayPropertiesPanel->setObjectName("displayPropertiesPanel");
149   displayPropertiesPanel->setProperty("panelMode", QVariant(2));  // probably to have only the Display part
150   displayPropertiesDock->setWidget(displayPropertiesPanel);
151   myDockWidgets[displayPropertiesDock] = false;
152   displayPropertiesDock->hide();
153
154   // View dock
155   QDockWidget* viewPropertiesDock = new QDockWidget( tr( "TTL_VIEW_PANEL" ), desk );
156   viewPropertiesDock->setObjectName("viewPropertiesDock");
157   viewPropertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
158   desk->addDockWidget( Qt::LeftDockWidgetArea, viewPropertiesDock );
159
160   pqPropertiesPanel* viewPropertiesPanel = new pqPropertiesPanel();
161   viewPropertiesPanel->setObjectName("viewPropertiesPanel");
162   viewPropertiesPanel->setProperty("panelMode", QVariant(4)); // probably to have only the View part
163   viewPropertiesDock->setWidget(viewPropertiesPanel);
164   myDockWidgets[viewPropertiesDock] = false;
165   viewPropertiesDock->hide();
166
167   // Taken from ParaViewMainWindow.cxx:
168   int propertiesPanelMode = settings->value(
169       "GeneralSettings.PropertiesPanelMode", vtkPVGeneralSettings::ALL_IN_ONE).toInt();
170   switch (propertiesPanelMode)
171   {
172     case vtkPVGeneralSettings::SEPARATE_DISPLAY_PROPERTIES:
173       viewPropertiesDock->hide();
174       propertiesPanel->setPanelMode(
175           pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::VIEW_PROPERTIES);
176       break;
177
178     case vtkPVGeneralSettings::SEPARATE_VIEW_PROPERTIES:
179       displayPropertiesDock->hide();
180       propertiesPanel->setPanelMode(
181           pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::DISPLAY_PROPERTIES);
182       break;
183
184     case vtkPVGeneralSettings::ALL_SEPARATE:
185       propertiesPanel->setPanelMode(pqPropertiesPanel::SOURCE_PROPERTIES);
186       break;
187
188     case vtkPVGeneralSettings::ALL_IN_ONE:
189     default:
190       propertiesPanel->setPanelMode(
191                 pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::VIEW_PROPERTIES|pqPropertiesPanel::DISPLAY_PROPERTIES);
192       viewPropertiesDock->hide();
193       displayPropertiesDock->hide();
194       break;
195   }
196
197   // Information dock
198   QDockWidget* informationDock = new QDockWidget(tr( "TTL_INFORMATION" ), desk);
199   informationDock->setObjectName("informationDock");
200
201   QWidget* informationWidgetFrame = new QWidget(informationDock);
202   informationWidgetFrame->setObjectName("informationWidgetFrame");
203
204   QVBoxLayout* verticalLayout_2 = new QVBoxLayout(informationWidgetFrame);
205   verticalLayout_2->setSpacing(0);
206   verticalLayout_2->setContentsMargins(0, 0, 0, 0);
207
208   QScrollArea* informationScrollArea = new QScrollArea(informationWidgetFrame);
209   informationScrollArea->setObjectName("informationScrollArea") ;
210   informationScrollArea->setWidgetResizable(true);
211
212   pqProxyInformationWidget* informationWidget = new pqProxyInformationWidget();
213   informationWidget->setObjectName("informationWidget");
214   informationWidget->setGeometry(QRect(0, 0, 77, 214));
215   informationScrollArea->setWidget(informationWidget);
216
217   verticalLayout_2->addWidget(informationScrollArea);
218   informationDock->setWidget(informationWidgetFrame);
219
220   myDockWidgets[informationDock] = true;
221
222   desk->tabifyDockWidget(propertiesDock, viewPropertiesDock);
223   desk->tabifyDockWidget(propertiesDock, displayPropertiesDock);
224   desk->tabifyDockWidget(propertiesDock, informationDock);
225   propertiesDock->raise();
226
227   // Statistic View
228   QDockWidget* statisticsViewDock  = new QDockWidget( tr( "TTL_STATISTICS_VIEW" ), desk );
229   statisticsViewDock->setObjectName("statisticsViewDock");
230   statisticsViewDock->setAllowedAreas(Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|
231                                       Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
232   desk->addDockWidget( Qt::BottomDockWidgetArea, statisticsViewDock );
233   pqDataInformationWidget* aStatWidget = new pqDataInformationWidget(statisticsViewDock);
234   statisticsViewDock->setWidget(aStatWidget);
235   myDockWidgets[statisticsViewDock] = false; // hidden by default
236
237   //Animation view
238   QDockWidget* animationViewDock     = new QDockWidget( tr( "TTL_ANIMATION_VIEW" ), desk );
239   animationViewDock->setObjectName("animationViewDock");
240   desk->addDockWidget( Qt::BottomDockWidgetArea, animationViewDock );
241   pqPVAnimationWidget* animation_panel = new ResizeHelper(animationViewDock); // [ABN] was resizeHelper
242   animationViewDock->setWidget(animation_panel);
243   myDockWidgets[animationViewDock] = false; // hidden by default
244
245   desk->tabifyDockWidget(animationViewDock,  statisticsViewDock);
246
247   // Selection inspector
248   QDockWidget* selectionDisplayDock = new QDockWidget( tr( "TTL_SELECTION_INSPECTOR" ), desk );
249   selectionDisplayDock->setObjectName("selectionInspectorDock");
250   selectionDisplayDock->setAllowedAreas( Qt::AllDockWidgetAreas );
251   desk->addDockWidget( Qt::LeftDockWidgetArea, selectionDisplayDock );
252   pqFindDataSelectionDisplayFrame* aSelInspector = new pqFindDataSelectionDisplayFrame(selectionDisplayDock);
253   selectionDisplayDock->setWidget(aSelInspector);
254   myDockWidgets[selectionDisplayDock] = false; // hidden by default
255
256   // Multi-block inspector
257   QDockWidget* multiBlockInspectorPanelDock  = new QDockWidget( tr( "TTL_MUTLI_BLOCK_INSPECTOR" ), desk );
258   multiBlockInspectorPanelDock->setObjectName("multiBlockInspectorPanelDock");
259   desk->addDockWidget( Qt::LeftDockWidgetArea, multiBlockInspectorPanelDock );
260   pqMultiBlockInspectorPanel* mbi_panel = new pqMultiBlockInspectorPanel( multiBlockInspectorPanelDock );
261   multiBlockInspectorPanelDock->setWidget(mbi_panel);
262   myDockWidgets[multiBlockInspectorPanelDock] = false; // hidden by default
263
264   // Comparative View
265   QDockWidget* comparativePanelDock  = new QDockWidget( tr( "TTL_COMPARATIVE_VIEW_INSPECTOR" ), desk );
266   comparativePanelDock->setObjectName("comparativePanelDock");
267   desk->addDockWidget( Qt::LeftDockWidgetArea, comparativePanelDock );
268   pqComparativeVisPanel* cv_panel = new pqComparativeVisPanel( comparativePanelDock );
269   comparativePanelDock->setWidget(cv_panel);
270   myDockWidgets[comparativePanelDock] = false; // hidden by default
271
272   // Collaboration view
273   QDockWidget* collaborationPanelDock = new QDockWidget(tr( "TTL_COLLABORATIVE_DOCK" ), desk);
274   collaborationPanelDock->setObjectName("collaborationPanelDock");
275   pqCollaborationPanel* collaborationPanel = new pqCollaborationPanel();
276   collaborationPanel->setObjectName("collaborationPanel");
277   collaborationPanelDock->setWidget(collaborationPanel);
278   desk->addDockWidget(Qt::RightDockWidgetArea, collaborationPanelDock);
279   myDockWidgets[collaborationPanelDock] = false; // hidden by default
280
281   // Color map editor
282   QDockWidget* colorMapEditorDock  = new QDockWidget( tr( "TTL_COLOR_MAP_EDITOR" ), desk );
283   colorMapEditorDock->setObjectName("colorMapEditorDock");
284   desk->addDockWidget( Qt::LeftDockWidgetArea, colorMapEditorDock );
285   pqColorMapEditor* cmed_panel = new pqColorMapEditor( colorMapEditorDock );
286   colorMapEditorDock->setWidget(cmed_panel);
287   myDockWidgets[colorMapEditorDock] = false; // hidden by default
288
289   // Provide access to the color-editor panel for the application.
290   pqApplicationCore::instance()->registerManager(
291     "COLOR_EDITOR_PANEL", colorMapEditorDock);
292   
293   // Memory inspector dock
294   QDockWidget* memoryInspectorDock = new QDockWidget(tr( "TTL_MEMORY_INSPECTOR" ), desk);
295   memoryInspectorDock->setObjectName("memoryInspectorDock");
296 #ifndef WIN32
297   pqMemoryInspectorPanel* dockWidgetContents = new pqMemoryInspectorPanel();
298   dockWidgetContents->setObjectName("dockWidgetContents");
299   memoryInspectorDock->setWidget(dockWidgetContents);
300 #endif
301   desk->addDockWidget(Qt::RightDockWidgetArea, memoryInspectorDock);
302   myDockWidgets[memoryInspectorDock] = false; // hidden by default
303
304   // Setup the statusbar ...
305   pqProgressManager* progress_manager =
306     pqApplicationCore::instance()->getProgressManager();
307
308   // Progress bar/button management
309   pqProgressWidget* aProgress = new pqProgressWidget(desk->statusBar());
310   progress_manager->addNonBlockableObject(aProgress);
311   progress_manager->addNonBlockableObject(aProgress->getAbortButton());
312   
313   QObject::connect( progress_manager, SIGNAL(enableProgress(bool)),
314                     aProgress,        SLOT(enableProgress(bool)));
315
316   QObject::connect( progress_manager, SIGNAL(progress(const QString&, int)),
317                     aProgress,        SLOT(setProgress(const QString&, int)));
318
319   QObject::connect( progress_manager, SIGNAL(enableAbort(bool)),
320                     aProgress,        SLOT(enableAbort(bool)));
321
322   QObject::connect( aProgress,        SIGNAL(abortPressed()),
323                     progress_manager, SLOT(triggerAbort()));
324
325   desk->statusBar()->addPermanentWidget(aProgress);
326   aProgress->setEnabled(true);
327
328   // Set up the dock window corners to give the vertical docks more room.
329 //  desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
330 //  desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
331
332   // Setup the default dock configuration ...
333   statisticsViewDock->hide();
334   comparativePanelDock->hide();
335   animationViewDock->hide();
336   multiBlockInspectorPanelDock->hide();
337   selectionDisplayDock->hide();
338   collaborationPanelDock->hide();
339   memoryInspectorDock->hide();
340   colorMapEditorDock->hide();
341 }
342
343 /*!
344   \brief Save states of dockable ParaView widgets.
345 */
346 void PVGUI_Module::saveDockWidgetsState(bool hideWidgets)
347 {
348   SUIT_Desktop* desk = application()->desktop();
349
350   // VSR: 19/06/2011: do not use Paraview's methods, since it conflicts with SALOME GUI architecture
351   // ... the following code is commented...
352   // Save the state of the window ...
353   // pqApplicationCore::instance()->settings()->saveState(*desk, "MainWindow");
354   //
355   //for (int i = 0; i < myDockWidgets.size(); ++i)
356   //  myDockWidgets.at(i)->setParent(0);
357   // ... and replaced - manually hide dock windows
358
359   // store dock widgets visibility state and hide'em all
360   QMapIterator<QWidget*, bool> it1( myDockWidgets );
361   while( it1.hasNext() ) {
362     it1.next();
363     QDockWidget* dw = qobject_cast<QDockWidget*>( it1.key() );
364     myDockWidgets[dw] = dw->isVisible();
365     if ( hideWidgets ) {
366       dw->setVisible( false );
367       dw->toggleViewAction()->setVisible( false );
368     }
369   }
370   // store toolbar breaks state and remove all tollbar breaks 
371   QMapIterator<QWidget*, bool> it2( myToolbarBreaks );
372   while( it2.hasNext() ) {
373     it2.next();
374     QToolBar* tb = qobject_cast<QToolBar*>( it2.key() );
375     myToolbarBreaks[tb] = desk->toolBarBreak( tb );
376     if ( myToolbarBreaks[tb] && hideWidgets )
377       desk->removeToolBarBreak( tb );
378   }
379   // store toolbars visibility state and hide'em all
380   QMapIterator<QWidget*, bool> it3( myToolbars );
381   while( it3.hasNext() ) {
382     it3.next();
383     QToolBar* tb = qobject_cast<QToolBar*>( it3.key() );
384     myToolbars[tb] = tb->isVisible();
385     if ( hideWidgets ) {
386       tb->setVisible( false );
387       tb->toggleViewAction()->setVisible( false );
388     }
389   }
390 }
391
392 /*!
393   \brief Restore states of dockable ParaView widgets.
394 */
395 void PVGUI_Module::restoreDockWidgetsState()
396 {
397   SUIT_Desktop* desk = application()->desktop();
398
399   // VSR: 19/06/2011: do not use Paraview's methods, since it conflicts with SALOME GUI architecture
400   // ... the following code is commented...
401   //for (int i = 0; i < myDockWidgets.size(); ++i)
402   //  myDockWidgets.at(i)->setParent(desk);
403   //
404   // Restore the state of the window ...
405   //pqApplicationCore::instance()->settings()->restoreState("MainWindow", *desk);
406   // ... and replaced - manually hide dock windows
407
408   // restore dock widgets visibility state
409   QMapIterator<QWidget*, bool> it1( myDockWidgets );
410   while( it1.hasNext() ) {
411     it1.next();
412     QDockWidget* dw = qobject_cast<QDockWidget*>( it1.key() );
413     dw->setVisible( it1.value() );
414     dw->toggleViewAction()->setVisible( true );
415   }
416
417     // restore toolbar breaks state
418     QMapIterator<QWidget*, bool> it2( myToolbarBreaks );
419     while( it2.hasNext() ) {
420         it2.next();
421         QToolBar* tb = qobject_cast<QToolBar*>( it2.key() );
422         if ( myToolbarBreaks[tb] )
423           desk->insertToolBarBreak( tb );
424     }
425
426   // restore toolbar visibility state
427   QMapIterator<QWidget*, bool> it3( myToolbars );
428   while( it3.hasNext() ) {
429     it3.next();
430     QToolBar* tb = qobject_cast<QToolBar*>( it3.key() );
431     tb->setVisible( it3.value() );
432     tb->toggleViewAction()->setVisible( true );
433   }
434 }
435
436
437
438 /*!
439   \brief Store visibility of the common dockable windows (OB, PyConsole, ... etc.)
440 */
441 void PVGUI_Module::storeCommonWindowsState() {  
442   //rnv: Make behaviour of the dockable windows and toolbars coherent with others
443   //     modules: if 'Save position of the windows' or 'Save position of the toolbars' 
444   //     in the General SALOME preferences are cheked, then properties of the windows and/or toolbars
445   //     are stored/restored using standard Qt saveState(...) and restoreState(...) methods.
446   //     Otherwise to the windows and toolbars applied default settins stored int the SalomeApp.xml
447   //     configuration file.
448   //
449   //     But in contrast to others modules ParaVis module default settings hide some dockable
450   //     windows, so to restore it at the moment of the ParaVis de-activation we call 
451   //     restoreCommonWindowsState() method, and at the moment of the ParaVis activation we call 
452   //     this method.
453
454   //LightApp_Application* anApp = getApp();
455   SalomeApp_Application* anApp = getApp();
456   if(!anApp)
457     return;
458
459 //  int begin = SalomeApp_Application::WT_ObjectBrowser;
460 //  int end = SalomeApp_Application::WT_NoteBook;
461   int begin = LightApp_Application::WT_ObjectBrowser;
462   int end = LightApp_Application::WT_User;
463   for( int i = begin; i <= end; i++ ) {
464     QWidget* wg = anApp->getWindow(i);
465     if(wg) {
466       QDockWidget* dock = 0;
467       QWidget* w = wg->parentWidget();
468       while ( w && !dock ) {
469           dock = ::qobject_cast<QDockWidget*>( w );
470           w = w->parentWidget();
471       }
472       if(dock){
473           if(!myCommonMap.contains(i)){
474               myCommonMap.insert(i,dock->isVisible());
475           } else {
476               myCommonMap[i] = dock->isVisible();
477           }
478       }
479     }
480   }
481 }
482
483 /*!
484   \brief Restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
485 */
486 void PVGUI_Module::restoreCommonWindowsState() {
487   SalomeApp_Application* anApp = getApp();
488 //  LightApp_Application* anApp = getApp();
489   if(!anApp)
490     return;
491   DockWindowMap::const_iterator it = myCommonMap.begin();
492   for( ;it != myCommonMap.end(); it++ ) {
493     QWidget* wg = anApp->getWindow(it.key());
494     if(wg) {
495       QDockWidget* dock = 0;
496       QWidget* w = wg->parentWidget();
497       while ( w && !dock ) {
498           dock = ::qobject_cast<QDockWidget*>( w );
499           w = w->parentWidget();
500       }
501       if(dock) {
502           dock->setVisible(it.value());
503       }
504     }
505   }
506 }