@@ -50,10 +50,11 @@ class RoundRect(displayio.TileGrid):
5050 not change outer bound size set by width and height. Fill can be a hex value
5151 for the color or None for transparent. Outline can be a hex value for the color
5252 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
5454 self ._bitmap = displayio .Bitmap (width , height , 3 )
5555 self ._palette = displayio .Palette (3 )
5656 self ._palette .make_transparent (0 )
57+ self .position = None # this is reset by the super().init
5758
5859 if fill is not None :
5960 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)
7273 for line in range (stroke ):
7374 self ._bitmap [w , line ] = 1
7475 self ._bitmap [w , height - line - 1 ] = 1
75- for h in range (r , height - r ):
76+ for _h in range (r , height - r ):
7677 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
7980 # draw round corners
8081 self ._helper (r , r , r , color = 1 , stroke = stroke ,
8182 x_offset = width - 2 * r - 1 , y_offset = height - 2 * r - 1 )
8283
8384 super ().__init__ (self ._bitmap , pixel_shader = self ._palette , position = (x , y ))
8485
86+
87+ # pylint: disable=invalid-name, too-many-locals, too-many-branches
8588 def _helper (self , x0 , y0 , r , * , color , x_offset = 0 , y_offset = 0 ,
8689 stroke = 1 , cornerflags = 0xF , fill = False ):
8790 f = 1 - r
@@ -126,6 +129,7 @@ def _helper(self, x0, y0, r, *, color, x_offset=0, y_offset=0,
126129 for line in range (stroke ):
127130 self ._bitmap [x0 + x + x_offset , y0 - y + line ] = color
128131 self ._bitmap [x0 + y + x_offset - line , y0 - x ] = color
132+ # pylint: enable=invalid-name, too-many-locals, too-many-branches
129133
130134 @property
131135 def x (self ):
@@ -141,6 +145,6 @@ def y(self):
141145 """The y coordinate of the position"""
142146 return self .position [1 ]
143147
144- @x .setter
148+ @y .setter
145149 def y (self , y ):
146150 self .position = (self .position [0 ], y )
0 commit comments