From c924aba55c5572c5956cdb1915cc39d40ad7de1d Mon Sep 17 00:00:00 2001 From: June Tate-Gans Date: Sun, 9 May 2021 23:11:38 -0500 Subject: [PATCH] bitwidgets: Make rectangles actually have variable width outlines --- g13gui/bitwidgets/rectangle.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/g13gui/bitwidgets/rectangle.py b/g13gui/bitwidgets/rectangle.py index 19f5d19..f3666fd 100644 --- a/g13gui/bitwidgets/rectangle.py +++ b/g13gui/bitwidgets/rectangle.py @@ -2,20 +2,30 @@ from g13gui.bitwidgets.widget import Widget class Rectangle(Widget): - def __init__(self, x, y, w, h, fill=True, outline=0): + def __init__(self, x, y, w, h, fill=True, outline=False, width=1): Widget.__init__(self) self.position = (x, y) self.bounds = (w, h) self.fill = fill - self._outline = outline + self.outline = outline + self.width = width + + @property + def width(self): + return self._width + + @width.setter + def width(self, width): + self.setProperty('width', width) @property def outline(self): - return self._outline + return True if self._outline else False @outline.setter def outline(self, value): - self.setAttribute('outline', value) + value = 1 if value else 0 + self.setProperty('outline', value) def draw(self, ctx): if self._visible: @@ -24,4 +34,5 @@ class Rectangle(Widget): self._position[1] + self._bounds[1]) ctx.rectangle(points, fill=self._fill, - outline=self._outline) + outline=self._outline, + width=self._width)