adafruit / Adafruit_Learning_System_Guides

Programs and scripts to display "inline" in Adafruit Learning System guides
MIT License
984 stars 769 forks source link

Remove max_size and max_glyphs from CircuitPython examples #1603

Closed lesamouraipourpre closed 3 years ago

lesamouraipourpre commented 3 years ago

The max_size parameter on displayio.Group is currently ignored and is (hopefully) going to be removed before 7.0.0 final. The libraries are having this parameter removed from them - https://github.com/adafruit/circuitpython/issues/4959

Edit: I've update the grep to look for max_glyphs related to DIsplay_Text Label as well.

This issue is intended as a tracking issue as the Learn Guide code is worked through { grep -r "Group.*max_size" * && grep -r "max_glyphs" * ; } | sed -e "s/\/.*//" | sort | uniq to give directories { grep -r "Group.*max_size" * && grep -r "max_glyphs" * ; } | grep -v "_JEplayer_" | sort gives (updated 2021/08/06 14:20 BST)

Matrix_On_Air/matrix_on_air.py:    deco_font, color=color[1], text="AIR", max_glyphs=6
Matrix_On_Air/matrix_on_air.py:    deco_font, color=color[3], text="OFF", max_glyphs=6
Matrix_On_Air/matrix_on_air.py:group = displayio.Group(max_size=22)
PyPortal_Calculator/code.py:calc_display = Label(font, text="0", color=BLACK, max_glyphs=MAX_DIGITS)
PyPortal_Calculator/code.py:calc_group = displayio.Group(max_size=25)
PyPortal_Calculator/titano_code.py:calc_display = Label(font, text="0", color=BLACK, max_glyphs=MAX_DIGITS)
PyPortal_Calculator/titano_code.py:calc_group = displayio.Group(max_size=25)
PyPortal_Titano_Weather_Station/openweather_graphics.py:        self.date_text = Label(self.medium_font, max_glyphs=60)
PyPortal_Titano_Weather_Station/openweather_graphics.py:        self.description_text = Label(self.small_font, max_glyphs=60)
PyPortal_Titano_Weather_Station/openweather_graphics.py:                    self.holiday_text = Label(self.medium_font, max_glyphs=60)
PyPortal_Titano_Weather_Station/openweather_graphics.py:        self._icon_group = displayio.Group(max_size=1)
PyPortal_Titano_Weather_Station/openweather_graphics.py:        self.main_text = Label(self.weather_font, max_glyphs=20)
PyPortal_Titano_Weather_Station/openweather_graphics.py:        self.temp_text = Label(self.large_font, max_glyphs=6)
PyPortal_Titano_Weather_Station/openweather_graphics.py:        self._text_group = displayio.Group(max_size=12)
PyPortal_Titano_Weather_Station/openweather_graphics.py:        self.time_text = Label(self.medium_font, max_glyphs=8)

If the associated Learn Guide text needs updated I will make a comment on any created PRs. Is there a better way to do this @kattni or @makermelissa ?

kattni commented 3 years ago

@lesamouraipourpre Unfortunately, this is pretty much the only way to do it. Thank you for making this list! This update needs to be made, and updating the code is a great first step. Not all guides will have associated walk-throughs or text requiring changes, but guarantee that some of them will.

Perhaps @FoamyGuy is up for assisting with this on the Learn guide side of things?

lesamouraipourpre commented 3 years ago

Not a problem, I will try to start working through these. A potential issue noticed on @FoamyGuy 's stream on Saturday was that some Learn Guides were written for CircuitPython 3 (and possibly earlier) and may need other changes.

As I don't have the hardware for most of the guides, I will focus on the max_size change and try and report any other issues.

FoamyGuy commented 3 years ago

I am going to start working on this list from the bottom moving upwards to avoid accidentally duplicating any of @lesamouraipourpre 's work

lesamouraipourpre commented 3 years ago

Sounds Good. I'll continue downwards.

lesamouraipourpre commented 3 years ago

@FoamyGuy I've modified the grep search to look for max_glyphs as well - it's added a few more to the list.

lesamouraipourpre commented 3 years ago

All current Learn guides have had max_size and max_glyphs usage removed.

ladyada commented 3 years ago

wooohoo! thank you :)