@@ -50,10 +50,11 @@ class RoundRect(displayio.TileGrid):
50
50
not change outer bound size set by width and height. Fill can be a hex value
51
51
for the color or None for transparent. Outline can be a hex value for the color
52
52
or None for no outline."""
53
- def __init__ (self , x , y , width , height , r , * , fill = None , outline = None , stroke = 1 ):
53
+ def __init__ (self , x , y , width , height , r , * , fill = None , outline = None , stroke = 1 ): # pylint: disable=too-many-arguments
54
54
self ._bitmap = displayio .Bitmap (width , height , 3 )
55
55
self ._palette = displayio .Palette (3 )
56
56
self ._palette .make_transparent (0 )
57
+ self .position = None # this is reset by the super().init
57
58
58
59
if fill is not None :
59
60
for i in range (0 , width ): # draw the center chunk
@@ -72,16 +73,18 @@ def __init__(self, x, y, width, height, r, *, fill=None, outline=None, stroke=1)
72
73
for line in range (stroke ):
73
74
self ._bitmap [w , line ] = 1
74
75
self ._bitmap [w , height - line - 1 ] = 1
75
- for h in range (r , height - r ):
76
+ for _h in range (r , height - r ):
76
77
for line in range (stroke ):
77
- self ._bitmap [line , h ] = 1
78
- self ._bitmap [width - line - 1 , h ] = 1
78
+ self ._bitmap [line , _h ] = 1
79
+ self ._bitmap [width - line - 1 , _h ] = 1
79
80
# draw round corners
80
81
self ._helper (r , r , r , color = 1 , stroke = stroke ,
81
82
x_offset = width - 2 * r - 1 , y_offset = height - 2 * r - 1 )
82
83
83
84
super ().__init__ (self ._bitmap , pixel_shader = self ._palette , position = (x , y ))
84
85
86
+
87
+ # pylint: disable=invalid-name, too-many-locals, too-many-branches
85
88
def _helper (self , x0 , y0 , r , * , color , x_offset = 0 , y_offset = 0 ,
86
89
stroke = 1 , cornerflags = 0xF , fill = False ):
87
90
f = 1 - r
@@ -126,6 +129,7 @@ def _helper(self, x0, y0, r, *, color, x_offset=0, y_offset=0,
126
129
for line in range (stroke ):
127
130
self ._bitmap [x0 + x + x_offset , y0 - y + line ] = color
128
131
self ._bitmap [x0 + y + x_offset - line , y0 - x ] = color
132
+ # pylint: enable=invalid-name, too-many-locals, too-many-branches
129
133
130
134
@property
131
135
def x (self ):
@@ -141,6 +145,6 @@ def y(self):
141
145
"""The y coordinate of the position"""
142
146
return self .position [1 ]
143
147
144
- @x .setter
148
+ @y .setter
145
149
def y (self , y ):
146
150
self .position = (self .position [0 ], y )
0 commit comments