From: mpv Date: Wed, 27 Apr 2022 12:02:56 +0000 (+0300) Subject: bos #29480 Recover feature in context menu. X-Git-Tag: V9_9_1b1~17^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d17f8933125bc9db77818452d34a63e0127cfefc;p=modules%2Fshaper.git bos #29480 Recover feature in context menu. --- diff --git a/src/FeaturesPlugin/doc/recoverFeature.rst b/src/FeaturesPlugin/doc/recoverFeature.rst index c2cc6d22c..3608b55f7 100644 --- a/src/FeaturesPlugin/doc/recoverFeature.rst +++ b/src/FeaturesPlugin/doc/recoverFeature.rst @@ -8,7 +8,8 @@ Recover To recover in the active part: #. select in the Main Menu *Features - > Recover* item or -#. click |recover.icon| **Recover** button in the toolbar +#. click |recover.icon| **Recover** button in the toolbar or +#. click |recover.icon| **Recover** command in the context menu if one feature is selected in the Object Browser The feature has the following options: diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index a440c46e1..64c590e66 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -111,6 +111,10 @@ void XGUI_ContextMenuMgr::createActions() addAction("MOVE_SPLIT_CMD", anAction); #endif + anAction = ModuleBase_Tools::createAction(QIcon(":pictures/recover.png"), + tr("Recover"), this); + addAction("RECOVER_CMD", anAction); + anAction = ModuleBase_Tools::createAction(QIcon(":pictures/clean_history.png"), tr("Clean history"), aDesktop); addAction("CLEAN_HISTORY_CMD", anAction); @@ -362,6 +366,18 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() action("MOVE_SPLIT_CMD")->setEnabled(true); } #endif + if (hasFeature && aObject->document() != aMgr->moduleDocument() && + aObject->document() == aMgr->activeDocument()) + { + XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr(); + if (!anOperationMgr->hasOperation()) { + FeaturePtr aFeature = std::dynamic_pointer_cast(aObject); + std::list > aResults; + ModelAPI_Tools::getConcealedResults(aFeature, aResults); + if (!aResults.empty()) // check the feature conceals at least one result + action("RECOVER_CMD")->setEnabled(true); + } + } if( aMgr->activeDocument() == aObject->document() ) { @@ -729,6 +745,7 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu() aList.append(action("SHOW_RESULTS_CMD")); aList.append(action("MOVE_CMD")); aList.append(action("MOVE_SPLIT_CMD")); + aList.append(action("RECOVER_CMD")); aList.append(mySeparator1); aList.append(action("INSERT_FOLDER_CMD")); aList.append(action("ADD_TO_FOLDER_BEFORE_CMD")); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index d5b78f0e0..febea937b 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1775,6 +1775,8 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) cleanHistory(); else if (theId == "MOVE_CMD" || theId == "MOVE_SPLIT_CMD") moveObjects(theId == "MOVE_SPLIT_CMD"); + else if (theId == "RECOVER_CMD") + recoverFeature(); else if (theId == "COLOR_CMD") changeColor(anObjects); else if (theId == "AUTOCOLOR_CMD") @@ -2289,6 +2291,15 @@ void XGUI_Workshop::moveObjects(const bool theSplit) myViewerProxy->update(); } +void XGUI_Workshop::recoverFeature() +{ + if (!abortAllOperations()) + return; + + static const QString RECOVER_OP_NAME = "Recover"; + module()->launchOperation(RECOVER_OP_NAME, false); +} + //************************************************************** bool XGUI_Workshop::deleteFeatures(const QObjectPtrList& theObjects) { diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 35cca7104..8b4f0ac36 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -188,6 +188,9 @@ Q_OBJECT /// Move selected features to be after the current feature void moveObjects(const bool theSplit); + /// Start a "Recover" feature on the selected one + void recoverFeature(); + /// Returns true if the object can be shaded. If the object is a compsolid result, the method /// checks subobjects of the result /// \return boolean value diff --git a/src/XGUI/XGUI_msg_fr.ts b/src/XGUI/XGUI_msg_fr.ts index 42c57b1a6..2e320d15e 100644 --- a/src/XGUI/XGUI_msg_fr.ts +++ b/src/XGUI/XGUI_msg_fr.ts @@ -212,6 +212,10 @@ Show Isos Show Isos + + Recover + Récupérer + XGUI_DataTree diff --git a/src/XGUI/XGUI_pictures.qrc b/src/XGUI/XGUI_pictures.qrc index dd81c3b93..2b81d5e48 100644 --- a/src/XGUI/XGUI_pictures.qrc +++ b/src/XGUI/XGUI_pictures.qrc @@ -73,6 +73,7 @@ pictures/insert_folder_before.png pictures/move_out_after.png pictures/move_out_before.png + pictures/recover.png pictures/selection.png pictures/autoapply_start.png pictures/autoapply_stop.png diff --git a/src/XGUI/pictures/recover.png b/src/XGUI/pictures/recover.png new file mode 100644 index 000000000..ddcc1b0f6 Binary files /dev/null and b/src/XGUI/pictures/recover.png differ