From: vsv Date: Wed, 1 Jul 2015 10:12:31 +0000 (+0300) Subject: Do not activate/deactivate part if an operation is launched. X-Git-Tag: V_1.3.0~136 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c9aedd6abfd9a672da2346c5ebcb9d2cf9a0053d;p=modules%2Fshaper.git Do not activate/deactivate part if an operation is launched. --- 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());