#!/usr/bin/env python3 """Drop the movers' Strobe from shows/test.qxw and add the rest of QLC+'s EFX shapes. The movers layer has no Strobe any more (pad 9, note 92): its button, its scene and the HTP strobe channel that let it beat the colour scenes all go. Its pad and the rest of the second row, and pad 5, take the five EFX shapes the movers did not have yet. They join Wander, Ballyhoo, Circle and Sweep in the Movement solo frame, now three rows deep, so still only one runs at a time: 92 Diamond pad 9 a diamond, about ±64° of pan and ±21° of tilt 93 Square pad 10 a square, about ±53° of pan and ±16° of tilt 94 Corners pad 11 SquareChoppy: jumps corner to corner of the same square 95 Leaf pad 12 a four-petal leaf, about ±53° of pan and ±26° of tilt 88 Tilt pad 5 Line2 on tilt alone, about ±26° up and down Like the others each is a relative EFX around the Pan and Tilt knobs, with all four movers together so the pairs mirror, fading in over 0.5 s. Knob 13's speed dial gives Corners an eighth of its time (2.5 s a round to start with) and the rest a quarter (5.5 s). padcontroller/layer.py settles the knobs after all nine. python3 scripts/shows/mover_all_efx.py Run it once on a show with Circle and Sweep and the movers' Strobe; it stops if Diamond is already there. QLC+ has to reopen the show to see it. """ from __future__ import annotations import re from mover_bank import M1, M2, M3, M4, NO_FUNCTION, ROOT, STROBE, button, note from mover_more_efx import SIZE, START_MS, efx SHOW = ROOT / "shows" / "test.qxw" # Speed dial factor indexes: (Not Sent), 0, 1/16, 1/8, 1/4, ... TIMES_1_8, TIMES_1_4 = 3, 4 # Caption, function name, algorithm, width, height (of 255 each way), can note, column, row, dial factor MOVES = ( ("Diamond", "Movers diamond", "Diamond", 30, 20, 44, 0, 1, TIMES_1_4), ("Square", "Movers square", "Square", 25, 15, 45, 1, 1, TIMES_1_4), ("Corners", "Movers corners", "SquareChoppy", 25, 15, 46, 2, 1, TIMES_1_8), ("Leaf", "Movers leaf", "Leaf", 25, 25, 47, 3, 1, TIMES_1_4), ("Tilt", "Movers tilt", "Line2", 0, 25, 40, 0, 2, TIMES_1_4), ) ROWS = 3 def cut(xml: str, pattern: str) -> str: xml, n = re.subn(pattern, "", xml, count=1, flags=re.S) assert n == 1, pattern return xml def main() -> None: xml = SHOW.read_text() if 'Name="Movers diamond"' in xml: raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the movers diamond") strobe = int(re.search(r'', xml).group(1)) xml = cut(xml, rf' \n.*? \n') # The cans' Strobe has the same caption; the movers' one is widget 89 (scripts/shows/mover_bank.py). xml = cut(xml, r' \n') for fid in (M1, M2, M3, M4): xml, n = re.subn(rf'( {fid}\n(?: .*\n)*?) {STROBE}\n', r"\1", xml, count=1) assert n == 1, fid engine, console = xml.split("") fid = max(int(i) for i in re.findall(r'\n.*? \n', xml, re.S).group(0) dial = re.search(r' \n.*? \n', xml, re.S).group(0) functions, buttons, rows = "", "", "" for i, (caption, name, algorithm, width, height, can_note, column, row, factor) in enumerate(MOVES): start_ms = START_MS // 2 if factor == TIMES_1_8 else START_MS functions += efx(fid + i, name, algorithm, width, height, start_ms) buttons += button(wid + i, caption, SIZE * column, SIZE * row, SIZE, fid + i, note(can_note), indent=" ") rows += f' {fid + i}\n' grown = re.sub(r'({SIZE * ROWS}"', solo, count=1) grown = grown.replace(" \n", buttons + " \n") xml = xml.replace(solo, grown, 1) xml = xml.replace(dial, dial.replace(" \n", rows + " \n"), 1) xml = xml.replace(" ", functions + " ", 1) SHOW.write_text(xml) print(f"Dropped the movers' Strobe and added {len(MOVES)} shapes to {SHOW.relative_to(ROOT)} " f"(functions {fid}–{fid + len(MOVES) - 1}, widgets {wid}–{wid + len(MOVES) - 1})") if __name__ == "__main__": main()