From: nds Date: Wed, 30 Nov 2016 12:53:52 +0000 (+0300) Subject: Issue #1803 Occurrence of the object browser SALOME when I load a script file X-Git-Tag: V_2.6.0~35 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9e0ffe4482299ddf70ee7f5c2a9bf5ed1679ca64;p=modules%2Fshaper.git Issue #1803 Occurrence of the object browser SALOME when I load a script file --- diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index c670b0184..ed44c1d91 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -247,6 +248,10 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy) Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); } myProxyViewer->activateViewer(true); + + // Postrrocessing for LoadScriptId to remove created(if it was created) SALOME Object Browser + connect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)), + this, SLOT(onScriptLoaded())); return isDone; } @@ -291,6 +296,10 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) aResMgr->setValue("Study", "store_positions", myIsStorePositions); getApp()->setEditEnabled(myIsEditEnabled); + // Postrrocessing for LoadScriptId to remove created(if it was created) SALOME Object Browser + disconnect(getApp()->action(LightApp_Application::UserID+1), SIGNAL(triggered(bool)), + this, SLOT(onScriptLoaded())); + return LightApp_Module::deactivateModule(theStudy); } @@ -345,6 +354,19 @@ void SHAPERGUI::onDefaultPreferences() myWorkshop->displayer()->redisplayObjects(); } +//****************************************************** +void SHAPERGUI::onScriptLoaded() +{ + // this slot is called after processing of the LoadScriptId action of SalomeApp Application + // Each dumped script contains updateObjBrowser() that creates a new instance of Object + // Browser. When SHAPER module is active, this browser should not be used. It might be removed + // as hidden by means of updateWindows() of SalomeApp_Application or to remove + // it manually (because this method of application is protected) + SUIT_DataBrowser* aBrowser = getApp()->objectBrowser(); + if (aBrowser) + delete aBrowser; +} + //****************************************************** void SHAPERGUI::onUpdateCommandStatus() { diff --git a/src/SHAPERGUI/SHAPERGUI.h b/src/SHAPERGUI/SHAPERGUI.h index c9c9f91fa..b940d8a19 100644 --- a/src/SHAPERGUI/SHAPERGUI.h +++ b/src/SHAPERGUI/SHAPERGUI.h @@ -165,6 +165,9 @@ Q_OBJECT /// Set preferences to default void onDefaultPreferences(); + /// Hide object browser if it was created during loading script + void onScriptLoaded(); + /// Obtains the current application and updates its actions void onUpdateCommandStatus();