-
Notifications
You must be signed in to change notification settings - Fork 55
Added terminalio font support and scaling #86
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
The reason I added scaling into this PR (backported from MatrixPortal) is because the terminalio font at default size is very small. |
Could we share the graphics bits of the two portal libraries instead of backporting between the two? |
Maybe, but the graphics are dealt with quite differently due to the different display sizes. For instance, I have a scrolling type for the Matrix that isn't needed with the PyPortal. |
@@ -399,6 +407,9 @@ def __init__( | |||
self._text_wrap[i] = text_wrap[i] | |||
self._text_maxlen[i] = text_maxlen[i] | |||
self._text_transform[i] = text_transform[i] | |||
if not isinstance(text_scale[i], (int, float)) or text_scale[i] < 1: |
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.
I tested these changes and I am getting and I'm getting an exception from this line:
Traceback (most recent call last):
File "code.py", line 80, in <module>
File "/lib/adafruit_pyportal.py", line 410, in __init__
TypeError: 'int' object is not subscriptable
I'm using the code from the quotes example here: https://learn.adafruit.com/adafruit-pyportal/parsing-json. I tried with the code as-is, and with the new text_scale
parameter added, I'm getting same results both ways.
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.
I was able to get past this error by adding a check for text_scale
type inside the body of the if statement at line 368 of the modified code. Now mine looks like:
if isinstance(text_position[0], (list, tuple)):
num = len(text_position)
if not text_wrap:
text_wrap = [0] * num
if not text_maxlen:
text_maxlen = [0] * num
if not text_transform:
text_transform = [None] * num
if isinstance(text_scale, int): # new check for text scale
text_scale = [text_scale] * num
kk, maybe it's the network stuff we should be sharing. It makes sense the graphics would be different. |
Thanks @FoamyGuy, I updated the code. |
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.
Tested with the newest commits and it's working well now.
Looks good to me. Thanks for this new feature @makermelissa
Updating https://github.com/adafruit/Adafruit_CircuitPython_MONSTERM4SK to 0.0.1 from b9f1195: < Merge pull request adafruit/Adafruit_CircuitPython_MONSTERM4SK#2 from FoamyGuy/main < Merge pull request adafruit/Adafruit_CircuitPython_MONSTERM4SK#1 from FoamyGuy/main < fixing a few things in setup py < adding rainbow star example. implementing buttons property in the library < remove pypi upload from actions Updating https://github.com/adafruit/Adafruit_CircuitPython_PyPortal to 3.6.0 from 3.5.0: > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#86 from makermelissa/terminalio Updating https://github.com/adafruit/Adafruit_CircuitPython_VCNL4010 to 0.10.4 from 0.10.3: > Merge pull request adafruit/Adafruit_CircuitPython_VCNL4010#14 from gpshead/typo-proxinity Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Added the following libraries: Adafruit_CircuitPython_EMC2101, Adafruit_CircuitPython_MONSTERM4SK
Fixes #72.