]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Do not activate/deactivate part if an operation is launched.
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 1 Jul 2015 10:12:31 +0000 (13:12 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 1 Jul 2015 10:12:43 +0000 (13:12 +0300)
src/PartSet/PartSet_MenuMgr.cpp
src/PartSet/PartSet_Module.cpp

index 3163169774391d660c1eca14389ec851d2c37f9b..d676ce1ee04afb59d97899344c74707296bdb4e8 100644 (file)
@@ -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
index cd842eedc73b8e1bb1cf974103ca9655b7af123f..1eaed276abb723d0aa3e6d72c43fed0cbb59f85d 100644 (file)
@@ -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<Events_Message>& 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<XGUI_ModuleConnector*>(myWorkshop);
     XGUI_Workshop* aWorkshop = aConnector->workshop();
     XGUI_DataTree* aTreeView = aWorkshop->objectBrowser()->treeView();
@@ -831,6 +838,8 @@ void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& 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());