Skip to content

Commit

Permalink
Merge pull request #42 from mycroftw/break_issues
Browse files Browse the repository at this point in the history
Add: Double Break warning, "End Break" label
  • Loading branch information
mycroftw authored Oct 3, 2024
2 parents 7a9993c + 24b1a3d commit 231a05a
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions bridge_clock_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ def _next_round(self) -> None:
else:
self.round += 1
self._in_break = False
self.button_end_round.SetLabel("End Round")
self._update_round()
self._reset_clock()
if not self.settings.break_visible and self._break_this_round():
Expand All @@ -312,10 +313,11 @@ def _go_to_break(self) -> None:
self._in_break = True
self.label_clock.SetBackgroundColour(BREAK_COLOUR)
self.label_round.SetBackgroundColour(BREAK_COLOUR)
self.label_round.SetLabelText("TIME TO NEXT ROUND:")
self.label_round.SetLabelText("NEXT ROUND IN:")
self.round_end = wx.DateTime.Now() + wx.TimeSpan.Minutes(
self.settings.break_length
)
self.button_end_round.SetLabel("End Break")
self._update_clock()

def _game_over(self) -> None:
Expand Down Expand Up @@ -445,10 +447,7 @@ def on_resize(self, event) -> None:
"""Hack to resolve sizer not auto-sizing with panel on maximize/unmaximize."""
self.Layout()
self.sizer_1.SetDimension(self.panel_1.GetPosition(), self.panel_1.GetSize())
self._handle_resize(
self.label_round,
"ROUND 8" if self.settings.rounds < 10 else "ROUND 88",
)
self._handle_resize(self.label_round, "NEXT ROUND IN:")
self._handle_resize(
self.label_clock,
"88:88" if self.settings.round_length < 100 else "888:88",
Expand Down Expand Up @@ -523,6 +522,16 @@ def on_goto_break(self, event):
if not self.settings.break_visible: # treat as "add break minutes to clock"
self.round_end.Add(wx.TimeSpan.Minutes(self.settings.break_length))
self._update_clock()
else:
dlg = wx.GenericProgressDialog(
"",
"Break already scheduled for this round.",
style=wx.PD_AUTO_HIDE,
)
dlg.SetPosition( # show above "go to break" button)
self.button_break.GetScreenPosition() - (0, dlg.GetSize().GetHeight())
)
wx.CallLater(500, dlg.Update, 100)
event.Skip()

def on_button_end_round(self, event) -> None:
Expand Down

0 comments on commit 231a05a

Please sign in to comment.