From 2987aa26e24d20aa0e04c5fd87bd6ec9abd3d233 Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 9 Jun 2020 18:07:27 +0300 Subject: [PATCH] Activation of the module on script loading --- src/SHAPERGUI/SHAPERGUI.cpp | 36 +++++++++++++++++++++++------------- src/SHAPERGUI/SHAPERGUI.h | 3 +++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index 066750018..764583f67 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -205,6 +205,13 @@ void SHAPERGUI::initialize(CAM_Application* theApp) #endif createMenu(aId, aEditMenu); + if (!myInspectionPanel) { + myInspectionPanel = myWorkshop->inspectionPanel(); + connect(myInspectionPanel->toggleViewAction(), SIGNAL(toggled(bool)), + this, SLOT(onWhatIs(bool))); + } + hideInternalWindows(); + // Initialize viewer proxy if OCC viewer is already exist ViewManagerList aOCCViewManagers; application()->viewManagers(OCCViewer_Viewer::Type(), aOCCViewManagers); @@ -283,11 +290,6 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy) aObjDoc->toggleViewAction()->setVisible(true); } - if (!myInspectionPanel) { - myInspectionPanel = myWorkshop->inspectionPanel(); - connect(myInspectionPanel->toggleViewAction(), SIGNAL(toggled(bool)), - this, SLOT(onWhatIs(bool))); - } myInspectionPanel->toggleViewAction()->setVisible(true); myWorkshop->facesPanel()->toggleViewAction()->setVisible(true); @@ -386,16 +388,12 @@ bool SHAPERGUI::activateModule(SUIT_Study* theStudy) } //****************************************************** -bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) +void SHAPERGUI::hideInternalWindows() { - saveToolbarsConfig(); - myProxyViewer->activateViewer(false); setMenuShown(false); setToolShown(false); - myWorkshop->deactivateModule(); - QObject* aObj = myWorkshop->objectBrowser()->parent(); QDockWidget* aObjDoc = dynamic_cast(aObj); if (aObjDoc) { @@ -404,17 +402,30 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) aObjDoc->toggleViewAction()->setVisible(false); } - myIsInspectionVisible = myInspectionPanel->isVisible(); myInspectionPanel->hide(); myInspectionPanel->toggleViewAction()->setVisible(false); - myIsFacesPanelVisible = myWorkshop->facesPanel()->isVisible(); myWorkshop->facesPanel()->hide(); myWorkshop->facesPanel()->toggleViewAction()->setVisible(false); myWorkshop->propertyPanel()->hide(); myWorkshop->propertyPanel()->toggleViewAction()->setVisible(false); + myWorkshop->hidePanel(myWorkshop->facesPanel()); +} + + +//****************************************************** +bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) +{ + saveToolbarsConfig(); + myWorkshop->deactivateModule(); + + myIsInspectionVisible = myInspectionPanel->isVisible(); + myIsFacesPanelVisible = myWorkshop->facesPanel()->isVisible(); + hideInternalWindows(); + + // the active operation should be stopped for the next activation. // There should not be active operation and visualized preview. // Abort operation should be performed before the selection's remove @@ -446,7 +457,6 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) mySelector = 0; } - myWorkshop->hidePanel(myWorkshop->facesPanel()); //myWorkshop->contextMenuMgr()->disconnectViewer(); SUIT_ResourceMgr* aResMgr = application()->resourceMgr(); diff --git a/src/SHAPERGUI/SHAPERGUI.h b/src/SHAPERGUI/SHAPERGUI.h index ee3d34a8a..864cc4c90 100644 --- a/src/SHAPERGUI/SHAPERGUI.h +++ b/src/SHAPERGUI/SHAPERGUI.h @@ -241,6 +241,9 @@ private slots: void saveToolbarsConfig(); void loadToolbarsConfig(); + + void hideInternalWindows(); + /// List of registered nested actions QStringList myNestedActionsList; -- 2.39.2