Skip to content

No longer use position at all #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions adafruit_display_shapes/rect.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, x, y, width, height, *, fill=None, outline=None, stroke=1):
self._palette[0] = fill
else:
self._palette.make_transparent(0)
super().__init__(self._bitmap, pixel_shader=self._palette, position=(x, y))
super().__init__(self._bitmap, pixel_shader=self._palette, x=x, y=y)

@property
def fill(self):
Expand All @@ -105,23 +105,3 @@ def outline(self, color):
self._palette.make_transparent(1)
else:
self._palette[1] = color

@property
def x(self):
"""The x coordinate of the position"""
return self.position[0]

@x.setter
def x(self, x):
# pylint: disable=attribute-defined-outside-init
self.position = (x, self.position[1])

@property
def y(self):
"""The y coordinate of the position"""
return self.position[1]

@y.setter
def y(self, y):
# pylint: disable=attribute-defined-outside-init
self.position = (self.position[0], y)
23 changes: 1 addition & 22 deletions adafruit_display_shapes/roundrect.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self, x, y, width, height, r, *, fill=None, outline=None, stroke=1)
# draw round corners
self._helper(r, r, r, color=1, stroke=stroke,
x_offset=width-2*r-1, y_offset=height-2*r-1)
super().__init__(self._bitmap, pixel_shader=self._palette, position=(x, y))
super().__init__(self._bitmap, pixel_shader=self._palette, x=x, y=y)

# pylint: disable=invalid-name, too-many-locals, too-many-branches
def _helper(self, x0, y0, r, *, color, x_offset=0, y_offset=0,
Expand Down Expand Up @@ -164,24 +164,3 @@ def outline(self, color):
self._palette.make_transparent(1)
else:
self._palette[1] = color


@property
def x(self):
"""The x coordinate of the position"""
return self.position[0]

@x.setter
def x(self, x):
# pylint: disable=attribute-defined-outside-init
self.position = (x, self.position[1])

@property
def y(self):
"""The y coordinate of the position"""
return self.position[1]

@y.setter
def y(self, y):
# pylint: disable=attribute-defined-outside-init
self.position = (self.position[0], y)
6 changes: 2 additions & 4 deletions examples/display_shapes_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
color_bitmap = displayio.Bitmap(320, 240, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0xFFFFFF
bg_sprite = displayio.TileGrid(color_bitmap,
pixel_shader=color_palette,
position=(0, 0))
print(bg_sprite.position)
bg_sprite = displayio.TileGrid(color_bitmap, x=0, y=0,
pixel_shader=color_palette)
splash.append(bg_sprite)
##########################################################################

Expand Down