Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added button to clear times #627

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,11 @@ def __init__(self, parent: Widget, vm: Model) -> None:
latestres.grid(column=0, row=0, rowspan=2, sticky="news")
ToolTip(latestres, "Raw data from the latest race result")

def clear_time(self):
race_times = self._vm.latest_result.get()
race_times.clear_time()
self._vm.latest_result.set(race_times)

def _cc_selector(self, parent: Widget) -> Widget:
frame = ttk.LabelFrame(parent, text="Available Chromecasts")
frame.columnconfigure(0, weight=1)
Expand All @@ -442,4 +447,6 @@ def _preview(self, parent: Widget) -> Widget:
frame.rowconfigure(0, weight=1)
widgets.Preview(frame, self._vm.scoreboard).grid(column=0, row=0)
ToolTip(frame, "Current contents of the scoreboard")
button = ttk.Button(parent, text="Clear", command=self.clear_time)

return frame
8 changes: 8 additions & 0 deletions racetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ def final_time(self, lane: int) -> Time:
if abs(time - final) > self.threshold:
valid = False
return Time(final, valid)

def clear_time(self):
"""Clear all the times from the scoreboard"""
pass

def place(self, lane: int) -> Optional[int]:
"""
Expand Down Expand Up @@ -263,6 +267,10 @@ def __init__(

def raw_times(self, lane: int) -> List[Optional[RawTime]]:
return self._lanes[lane - 1]

def clear_time(self):
for time in range(10):
self._lanes = [None, None, None]

@property
def event(self) -> int:
Expand Down