From 5ba685d8ee155eee015743c5f72886ddde82cd78 Mon Sep 17 00:00:00 2001 From: jbleyel Date: Mon, 20 Jan 2025 22:56:51 +0100 Subject: [PATCH] [TemplateParser] * fix/improve position="fill" --- lib/python/skin.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/python/skin.py b/lib/python/skin.py index 9e5075289d6..d5aa1c386bf 100644 --- a/lib/python/skin.py +++ b/lib/python/skin.py @@ -1969,6 +1969,9 @@ def collectAttributes(self, node, context, ignore=(), excludeItemIndexes=None, i return [] if itemIndex and excludeItemIndexes and itemIndex in excludeItemIndexes: return [] + if pos == "fill": + pos = "0,0" + size = f"{context.w},{context.h}" if pos is not None: pos, size = context.parse(pos, size, None) skinAttributes.append(("position", pos)) @@ -1995,7 +1998,11 @@ def processPanel(self, widget, context, excludeItemIndexes=None, includeItemInde print(f"[TemplateParser] processPanel DEBUG: Position={widget.attrib.get("position")}, Size={widget.attrib.get("size")}.") print(f"[TemplateParser] processPanel DEBUG: Parent x={context.x}, width={context.w}.") position = widget.attrib.get("position") - if "left" in position or "right" in position: + if position == "fill": + position = [0, 0] + widget.attrib["position"] = "0,0" + widget.attrib["size"] = f"{context.w},{context.h}" + elif "left" in position or "right" in position: pos = position.split(",") top = 0 if len(pos) == 2 and pos[0] in ("left", "right") and pos[1].isdigit():