Skip to content

Commit

Permalink
[TemplateParser]
Browse files Browse the repository at this point in the history
* fix/improve position="fill"
  • Loading branch information
jbleyel committed Jan 20, 2025
1 parent 7c4cb83 commit 5ba685d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/python/skin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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():
Expand Down

0 comments on commit 5ba685d

Please sign in to comment.