From c71b6da9d968521903a556f58e88d73a4fc7a5fb Mon Sep 17 00:00:00 2001 From: jimmy Date: Fri, 23 Oct 2026 15:38:24 +1300 Subject: [PATCH] Rearrange the test show's console and square off its colour buttons. The layout, chase colours, mover speeds and levels as saved from QLC+: the colour frames stacked on the left with the cans and movers pads beside them. The Colour 1 and Colour 2 buttons are 75 px squares, and the Chase runs and Pads layer frames below Colour 2 move down to clear them (scripts/shows/square_colours.py). The Movers speed dial comes in from x=1820 to beside Movers position, and both speed dials are trimmed to the dial and its time. Co-Authored-By: Claude Opus 5.5 --- scripts/shows/square_colours.py | 70 +++++++++++++ shows/test.qxw | 176 ++++++++++++++++---------------- 2 files changed, 159 insertions(+), 87 deletions(-) create mode 100644 scripts/shows/square_colours.py diff --git a/scripts/shows/square_colours.py b/scripts/shows/square_colours.py new file mode 100644 index 0000000..3bc5e6a --- /dev/null +++ b/scripts/shows/square_colours.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 +"""Make the Colour 1 and Colour 2 buttons in shows/test.qxw square. + +They were 90 wide and 60 high on a 96 by 66 grid. Now they are 75 square on an +81 grid, which keeps the 4 by 4 layout and makes each frame 338 wide and 338 +high. The collapsed Chase runs frame, which sat just under Colour 2, moves down +to stay under it, and the Pads layer frame under that moves down to clear it; +the rest of the console stays where it is. + + python3 scripts/shows/square_colours.py + +It stops if the buttons are already square. QLC+ has to reopen the show to +see it. +""" + +from __future__ import annotations + +import re + +from mover_bank import ROOT + +SHOW = ROOT / "shows" / "test.qxw" +FRAMES = ('', '') +SIZE, PITCH, MARGIN = 75, 81, 10 +BOTTOM = 10 # below the last row +GAP = 5 +COLLAPSED = 60 # room a collapsed frame takes, as the saved layout left it +# Below Colour 2, top to bottom: (caption, ID) of each frame pushed down to clear the one above +BELOW = (("Chase runs", 83), ("Pads layer", 129)) + + +def main() -> None: + xml = SHOW.read_text() + for head in FRAMES: + start = xml.index(head) + end = xml.index("", start) + frame = xml[start:end] + spots = re.findall(r'( )', frame) + if len(spots) != 16: + raise SystemExit(f"{head} doesn't have its 16 buttons") + if all(w == h for _, _, _, w, h in spots): + raise SystemExit(f"The buttons in {head} are already square") + cols = sorted({int(x) for _, x, _, _, _ in spots}) + rows = sorted({int(y) for _, _, y, _, _ in spots}) + for line, x, y, _, _ in spots: + nx, ny = MARGIN + cols.index(int(x)) * PITCH, MARGIN + rows.index(int(y)) * PITCH + frame = frame.replace(line, f' ', 1) + right = MARGIN + (len(cols) - 1) * PITCH + SIZE + MARGIN + bottom = MARGIN + (len(rows) - 1) * PITCH + SIZE + BOTTOM + frame = re.sub(r'( ', + rf'\1 Width="{right}" Height="{bottom}"/>', frame, count=1) + xml = xml[:start] + frame + xml[end:] + # Push the frames under Colour 2 down to clear it, each under the last. + colour_2 = re.search(r'.*?', xml, re.S) + top = int(colour_2.group(1)) + int(colour_2.group(2)) + GAP + for caption, wid in BELOW: + m = re.search(rf'(.*?)(\w+)', xml, re.S) + if m is None: + raise SystemExit(f"Couldn't find the {caption} frame") + y = max(int(m.group(2)), top) + xml = xml[:m.start(2)] + str(y) + xml[m.end(2):] + top = y + (COLLAPSED if m.group(6) == "True" else int(m.group(4))) + GAP + SHOW.write_text(xml) + print(f"Made the colour buttons in {SHOW.relative_to(ROOT)} square") + + +if __name__ == "__main__": + main() diff --git a/shows/test.qxw b/shows/test.qxw index 9c929e9..fa46bb4 100644 --- a/shows/test.qxw +++ b/shows/test.qxw @@ -12,7 +12,7 @@ - + @@ -781,7 +781,7 @@ Forward SingleShot Stripes - 4278255615 + 4278190335 RGB 2 @@ -815,7 +815,7 @@ Backward SingleShot Stripes - 4278255615 + 4278190335 RGB 2 @@ -829,7 +829,7 @@ Forward SingleShot Stripes - 4278255615 + 4278190335 RGB 3 @@ -850,7 +850,7 @@ Forward SingleShot Stripes - 4278255615 + 4278190335 RGB 4 @@ -892,7 +892,7 @@ Forward Loop - 4278255615 + 4278190335 RGB 8 @@ -926,7 +926,7 @@ 270 Parallel - + Forward Loop Lissajous @@ -976,7 +976,7 @@ 0 Parallel - + Forward Loop Eight @@ -1026,7 +1026,7 @@ 0 Parallel - + Forward Loop Circle @@ -1076,7 +1076,7 @@ 0 Parallel - + Forward Loop Line @@ -1126,7 +1126,7 @@ 0 Parallel - + Forward Loop Diamond @@ -1176,7 +1176,7 @@ 0 Parallel - + Forward Loop Square @@ -1226,7 +1226,7 @@ 0 Parallel - + Forward Loop SquareChoppy @@ -1276,7 +1276,7 @@ 0 Parallel - + Forward Loop Leaf @@ -1326,7 +1326,7 @@ 0 Parallel - + Forward Loop Line2 @@ -1386,7 +1386,7 @@ Forward Loop Swap - 4278255615 + 4294950656 4278190335 RGB 9 @@ -1397,7 +1397,7 @@ Loop Swap 4278190335 - 4278255615 + 4294950656 RGB 10 @@ -1411,7 +1411,7 @@ Forward Loop Swap - 4278255615 + 4294950656 4278190335 RGB 11 @@ -1422,7 +1422,7 @@ Loop Swap 4278190335 - 4278255615 + 4294950656 RGB 12 @@ -1631,7 +1631,7 @@ None Default - + True True True @@ -1640,7 +1640,7 @@ False False