From c9aedd6abfd9a672da2346c5ebcb9d2cf9a0053d Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 1 Jul 2015 13:12:31 +0300 Subject: [PATCH] Do not activate/deactivate part if an operation is launched. --- src/PartSet/PartSet_MenuMgr.cpp | 4 ++++ src/PartSet/PartSet_Module.cpp | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index 316316977..d676ce1ee 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -470,6 +470,8 @@ bool PartSet_MenuMgr::canSetAuxiliary(bool& theValue) const void PartSet_MenuMgr::onActivatePart(bool) { + if (myModule->workshop()->currentOperation()) + return; QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects(); if (aObjects.size() > 0) { ObjectPtr aObj = aObjects.first(); @@ -487,6 +489,8 @@ void PartSet_MenuMgr::onActivatePart(bool) void PartSet_MenuMgr::onActivatePartSet(bool) { + if (myModule->workshop()->currentOperation()) + return; SessionPtr aMgr = ModelAPI_Session::get(); bool isNewTransaction = !aMgr->isOperation(); // activation may cause changes in current features in document, so it must be in transaction diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index cd842eedc..1eaed276a 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -781,11 +781,18 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const if (aMgr->activeDocument() != aMgr->moduleDocument()) theMenu->addAction(myMenuMgr->action("ACTIVATE_PARTSET_CMD")); } + bool aCanDeactivate = (myWorkshop->currentOperation() == 0); + myMenuMgr->action("ACTIVATE_PARTSET_CMD")->setEnabled(aCanDeactivate); + myMenuMgr->action("DEACTIVATE_PART_CMD")->setEnabled(aCanDeactivate); + myMenuMgr->action("ACTIVATE_PART_CMD")->setEnabled(aCanDeactivate); } void PartSet_Module::processEvent(const std::shared_ptr& theMessage) { if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) { + // Do not change activation of parts if an operation active + if (myWorkshop->currentOperation() && myWorkshop->currentOperation()->id().toStdString() != PartSetPlugin_Part::ID()) + return; XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); XGUI_Workshop* aWorkshop = aConnector->workshop(); XGUI_DataTree* aTreeView = aWorkshop->objectBrowser()->treeView(); @@ -831,6 +838,8 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex) { + if (myWorkshop->currentOperation()) // Do not change activation of parts if an operation active + return; SessionPtr aMgr = ModelAPI_Session::get(); if (!theIndex.isValid()) { aMgr->setActiveDocument(aMgr->moduleDocument()); -- 2.39.2