From 0594710995b373def75cc19b7cfeb84845c343ca Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 9 Feb 2024 14:12:31 -0800 Subject: [PATCH] ask for confirmation before zeroing out all targets --- changelog.txt | 1 + gui/autobutcher.lua | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/changelog.txt b/changelog.txt index dc056bad00..3e6dceff39 100644 --- a/changelog.txt +++ b/changelog.txt @@ -36,6 +36,7 @@ Template for new versions: ## Misc Improvements - `exportlegends`: increase precision of progress bar and stabilize formatting of the text +- `gui/autobutcher`: ask for confirmation before zeroing out targets for all races ## Removed diff --git a/gui/autobutcher.lua b/gui/autobutcher.lua index e72a28a6c1..3e31665880 100644 --- a/gui/autobutcher.lua +++ b/gui/autobutcher.lua @@ -1,7 +1,7 @@ -local dlg = require 'gui.dialogs' -local gui = require 'gui' -local plugin = require 'plugins.autobutcher' -local widgets = require 'gui.widgets' +local dlg = require('gui.dialogs') +local gui = require('gui') +local plugin = require('plugins.autobutcher') +local widgets = require('gui.widgets') local CH_UP = string.char(30) local CH_DN = string.char(31) @@ -644,13 +644,22 @@ function WatchList:zeroOut() local count = 0 if choice.race == 1 then - plugin.autobutcher_setDefaultTargetAll(count, count, count, count) + dlg.showYesNoPrompt( + 'Are you sure?', + 'Really set all targets for all races to 0?', + COLOR_YELLOW, + function() + plugin.autobutcher_setDefaultTargetAll(count, count, count, count) + self:refresh() + end + ) elseif choice.race == 2 then plugin.autobutcher_setDefaultTargetNew(count, count, count, count) + self:refresh() else plugin.autobutcher_setWatchListRace(data.id, count, count, count, count, data.watched) + self:refresh() end - self:refresh() end function WatchList:onToggleWatching()