From 36ef657938d3e30baf40dbf7aa8c0689c9924ce6 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 31 Oct 2022 12:28:26 -0400 Subject: [PATCH] [177] update overlays for queues --- VERSION | 2 +- defaults/overlays/templates.yml | 4 ++++ modules/overlay.py | 12 +++++------- modules/util.py | 13 +++++++------ 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/VERSION b/VERSION index 0e1c84c2..e9dc4ce8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.3-develop176 +1.17.3-develop177 diff --git a/defaults/overlays/templates.yml b/defaults/overlays/templates.yml index ee34045f..5fd68ddd 100644 --- a/defaults/overlays/templates.yml +++ b/defaults/overlays/templates.yml @@ -27,6 +27,10 @@ templates: - queue - weight - font_style + - horizontal_offset + - horizontal_align + - vertical_offset + - vertical_align - stroke_width - stroke_color - back_color diff --git a/modules/overlay.py b/modules/overlay.py index bf05fbe2..1c02db1a 100644 --- a/modules/overlay.py +++ b/modules/overlay.py @@ -436,13 +436,11 @@ class Overlay: else: return value - if new_cords is None: - ho = self.horizontal_offset - ha = self.horizontal_align - vo = self.vertical_offset - va = self.vertical_align - else: - ha, ho, va, vo = new_cords + ho = new_cords[0] if new_cords and self.horizontal_offset is None else self.horizontal_offset + ha = new_cords[1] if new_cords and self.horizontal_align is None else self.horizontal_align + vo = new_cords[2] if new_cords and self.vertical_offset is None else self.vertical_offset + va = new_cords[3] if new_cords and self.vertical_align is None else self.vertical_align + return get_cord(ho, canvas_box[0], box[0], ha), get_cord(vo, canvas_box[1], box[1], va) def get_canvas(self, item): diff --git a/modules/util.py b/modules/util.py index 5c2ea471..766cca92 100644 --- a/modules/util.py +++ b/modules/util.py @@ -777,9 +777,14 @@ def parse(error, attribute, data, datatype=None, methods=None, parent=None, defa def parse_cords(data, parent, required=False): horizontal_align = parse("Overlay", "horizontal_align", data["horizontal_align"], parent=parent, - options=["left", "center", "right"]) if "horizontal_align" in data else "left" + options=["left", "center", "right"]) if "horizontal_align" in data else None + if required and horizontal_align is None: + raise Failed(f"Overlay Error: {parent} horizontal_align is required") + vertical_align = parse("Overlay", "vertical_align", data["vertical_align"], parent=parent, - options=["top", "center", "bottom"]) if "vertical_align" in data else "top" + options=["top", "center", "bottom"]) if "vertical_align" in data else None + if required and vertical_align is None: + raise Failed(f"Overlay Error: {parent} vertical_align is required") horizontal_offset = None if "horizontal_offset" in data and data["horizontal_offset"] is not None: @@ -799,8 +804,6 @@ def parse_cords(data, parent, required=False): elif horizontal_align == "center" and per and (x_off > 50 or x_off < -50): raise Failed(f"{error} between -50% and 50%") horizontal_offset = f"{x_off}%" if per else x_off - if horizontal_offset is None and horizontal_align == "center": - horizontal_offset = 0 if required and horizontal_offset is None: raise Failed(f"Overlay Error: {parent} horizontal_offset is required") @@ -822,8 +825,6 @@ def parse_cords(data, parent, required=False): elif vertical_align == "center" and per and (y_off > 50 or y_off < -50): raise Failed(f"{error} between -50% and 50%") vertical_offset = f"{y_off}%" if per else y_off - if vertical_offset is None and vertical_align == "center": - vertical_offset = 0 if required and vertical_offset is None: raise Failed(f"Overlay Error: {parent} vertical_offset is required")