-
Notifications
You must be signed in to change notification settings - Fork 18
use extended Group instead of property #23
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
Conversation
I think you could use a property to have |
I think this is ready to go now. I have added a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more set of suggestions. I don't think the zeroes help going forwards.
adafruit_button.py
Outdated
self._label.x = 0 + (self.width - dims[2]) // 2 | ||
self._label.y = 0 + self.height // 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._label.x = 0 + (self.width - dims[2]) // 2 | |
self._label.y = 0 + self.height // 2 | |
self._label.x = (self.width - dims[2]) // 2 | |
self._label.y = self.height // 2 |
I think these zeroes will be confusing going forwards.
adafruit_button.py
Outdated
width - 2, | ||
height - 2, | ||
fill=self.fill_color, | ||
outline=self.outline_color, | ||
) | ||
elif style == Button.SHADOWROUNDRECT: | ||
self.shadow = RoundRect( | ||
x + 2, y + 2, width - 2, height - 2, r=10, fill=self.outline_color | ||
0 + 2, 0 + 2, width - 2, height - 2, r=10, fill=self.outline_color |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 + 2, 0 + 2, width - 2, height - 2, r=10, fill=self.outline_color | |
2, 2, width - 2, height - 2, r=10, fill=self.outline_color |
adafruit_button.py
Outdated
@@ -148,32 +147,32 @@ def __init__( | |||
) | |||
elif style == Button.SHADOWRECT: | |||
self.shadow = Rect( | |||
x + 2, y + 2, width - 2, height - 2, fill=outline_color | |||
0 + 2, 0 + 2, width - 2, height - 2, fill=outline_color |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 + 2, 0 + 2, width - 2, height - 2, fill=outline_color | |
2, 2, width - 2, height - 2, fill=outline_color |
Latest commit removes the usage of extra zeros in the calculations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you!
Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Button to 1.4.0 from 1.3.4: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Button#23 from FoamyGuy/use_extended_group Updating https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation to 2.4.1 from 2.4.0: > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#63 from rhooper/refactor-to-ms
This is the beginning of a resolution for the issue raised by #22 .
I have done basic testing with a slightly modified simpletest and it seems to be working as intended so far. It does need some more thorough testing though. And the example scripts should be updated to use the the API without accessing
group
property.However in making these changes and testing them out I got to thinking about the ramifications a bit more. This change as it is now breaks any existing user code that uses the button since the
group
property will no longer exist.Maybe it would be good to provide backwards compatibility for some time by returning the correct thing from a
group
property along with printing a deprecation warning message?I will work on getting this tested more and updating the examples this week. I wanted to get this PR created to see if anyone else has thoughts about making this change and/or the deprecation considerations.