Repos / gorts / b8c3f03cfd
commit b8c3f03cfde5924be847df7fab9841d5b9b95341
Author: Nhân <hi@imnhan.com>
Date: Mon Jun 19 20:21:08 2023 +0700
implement Discard
diff --git a/tcl/main.tcl b/tcl/main.tcl
index 0031dc9..13d0233 100644
--- a/tcl/main.tcl
+++ b/tcl/main.tcl
@@ -83,7 +83,7 @@ ttk::label .c.players.p2teamlbl -text "Team 2"
ttk::combobox .c.players.p2team -textvariable scoreboard(p2team)
ttk::frame .c.buttons
ttk::button .c.buttons.apply -text "▶ Apply" -command applystate
-ttk::button .c.buttons.discard -text "✖ Discard" -state disabled
+ttk::button .c.buttons.discard -text "✖ Discard" -command discardstate
ttk::button .c.buttons.reset -text "↶ Reset scores" -state disabled
ttk::button .c.buttons.swap -text "⇄ Swap players" -state disabled
ttk::label .c.status -textvariable mainstatus
@@ -165,6 +165,14 @@ proc applystate {} {
update_applied_state
}
+
+proc discardstate {} {
+ foreach key [array names ::scoreboard] {
+ set ::scoreboard($key) $::applied_scoreboard($key)
+ ::checkdiff "" $key ""
+ }
+}
+
proc update_applied_state {} {
foreach key [array names ::scoreboard] {
set ::applied_scoreboard($key) $::scoreboard($key)