#!/usr/bin/env python3 """Drop the movers' chases from shows/test.qxw and put Wander and Ballyhoo on the top row. The movers layer loses its Chase, Chase reverse, Zigzag and Opposing pads (notes 96–99), their runs, holds, colour matrices and fixture groups, and their place on the Speed dial. Wander and Ballyhoo move up from notes 93 and 94 to the first two pads of the top row: 96 Wander pad 13 on the movers layer 97 Ballyhoo pad 14 on the movers layer The movers' Strobe (92) and Peak stay. padcontroller/layer.py settles the knobs after notes 96 and 97. python3 scripts/shows/mover_pads_top_row.py Run it once on a show with the mover chases; it stops if they are gone. QLC+ has to reopen the show to see it. """ from __future__ import annotations import re from mover_bank import (F_DIMMER, F_OPP, GROUP_OPPOSING, GROUP_RINGS, GROUP_ZIGZAG, ROOT, note) SHOW = ROOT / "shows" / "test.qxw" CHASE_FUNCTIONS = range(F_DIMMER, F_OPP + 1) # 57–63 CHASE_GROUPS = (GROUP_RINGS, GROUP_ZIGZAG, GROUP_OPPOSING) CHASE_PADS = ("Chase", "Chase reverse", "Zigzag", "Opposing") TOP_ROW = (("Wander", 10, note(48)), ("Ballyhoo", 100, note(49))) 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 chase forward run"' not in xml: raise SystemExit(f"{SHOW.relative_to(ROOT)} has no mover chases") for fid in CHASE_FUNCTIONS: xml = cut(xml, rf' \n') xml = re.sub(rf' {fid}\n', "", xml) for gid in CHASE_GROUPS: xml = cut(xml, rf' \n.*? \n') pads = re.search(r' \n.*?\n \n', xml, re.S).group(0) kept = pads for caption in CHASE_PADS: kept = cut(kept, rf' \n') for caption, x, channel in TOP_ROW: kept, n = re.subn(rf'(