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