UI: Remove knobs section and make window responsive

- Remove knobs section (CC38-45) to simplify interface
- Make window fit screen with cross-platform maximization
- Use weight-based grid resizing instead of fixed minimum sizes
- Add responsive layout with expandable frames
- Fix Linux compatibility for window maximization
- Disable window geometry loading to maintain maximized state
- Elements now resize proportionally to fit any screen size
- Cleaner, more focused interface without redundant controls
This commit is contained in:
2025-10-04 09:53:48 +13:00
parent 324fa463be
commit 763a2053ad

View File

@@ -352,11 +352,18 @@ class UIClient:
self.root.configure(bg=bg_color)
self.root.title("Lighting Controller - UI Client")
# Set window size to fit all content properly - 4x4 button grid needs more space
self.root.geometry("2700x1800")
# Set window size to fit all content properly - removed knobs section
# Make window fit the screen
try:
self.root.state('zoomed') # Windows
except:
try:
self.root.attributes('-zoomed', True) # Linux
except:
self.root.attributes('-fullscreen', True) # Fallback
# Load saved window geometry if available
self.load_window_geometry()
# Load saved window geometry if available (but don't override maximized state)
# self.load_window_geometry()
# MIDI controller
self.midi_controller = MidiController(None)
@@ -432,7 +439,7 @@ class UIClient:
# Top bar: MIDI Controller (left) + Selected Colors (right)
top_bar = ttk.Frame(self.root)
top_bar.pack(padx=16, pady=8, fill="x")
top_bar.pack(padx=16, pady=8, fill="x", expand=True)
# MIDI Controller Selection (smaller, on the left)
midi_frame = ttk.LabelFrame(top_bar, text="MIDI Controller")
@@ -493,15 +500,15 @@ class UIClient:
# Controls overview
controls_frame = ttk.Frame(self.root)
controls_frame.pack(padx=16, pady=8, fill="both")
controls_frame.pack(padx=16, pady=8, fill="both", expand=True)
# Dials display
dials_frame = ttk.LabelFrame(controls_frame, text="Dials (CC30-37)")
dials_frame.pack(side="left", padx=12)
dials_frame.pack(side="left", padx=12, fill="both", expand=True)
for c in range(2):
dials_frame.grid_columnconfigure(c, minsize=210)
dials_frame.grid_columnconfigure(c, weight=1)
for rr in range(4):
dials_frame.grid_rowconfigure(rr, minsize=105)
dials_frame.grid_rowconfigure(rr, weight=1)
self.dials_boxes = []
placeholders = {
@@ -526,47 +533,17 @@ class UIClient:
lbl.grid(row=r, column=c, padx=9, pady=9, sticky="nsew")
self.dials_boxes.append(lbl)
# Knobs display
knobs_frame = ttk.LabelFrame(controls_frame, text="Knobs (CC38-45)")
knobs_frame.pack(side="left", padx=12)
for c in range(2):
knobs_frame.grid_columnconfigure(c, minsize=210)
for rr in range(4):
knobs_frame.grid_rowconfigure(rr, minsize=105)
self.knobs_boxes = []
knob_placeholders = {
(0, 0): "CC44\n-", (0, 1): "CC45\n-",
(1, 0): "Rad n1\n-", (1, 1): "Rad delay\n-",
(2, 0): "Alt n1\n-", (2, 1): "Alt n2\n-",
(3, 0): "Pulse n1\n-", (3, 1): "Pulse n2\n-",
}
for r in range(4):
for c in range(2):
lbl = tk.Label(
knobs_frame,
text=knob_placeholders.get((r, c), "-"),
bg=bg_color,
fg=fg_color,
font=("Arial", 21),
padx=9, pady=9,
borderwidth=3, relief="ridge",
width=21, height=6,
anchor="center", justify="center",
)
lbl.grid(row=r, column=c, padx=9, pady=9, sticky="nsew")
self.knobs_boxes.append(lbl)
# Buttons display
buttons_frame = ttk.Frame(controls_frame)
buttons_frame.pack(side="left", padx=12)
buttons_frame.pack(side="left", padx=12, fill="both", expand=True)
buttons1_frame = ttk.LabelFrame(buttons_frame, text="Buttons (notes 36-51)")
buttons1_frame.pack(side="top", pady=8)
buttons1_frame.pack(side="top", pady=8, fill="both", expand=True)
for c in range(4):
buttons1_frame.grid_columnconfigure(c, minsize=210)
buttons1_frame.grid_columnconfigure(c, weight=1)
for rr in range(1, 5):
buttons1_frame.grid_rowconfigure(rr, minsize=105)
buttons1_frame.grid_rowconfigure(rr, weight=1)
self.button1_cells = []
for r in range(4):
@@ -828,16 +805,6 @@ class UIClient:
if idx < len(self.dials_boxes):
self.dials_boxes[idx].config(text=f"{label}\n{value}")
# Update knobs
knob_values = [
("CC44", self.midi_controller.knob7), ("CC45", self.midi_controller.knob8),
("Rad n1", self.midi_controller.n1), ("Rad delay", self.midi_controller.delay),
("Alt n1", self.midi_controller.n1), ("Alt n2", self.midi_controller.n2),
("Pulse n1", self.midi_controller.n1), ("Pulse n2", self.midi_controller.n2),
]
for idx, (label, value) in enumerate(knob_values):
if idx < len(self.knobs_boxes):
self.knobs_boxes[idx].config(text=f"{label}\n{value}")
# Update buttons
icon_for = {