Fix pattern highlighting in lighting controller GUI
- Add pattern name mapping to translate between MIDI handler names and GUI display names - Fixes highlighting for patterns with underscores (sequential_pulse, alternating_phase, n_chase) - Now properly highlights selected patterns in the button grid
This commit is contained in:
13
src/main.py
13
src/main.py
@@ -275,10 +275,21 @@ class App:
|
|||||||
"-", "-", "-", "-",
|
"-", "-", "-", "-",
|
||||||
"-", "-", "-", "-",
|
"-", "-", "-", "-",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Map MIDI handler pattern names to GUI display names
|
||||||
|
pattern_name_mapping = {
|
||||||
|
"sequential_pulse": "sequential\npulse",
|
||||||
|
"alternating_phase": "alternating\nphase",
|
||||||
|
"n_chase": "n chase",
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get the display name for the current pattern
|
||||||
|
display_pattern = pattern_name_mapping.get(pattern, pattern)
|
||||||
|
|
||||||
# notes numbers per cell (bottom-left origin)
|
# notes numbers per cell (bottom-left origin)
|
||||||
for idx, lbl in enumerate(self.button1_cells):
|
for idx, lbl in enumerate(self.button1_cells):
|
||||||
name = bank1_patterns[idx]
|
name = bank1_patterns[idx]
|
||||||
sel = (pattern == name and name != "-")
|
sel = (display_pattern == name and name != "-")
|
||||||
icon = icon_for.get(name, "")
|
icon = icon_for.get(name, "")
|
||||||
text = f"{icon} {name}" if name != "-" else ""
|
text = f"{icon} {name}" if name != "-" else ""
|
||||||
if sel:
|
if sel:
|
||||||
|
Reference in New Issue
Block a user