From: Paul RASCLE Date: Thu, 16 Mar 2017 14:47:55 +0000 (+0100) Subject: several methods of SALOMEGUI_Swig such a FitAll do not work in a Python Gui embedded... X-Git-Tag: SHAPER_2.7.0_WIN~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=96793704a7edcd68341aad5b5ceec3b47a677a9d;p=modules%2Fgui.git several methods of SALOMEGUI_Swig such a FitAll do not work in a Python Gui embedded viewer --- diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx index b56a92be2..bcd1e54ad 100644 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx +++ b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx @@ -62,6 +62,7 @@ #endif #endif +#include /*! \class SALOMEGUI_Swig @@ -623,7 +624,9 @@ public: virtual void Execute() { if ( LightApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); + SUIT_ViewManager* viewMgr = anApp->activeViewManager(); + if (!viewMgr) return; + SUIT_ViewWindow* window = viewMgr->getActiveView(); if ( window ) { SALOME_View* view = dynamic_cast( window->getViewManager()->getActiveView() ); if ( view ) { @@ -651,7 +654,9 @@ void SALOMEGUI_Swig::UpdateView() virtual void Execute() { if ( LightApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); + SUIT_ViewManager* viewMgr = anApp->activeViewManager(); + if (!viewMgr) return; + SUIT_ViewWindow* window = viewMgr->getActiveView(); if ( window ) { SALOME_View* view = dynamic_cast( window->getViewManager()->getActiveView() ); if ( view ) @@ -668,6 +673,7 @@ void SALOMEGUI_Swig::UpdateView() */ void SALOMEGUI_Swig::FitAll() { + MESSAGE("FitAll"); class TEvent: public SALOME_Event { public: @@ -675,7 +681,9 @@ void SALOMEGUI_Swig::FitAll() virtual void Execute() { if ( LightApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); + SUIT_ViewManager* viewMgr = anApp->activeViewManager(); + if (!viewMgr) return; + SUIT_ViewWindow* window = viewMgr->getActiveView(); if ( window ) { #ifndef DISABLE_SALOMEOBJECT #ifndef DISABLE_VTKVIEWER @@ -710,7 +718,9 @@ void SALOMEGUI_Swig::ResetView() virtual void Execute() { if ( LightApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); + SUIT_ViewManager* viewMgr = anApp->activeViewManager(); + if (!viewMgr) return; + SUIT_ViewWindow* window = viewMgr->getActiveView(); if ( window ) { #ifndef DISABLE_SALOMEOBJECT #ifndef DISABLE_VTKVIEWER @@ -764,7 +774,9 @@ static void setView( int view ) virtual void Execute() { if ( LightApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); + SUIT_ViewManager* viewMgr = anApp->activeViewManager(); + if (!viewMgr) return; + SUIT_ViewWindow* window = viewMgr->getActiveView(); if ( window ) { #ifndef DISABLE_SALOMEOBJECT #ifndef DISABLE_VTKVIEWER @@ -880,7 +892,9 @@ public: TGetViewParameters() : myResult( "" ) {} virtual void Execute() { if ( LightApp_Application* anApp = getApplication() ) { - if ( SUIT_ViewWindow* window = anApp->desktop()->activeWindow() ) { + SUIT_ViewManager* viewMgr = anApp->activeViewManager(); + if (!viewMgr) return; + if ( SUIT_ViewWindow* window = viewMgr->getActiveView() ) { #ifndef DISABLE_VTKVIEWER if ( SVTK_ViewWindow* svtk = dynamic_cast( window ) ) { if ( vtkRenderer* ren = svtk->getRenderer()) { @@ -944,7 +958,9 @@ static void setViewParameter( int parameter, QList& values ) { virtual void Execute() { if ( LightApp_Application* anApp = getApplication() ) { - if ( SUIT_ViewWindow* window = anApp->desktop()->activeWindow() ) { + SUIT_ViewManager* viewMgr = anApp->activeViewManager(); + if (!viewMgr) return; + if ( SUIT_ViewWindow* window = viewMgr->getActiveView() ) { #ifndef DISABLE_VTKVIEWER if ( SVTK_ViewWindow* svtk = dynamic_cast( window ) ) { if ( vtkRenderer* ren = svtk->getRenderer()) {