#!/usr/bin/env python3 """Add Circle and Sweep for the movers to shows/test.qxw, on notes 98 and 99. They fill the top row of the movers layer after Wander and Ballyhoo, in the same Movement solo frame, so only one of the four runs at a time. Like them, each is a relative EFX around wherever the Pan and Tilt knobs (9 and 10) put the movers: 98 Circle pad 15 a circle about ±45° of pan and ±21° of tilt 99 Sweep pad 16 a straight pan sweep, about ±60° side to side All four movers start together, so the pairs mirror left to right and front to back as in Ballyhoo. Each fades in over 0.5 s. Knob 13's Movers speed dial gives them a quarter of its time, less the fade-in that QLC+ counts in each round: 5.5 s a round to start with, from 15.5 s fully left to 2.5 s fully right. padcontroller/layer.py settles the knobs after them too. python3 scripts/shows/mover_more_efx.py Run it once on a show with the Movement solo frame and the Movers speed dial; it stops if Circle is already there. QLC+ has to reopen the show to see it. """ from __future__ import annotations import re from mover_bank import LEFT_TO_RIGHT, NO_FUNCTION, ROOT, button, note SHOW = ROOT / "shows" / "test.qxw" FADE_IN_MS = 500 START_MS = 6000 # a quarter of the speed dial's starting 24 s TIMES_1_4 = 4 # speed dial factor index: (Not Sent), 0, 1/16, 1/8, 1/4, ... SIZE = 90 # Caption, function name, algorithm, width, height (of 255 each way), can note, column MOVES = ( ("Circle", "Movers circle", "Circle", 21, 20, 50, 2), ("Sweep", "Movers sweep", "Line", 28, 0, 51, 3), ) def efx(fid: int, name: str, algorithm: str, width: int, height: int, start_ms: int = START_MS) -> str: fixtures = "".join(f""" {f} 0 0 Forward 0 """ for f in LEFT_TO_RIGHT) axes = "".join(f""" 127 1 0 """ for axis in "XY") # Relative: the EFX adds its offset from 127 to the Pan and Tilt sliders' levels. return f""" {fixtures} Parallel Forward Loop {algorithm} {width} {height} 0 0 1 {axes} """ def main() -> None: xml = SHOW.read_text() if 'Name="Movers circle"' in xml: raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the movers circle") 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) in enumerate(MOVES): functions += efx(fid + i, name, algorithm, width, height) buttons += button(wid + i, caption, SIZE * column, 0, SIZE, fid + i, note(can_note), indent=" ") rows += f' {fid + i}\n' columns = 2 + len(MOVES) grown = re.sub(r'({SIZE * columns}"', 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"Added Circle and Sweep to {SHOW.relative_to(ROOT)} (functions {fid}–{fid + len(MOVES) - 1}, " f"widgets {wid}–{wid + len(MOVES) - 1})") if __name__ == "__main__": main()