Their two buttons go into a Movement solo frame where they sit, so starting one stops the other (scripts/shows/mover_movement_solo.py). The pad controller follows: it tracks the one that is on, and settles the knobs only when that one goes off. Swapping needs no settle, as the new EFX writes over the old one's offset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
2.3 KiB
Python
58 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Make Wander and Ballyhoo one at a time in shows/test.qxw.
|
|
|
|
Their two buttons go into a solo frame, Movement, where they already sit on the
|
|
top row of the movers pads, so starting one stops the other, as the colour sets
|
|
do. padcontroller/layer.py follows the same rule.
|
|
|
|
python3 scripts/shows/mover_movement_solo.py
|
|
|
|
Run it once on a show with Wander and Ballyhoo on the top row; it stops if the
|
|
solo frame is already there. QLC+ has to reopen the show to see it.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
|
|
from mover_bank import NO_FUNCTION, ROOT, appearance
|
|
|
|
SHOW = ROOT / "shows" / "test.qxw"
|
|
|
|
BUTTONS = ("Wander", "Ballyhoo")
|
|
SIZE = 90
|
|
|
|
|
|
def main() -> None:
|
|
xml = SHOW.read_text()
|
|
if 'Caption="Movement"' in xml:
|
|
raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the Movement solo frame")
|
|
wid = max(int(i) for i in re.findall(r' ID="(\d+)"', xml.split("<VirtualConsole>")[1])
|
|
if int(i) != NO_FUNCTION) + 1
|
|
|
|
found = [re.search(rf' <Button Caption="{caption}" ID="\d+" Icon="">\n.*? </Button>\n', xml, re.S).group(0)
|
|
for caption in BUTTONS]
|
|
body = ""
|
|
for i, button in enumerate(found):
|
|
xml = xml.replace(button, "", 1)
|
|
# Inside the frame each sits at its place in the row, one level deeper.
|
|
moved = re.sub(r'X="\d+" Y="\d+"', f'X="{SIZE * i}" Y="0"', button, count=1)
|
|
body += "".join(" " + line if line else line for line in moved.splitlines(keepends=True))
|
|
|
|
frame = (f' <SoloFrame Caption="Movement" ID="{wid}">\n'
|
|
+ appearance(" ")
|
|
+ f' <WindowState Visible="True" X="10" Y="10" Width="{SIZE * len(BUTTONS)}" Height="{SIZE}"/>\n'
|
|
' <AllowChildren>True</AllowChildren>\n <AllowResize>True</AllowResize>\n'
|
|
' <ShowHeader>False</ShowHeader>\n <ShowEnableButton>False</ShowEnableButton>\n'
|
|
' <Mixing>False</Mixing>\n <Collapsed>False</Collapsed>\n <Disabled>False</Disabled>\n'
|
|
+ body + ' </SoloFrame>\n')
|
|
|
|
strobe = re.search(r' <Button Caption="Strobe" ID="89" Icon="">\n', xml).group(0)
|
|
xml = xml.replace(strobe, frame + strobe, 1)
|
|
SHOW.write_text(xml)
|
|
print(f"Put Wander and Ballyhoo in the Movement solo frame in {SHOW.relative_to(ROOT)} (widget {wid})")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|