[177] update overlays for queues

pull/1152/head
meisnate12 2 years ago
parent b493a843ad
commit 36ef657938

@ -1 +1 @@
1.17.3-develop176 1.17.3-develop177

@ -27,6 +27,10 @@ templates:
- queue - queue
- weight - weight
- font_style - font_style
- horizontal_offset
- horizontal_align
- vertical_offset
- vertical_align
- stroke_width - stroke_width
- stroke_color - stroke_color
- back_color - back_color

@ -436,13 +436,11 @@ class Overlay:
else: else:
return value return value
if new_cords is None: ho = new_cords[0] if new_cords and self.horizontal_offset is None else self.horizontal_offset
ho = self.horizontal_offset ha = new_cords[1] if new_cords and self.horizontal_align is None else self.horizontal_align
ha = self.horizontal_align vo = new_cords[2] if new_cords and self.vertical_offset is None else self.vertical_offset
vo = self.vertical_offset va = new_cords[3] if new_cords and self.vertical_align is None else self.vertical_align
va = self.vertical_align
else:
ha, ho, va, vo = new_cords
return get_cord(ho, canvas_box[0], box[0], ha), get_cord(vo, canvas_box[1], box[1], va) return get_cord(ho, canvas_box[0], box[0], ha), get_cord(vo, canvas_box[1], box[1], va)
def get_canvas(self, item): def get_canvas(self, item):

@ -777,9 +777,14 @@ def parse(error, attribute, data, datatype=None, methods=None, parent=None, defa
def parse_cords(data, parent, required=False): def parse_cords(data, parent, required=False):
horizontal_align = parse("Overlay", "horizontal_align", data["horizontal_align"], parent=parent, 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, 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 horizontal_offset = None
if "horizontal_offset" in data and data["horizontal_offset"] is not 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): elif horizontal_align == "center" and per and (x_off > 50 or x_off < -50):
raise Failed(f"{error} between -50% and 50%") raise Failed(f"{error} between -50% and 50%")
horizontal_offset = f"{x_off}%" if per else x_off 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: if required and horizontal_offset is None:
raise Failed(f"Overlay Error: {parent} horizontal_offset is required") 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): elif vertical_align == "center" and per and (y_off > 50 or y_off < -50):
raise Failed(f"{error} between -50% and 50%") raise Failed(f"{error} between -50% and 50%")
vertical_offset = f"{y_off}%" if per else y_off 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: if required and vertical_offset is None:
raise Failed(f"Overlay Error: {parent} vertical_offset is required") raise Failed(f"Overlay Error: {parent} vertical_offset is required")

Loading…
Cancel
Save