mirror of
https://github.com/jtgans/g13gui.git
synced 2025-06-20 08:23:50 -04:00
bitwidgets: Make rectangles actually have variable width outlines
This commit is contained in:
parent
b2cc80e404
commit
c924aba55c
@ -2,20 +2,30 @@ from g13gui.bitwidgets.widget import Widget
|
|||||||
|
|
||||||
|
|
||||||
class Rectangle(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)
|
Widget.__init__(self)
|
||||||
self.position = (x, y)
|
self.position = (x, y)
|
||||||
self.bounds = (w, h)
|
self.bounds = (w, h)
|
||||||
self.fill = fill
|
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
|
@property
|
||||||
def outline(self):
|
def outline(self):
|
||||||
return self._outline
|
return True if self._outline else False
|
||||||
|
|
||||||
@outline.setter
|
@outline.setter
|
||||||
def outline(self, value):
|
def outline(self, value):
|
||||||
self.setAttribute('outline', value)
|
value = 1 if value else 0
|
||||||
|
self.setProperty('outline', value)
|
||||||
|
|
||||||
def draw(self, ctx):
|
def draw(self, ctx):
|
||||||
if self._visible:
|
if self._visible:
|
||||||
@ -24,4 +34,5 @@ class Rectangle(Widget):
|
|||||||
self._position[1] + self._bounds[1])
|
self._position[1] + self._bounds[1])
|
||||||
ctx.rectangle(points,
|
ctx.rectangle(points,
|
||||||
fill=self._fill,
|
fill=self._fill,
|
||||||
outline=self._outline)
|
outline=self._outline,
|
||||||
|
width=self._width)
|
||||||
|
Loading…
Reference in New Issue
Block a user