Skip to content
Snippets Groups Projects
Commit 1e2b9b43 authored by Peter Albrecht's avatar Peter Albrecht
Browse files

Disabled the 'stop skill' prompt when skill has finished

parent 41837245
No related branches found
No related tags found
No related merge requests found
......@@ -83,16 +83,25 @@ namespace armarx
namespace armarx
{
void
SkillManagerMonitorWidgetController::prepareMenu(const QPoint& pos)
SkillManagerMonitorWidgetController::prepareAndRunMenu(const QPoint& pos)
{
QMenu* menu = new QMenu();
// TODO: gray out option if skill has finished
// Stop skill
QAction* stopSkillAction = new QAction("Stop Skill", this);
skills::SkillStatus currentStatus =
skillStatusUpdates.at(selectedSkill.skillExecutionId).status;
stopSkillAction->setDisabled(currentStatus == skills::SkillStatus::Aborted ||
currentStatus == skills::SkillStatus::Failed ||
currentStatus == skills::SkillStatus::Succeeded);
// TODO: re-run with similar params; remove skill entry (if finished)
menu->addAction(stopSkillAction);
connect(stopSkillAction,
&QAction::triggered,
this,
&SkillManagerMonitorWidgetController::stopSkill);
// open menu
menu->popup(widget.treeWidgetSkillExecutions->viewport()->mapToGlobal(pos));
}
......@@ -136,7 +145,7 @@ namespace armarx
connect(widget.treeWidgetSkillExecutions,
&QTreeWidget::customContextMenuRequested,
this,
&SkillManagerMonitorWidgetController::prepareMenu);
&SkillManagerMonitorWidgetController::prepareAndRunMenu);
connect(widget.doubleSpinBoxUpdateFreq,
&QDoubleSpinBox::editingFinished,
......@@ -387,6 +396,9 @@ namespace armarx
auto executionId = skills::SkillExecutionID::FromIce(k);
auto statusUpdate = skills::SkillStatusUpdate::FromIce(v);
// update snapshot
skillStatusUpdates.insert_or_assign(executionId, statusUpdate);
SkillExecutionInfoTreeWidgetItem* found = nullptr;
for (int i = 0; i < widget.treeWidgetSkillExecutions->topLevelItemCount(); ++i)
{
......@@ -509,8 +521,7 @@ namespace armarx
}
*/
ARMARX_INFO << "Stopping skill from GUI: "
<< selectedSkill.skillExecutionId.skillId.skillName;
ARMARX_INFO << "Stopping skill from GUI: " << selectedSkill.skillExecutionId.toString();
memory->abortSkill(selectedSkill.skillExecutionId.toManagerIce());
}
......
......@@ -130,7 +130,7 @@ namespace armarx
void pasteCurrentConfig();
void resetCurrentConfig();
void prepareMenu(const QPoint& pos);
void prepareAndRunMenu(const QPoint& pos);
private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment