add left and right buttons

This commit is contained in:
Jannes Magnusson
2025-10-17 20:19:13 +02:00
parent 851b894e5f
commit 0871852693
6 changed files with 178 additions and 115 deletions

View File

@@ -9,8 +9,9 @@ import pandas as pd
from python_toolkit.serial_reader import SerialReader
from python_toolkit.serial_mock import SerialMock
from python_toolkit.gui.connect import ConnectFrame
from .config import DEFAULT_CALIB_WEIGHT, DEFAULT_CALIB, DISPLAY_TYPES, MOV_AVG_DEFAULTS
from .views import CombinedView
from .views import MainView
class WeightApp(tk.Tk):
def __init__(self, weight_reader: SerialReader):
@@ -55,6 +56,9 @@ class WeightApp(tk.Tk):
# Checkboxes for multiple view selection
self.view_vars = {}
for display_type in DISPLAY_TYPES:
if display_type == DISPLAY_TYPES.TIMER:
continue
var = tk.BooleanVar()
if display_type == DISPLAY_TYPES.NUMBER:
var.set(True) # Default to NUMBER view
@@ -127,14 +131,11 @@ class WeightApp(tk.Tk):
selected_types |= display_type # Combine using bitwise OR
# Remove existing views
if self.view is not None:
self.view.update_views(selected_types)
else:
self.view = CombinedView(self,
tare_command=self.weight_reader.tare,
calibrate_command=self.calibrate)
self.update_weight_display()
if self.view is None:
self.view = MainView(self,
tare_command=self.weight_reader.tare,
calibrate_command=self.calibrate)
self.view.update_views(selected_types)
def update_weight_display(self):