Skip to content

Commit

Permalink
implement Discard
Browse files Browse the repository at this point in the history
  • Loading branch information
nhanb committed Jun 19, 2023
1 parent 075d95a commit b8c3f03
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tcl/main.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b8c3f03

Please sign in to comment.