From: Cédric Aguerre Date: Tue, 7 Apr 2015 12:47:08 +0000 (+0200) Subject: Explicitely create a PVViewer X-Git-Tag: V7_6_0b1~7^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=53e2fb5a2a6dcb5cde14d67c4372beb717a66cfb;p=modules%2Fmed.git Explicitely create a PVViewer --- diff --git a/src/MEDOP/gui/MEDOPModule.cxx b/src/MEDOP/gui/MEDOPModule.cxx index de8acdabd..de984bb5c 100644 --- a/src/MEDOP/gui/MEDOPModule.cxx +++ b/src/MEDOP/gui/MEDOPModule.cxx @@ -27,6 +27,12 @@ #include "MEDOPFactoryClient.hxx" +#include +#include "PVViewer_ViewManager.h" +#include "PVViewer_ViewWindow.h" +#include "PVViewer_ViewModel.h" +#include "SUIT_ViewManager.h" + MEDOPModule::MEDOPModule() : StandardApp_Module() { @@ -82,9 +88,35 @@ void MEDOPModule::createModuleWidgets() { _workspaceController, SLOT(processDatasourceEvent(const DatasourceEvent *))); } +/*! + \brief Shows (toShow = true) or hides ParaView view window +*/ +void MEDOPModule::showView( bool toShow ) +{ + LightApp_Application* anApp = getApp(); + PVViewer_ViewManager* viewMgr = + dynamic_cast( anApp->getViewManager( PVViewer_Viewer::Type(), false ) ); + if ( !viewMgr ) { + viewMgr = new PVViewer_ViewManager( anApp->activeStudy(), anApp->desktop(), anApp->logWindow() ); + anApp->addViewManager( viewMgr ); + connect( viewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), + anApp, SLOT( onCloseView( SUIT_ViewManager* ) ) ); + } + + PVViewer_ViewWindow* pvWnd = dynamic_cast( viewMgr->getActiveView() ); + if ( !pvWnd ) { + pvWnd = dynamic_cast( viewMgr->createViewWindow() ); + // this also connects to the pvserver and instantiates relevant PV behaviors + } + + pvWnd->setShown( toShow ); + if ( toShow ) pvWnd->setFocus(); +} + bool MEDOPModule::activateModule( SUIT_Study* theStudy ) { bool bOk = StandardApp_Module::activateModule( theStudy ); + showView(true); _workspaceController->showDockWidgets(true); this->setDockLayout(StandardApp_Module::DOCKLAYOUT_LEFT_VLARGE); return bOk; @@ -93,6 +125,7 @@ bool MEDOPModule::deactivateModule( SUIT_Study* theStudy ) { _workspaceController->showDockWidgets(false); this->unsetDockLayout(); + showView(false); return StandardApp_Module::deactivateModule( theStudy ); } diff --git a/src/MEDOP/gui/MEDOPModule.hxx b/src/MEDOP/gui/MEDOPModule.hxx index 6d9c7ad3e..f38f4cb70 100644 --- a/src/MEDOP/gui/MEDOPModule.hxx +++ b/src/MEDOP/gui/MEDOPModule.hxx @@ -55,6 +55,10 @@ protected: virtual bool activateModule( SUIT_Study* theStudy ); virtual bool deactivateModule( SUIT_Study* theStudy ); + private: + //! Shows or hides ParaView view window + void showView(bool); + private: DatasourceController * _datasourceController; WorkspaceController * _workspaceController;