diff --git a/showfile/spec.py b/showfile/spec.py
index 784514d..d3d3857 100644
--- a/showfile/spec.py
+++ b/showfile/spec.py
@@ -132,6 +132,9 @@ def show_schema() -> dict[str, Any]:
"y": {"type": "integer"},
"w": {"type": "integer"},
"h": {"type": "integer"},
+ "pages": {"type": "integer", "minimum": 1, "description": "Frame only. More than 1 makes it a multipage frame."},
+ "loop": {"type": "boolean", "description": "Frame only. Next page after the last wraps to the first."},
+ "page": {"type": "integer", "minimum": 0, "description": "Frame inside a multipage frame: which page it is on, from 0."},
"fg": {"$ref": "#/$defs/colour"},
"bg": {"$ref": "#/$defs/colour"},
"function": {"type": "string", "description": "Function key for a button."},
@@ -352,6 +355,7 @@ def _add_widgets(show: Show, frame: Any, widgets: list[dict[str, Any]]) -> None:
cng=str(widget.get("cng", "None")),
inverted=bool(widget.get("inverted", False)),
input=binding,
+ function=widget.get("function"),
**box,
)
elif kind == "button":
@@ -380,6 +384,9 @@ def _add_widgets(show: Show, frame: Any, widgets: list[dict[str, Any]]) -> None:
widget["caption"],
solo=kind == "solo" or bool(widget.get("solo", False)),
header=bool(widget.get("header", True)),
+ pages=int(widget.get("pages", 1)),
+ loop=bool(widget.get("loop", False)),
+ page=int(widget.get("page", 0)),
**box,
)
_add_widgets(show, child, widget.get("children") or [])
@@ -784,7 +791,11 @@ def _check_widgets(
_err(errors, f"{here}.{field}", "must be an integer")
if kind == "slider":
channels = widget.get("channels")
- if not isinstance(channels, list) or not channels:
+ if "function" in widget:
+ if widget["function"] not in functions:
+ _err(errors, f"{here}.function", f"unknown function {widget['function']!r}")
+ channels = []
+ elif not isinstance(channels, list) or not channels:
_err(errors, f"{here}.channels", "must list [fixture, channel] pairs")
else:
for pair in channels:
diff --git a/showfile/vc.py b/showfile/vc.py
index b2b29a9..6326573 100644
--- a/showfile/vc.py
+++ b/showfile/vc.py
@@ -26,6 +26,7 @@ class Slider:
cng: str = "None"
inverted: bool = False
binding: MidiBinding | None = None
+ function_id: int | None = None # set for a Playback slider, which has no channels
type_name: str = "Slider"
def render(self, indent: str = " ") -> str:
@@ -42,13 +43,13 @@ class Slider:
f'Width="{self.w}" Height="{self.h}"/>\n'
f"{appearance(fg=self.fg, indent=inner)}\n"
f'{inner}Level\n'
+ f'Monitor="true">{"Playback" if self.function_id is not None else "Level"}\n'
f"{inner}\n"
f'{inner}\n'
f"{channels}\n"
f"{inner}\n"
f"{inner}\n"
- f"{inner} {INVALID_FUNCTION}\n"
+ f"{inner} {INVALID_FUNCTION if self.function_id is None else self.function_id}\n"
f"{inner}{extra}\n"
f"{indent}"
)
@@ -132,6 +133,9 @@ class Frame:
solo: bool = False
root: bool = False
show_header: bool = True
+ pages: int = 1
+ loop: bool = False
+ page: int = 0
children: list[Any] = field(default_factory=list)
id: int | None = None
type_name: str = "Frame"
@@ -155,7 +159,10 @@ class Frame:
cng: str = "None",
inverted: bool = False,
input: MidiBinding | None = None,
+ function: Any = None,
) -> Slider:
+ if isinstance(function, str):
+ function = self.show.functions_by_key[function].id
widget = Slider(
id=self.show.alloc_widget(),
caption=caption,
@@ -169,6 +176,7 @@ class Frame:
cng=cng,
inverted=inverted,
binding=input,
+ function_id=function,
)
self.children.append(widget)
return widget
@@ -251,8 +259,11 @@ class Frame:
h: int,
solo: bool = False,
header: bool = True,
+ pages: int = 1,
+ loop: bool = False,
+ page: int = 0,
) -> Frame:
- child = Frame(self.show, caption, x, y, w, h, solo=solo, show_header=header)
+ child = Frame(self.show, caption, x, y, w, h, solo=solo, show_header=header, pages=pages, loop=loop, page=page)
self.children.append(child)
return child
@@ -281,9 +292,14 @@ class Frame:
if not self.solo:
flags.append(f"{inner}False")
flags.append(f"{inner}False")
- nested = "\n".join(child.render(inner) for child in self.children)
+ if self.pages > 1:
+ flags.append(
+ f'{inner}'
+ )
+ nested = "\n".join(_on_page(child, inner) for child in self.children)
+ page_attr = f' Page="{self.page}"' if self.page else ""
parts = [
- f"{indent}<{tag} Caption={attr(self.caption)} ID=\"{self.id}\">",
+ f"{indent}<{tag} Caption={attr(self.caption)} ID=\"{self.id}\"{page_attr}>",
appearance(indent=inner),
f'{inner}',
*flags,
@@ -294,6 +310,16 @@ class Frame:
return "\n".join(parts)
+def _on_page(child: Any, indent: str) -> str:
+ """Render a child, tagging its opening element with the frame page it is on."""
+ text = child.render(indent)
+ page = getattr(child, "page", 0)
+ if not page or isinstance(child, Frame):
+ return text
+ head, sep, rest = text.partition(">")
+ return f'{head} Page="{page}"{sep}{rest}'
+
+
def _input_xml(binding: MidiBinding | None, indent: str) -> str:
if binding is None:
return ""
diff --git a/shows/xchc.qxw b/shows/xchc.qxw
index dd9365d..a2b02e3 100644
--- a/shows/xchc.qxw
+++ b/shows/xchc.qxw
@@ -138,7 +138,7 @@
0
-
+
1,0,2,255,3,0,4,0,5,0,6,0,7,0
1,0,2,255,3,0,4,0,5,0,6,0,7,0
1,0,2,255,3,0,4,0,5,0,6,0,7,0
@@ -151,7 +151,7 @@
0,128,2,80,4,0,5,0,6,191,7,70,8,255,9,0,10,255,11,0,12,0,13,0,14,0,15,0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,0,27,0,28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0,36,0,37,0
-
+
1,0,2,255,3,127,4,0,5,0,6,0,7,0
1,0,2,255,3,127,4,0,5,0,6,0,7,0
1,0,2,255,3,127,4,0,5,0,6,0,7,0
@@ -164,7 +164,7 @@
0,128,2,80,4,0,5,0,6,191,7,70,8,255,9,0,10,255,11,127,12,0,13,0,14,0,15,0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,0,27,0,28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0,36,0,37,0
-
+
1,0,2,255,3,255,4,0,5,0,6,0,7,0
1,0,2,255,3,255,4,0,5,0,6,0,7,0
1,0,2,255,3,255,4,0,5,0,6,0,7,0
@@ -177,7 +177,7 @@
0,128,2,80,4,0,5,0,6,191,7,70,8,255,9,0,10,255,11,255,12,0,13,0,14,0,15,0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,0,27,0,28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0,36,0,37,0
-
+
1,0,2,0,3,255,4,0,5,0,6,0,7,0
1,0,2,0,3,255,4,0,5,0,6,0,7,0
1,0,2,0,3,255,4,0,5,0,6,0,7,0
@@ -190,7 +190,7 @@
0,128,2,80,4,0,5,0,6,191,7,70,8,255,9,0,10,0,11,255,12,0,13,0,14,0,15,0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,0,27,0,28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0,36,0,37,0
-
+
1,0,2,0,3,255,4,255,5,0,6,0,7,0
1,0,2,0,3,255,4,255,5,0,6,0,7,0
1,0,2,0,3,255,4,255,5,0,6,0,7,0
@@ -203,7 +203,7 @@
0,128,2,80,4,0,5,0,6,191,7,70,8,255,9,0,10,0,11,255,12,255,13,0,14,0,15,0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,0,27,0,28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0,36,0,37,0
-
+
1,0,2,0,3,0,4,255,5,0,6,0,7,0
1,0,2,0,3,0,4,255,5,0,6,0,7,0
1,0,2,0,3,0,4,255,5,0,6,0,7,0
@@ -216,7 +216,7 @@
0,128,2,80,4,0,5,0,6,191,7,70,8,255,9,0,10,0,11,0,12,255,13,0,14,0,15,0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,0,27,0,28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0,36,0,37,0
-
+
1,0,2,127,3,0,4,255,5,0,6,0,7,0
1,0,2,127,3,0,4,255,5,0,6,0,7,0
1,0,2,127,3,0,4,255,5,0,6,0,7,0
@@ -229,7 +229,7 @@
0,128,2,80,4,0,5,0,6,191,7,70,8,255,9,0,10,127,11,0,12,255,13,0,14,0,15,0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,0,27,0,28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0,36,0,37,0
-
+
1,0,2,255,3,0,4,255,5,0,6,0,7,0
1,0,2,255,3,0,4,255,5,0,6,0,7,0
1,0,2,255,3,0,4,255,5,0,6,0,7,0
@@ -242,7 +242,7 @@
0,128,2,80,4,0,5,0,6,191,7,70,8,255,9,0,10,255,11,0,12,255,13,0,14,0,15,0,16,0,17,0,18,0,19,0,20,0,21,0,22,0,23,0,24,0,25,0,26,0,27,0,28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0,36,0,37,0
-
+
1,0,2,0,3,0,4,0,5,255,6,0,7,0
1,0,2,0,3,0,4,0,5,255,6,0,7,0
1,0,2,0,3,0,4,0,5,255,6,0,7,0