Skip to content

Commit

Permalink
Add model for bg brightness
Browse files Browse the repository at this point in the history
Signed-off-by: John Strunk <[email protected]>
  • Loading branch information
JohnStrunk committed May 12, 2023
1 parent af33e1a commit eff2e84
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
30 changes: 16 additions & 14 deletions main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def _appearance(self, parent: Widget) -> Widget:
colorframe.pack(side="top", fill="x")
colorframe.columnconfigure(1, weight=1)
colorframe.columnconfigure(3, weight=1)
colorframe.columnconfigure(5, weight=1)
# 1st col
ttk.Label(colorframe, text="Heading:", anchor="e").grid(
column=0, row=0, sticky="news"
Expand All @@ -219,18 +220,6 @@ def _appearance(self, parent: Widget) -> Widget:
widgets.ColorButton2(colorframe, color_var=self._vm.color_event).grid(
column=1, row=1, sticky="nws", pady=_PADDING
)
ttk.Label(colorframe, text="Odd rows:", anchor="e").grid(
column=0, row=2, sticky="news"
)
widgets.ColorButton2(colorframe, color_var=self._vm.color_odd).grid(
column=1, row=2, sticky="nws", pady=_PADDING
)
ttk.Label(colorframe, text="Even rows:", anchor="e").grid(
column=0, row=3, sticky="news"
)
widgets.ColorButton2(colorframe, color_var=self._vm.color_even).grid(
column=1, row=3, sticky="nws", pady=_PADDING
)
# 2nd col
ttk.Label(colorframe, text="1st place:", anchor="e").grid(
column=2, row=0, sticky="news"
Expand All @@ -250,11 +239,24 @@ def _appearance(self, parent: Widget) -> Widget:
widgets.ColorButton2(colorframe, color_var=self._vm.color_third).grid(
column=3, row=2, sticky="nws", pady=_PADDING
)
# 3rd col
ttk.Label(colorframe, text="Odd rows:", anchor="e").grid(
column=4, row=0, sticky="news"
)
widgets.ColorButton2(colorframe, color_var=self._vm.color_odd).grid(
column=5, row=0, sticky="nws", pady=_PADDING
)
ttk.Label(colorframe, text="Even rows:", anchor="e").grid(
column=4, row=1, sticky="news"
)
widgets.ColorButton2(colorframe, color_var=self._vm.color_even).grid(
column=5, row=1, sticky="nws", pady=_PADDING
)
ttk.Label(colorframe, text="Background:", anchor="e").grid(
column=2, row=3, sticky="news"
column=4, row=2, sticky="news"
)
widgets.ColorButton2(colorframe, color_var=self._vm.color_bg).grid(
column=3, row=3, sticky="nws", pady=_PADDING
column=5, row=2, sticky="nws", pady=_PADDING
)

ttk.Separator(mainframe, orient=HORIZONTAL).pack(side="top", fill="x", pady=10)
Expand Down
5 changes: 4 additions & 1 deletion model.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Model: # pylint: disable=too-many-instance-attributes,too-few-public-meth

def __init__(self, root: Tk):
self.root = root
self._event_queue: queue.Queue[Callable[[], None]] = queue.Queue(0)
self._event_queue: queue.Queue[Callable[[], None]] = queue.Queue()
root.bind(self._ENQUEUE_EVENT, self._dispatch_event)

########################################
Expand Down Expand Up @@ -149,6 +149,7 @@ def __init__(self, root: Tk):
self.color_second = StringVar()
self.color_third = StringVar()
self.color_bg = StringVar()
self.brightness_bg = IntVar()
# features
self.num_lanes = IntVar()
self.min_times = IntVar()
Expand Down Expand Up @@ -195,6 +196,7 @@ def load(self, filename: str) -> None:
self.color_second.set(data.get("color_second", self.PANTONE200_RED))
self.color_third.set(data.get("color_third", self.PANTONE4505FLATGOLD))
self.color_bg.set(data.get("color_bg", self.BLACK))
self.brightness_bg.set(data.getint("brightness_bg", 100))
self.num_lanes.set(data.getint("num_lanes", 10))
self.min_times.set(data.getint("min_times", 2))
self.time_threshold.set(data.getfloat("time_threshold", 0.30))
Expand Down Expand Up @@ -227,6 +229,7 @@ def save(self, filename: str) -> None:
"color_second": self.color_second.get(),
"color_third": self.color_third.get(),
"color_bg": self.color_bg.get(),
"brightness_bg": str(self.brightness_bg.get()),
"num_lanes": str(self.num_lanes.get()),
"min_times": str(self.min_times.get()),
"time_threshold": str(self.time_threshold.get()),
Expand Down

0 comments on commit eff2e84

Please sign in to comment.