-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix issue with background being shifted from text. only create bitmap… #2
Conversation
… if it will get used.
@FoamyGuy I will take a look but may not be until Sunday. Also please considering adding the font file to the example package so that some of these examples will work without any changes. |
…tilegrid inside init
@kmatch98 I've implemented the last few tweaks that we discussed. I think this one is good to go now. I tested it out with the background color example again as well as a few other simple_text things that got broken by the anchored position issue. Everything seems to working as intended now. |
@FoamyGuy I found a three issues to consider, mostly dealing with possible where the bitmap is added or removed from the group. One I have a fix for, the second I don't fully understand. I'll just write the information here, since I'm not savvy enough with git to edit your PR to merge these changes. Both of these are in
I added this
Note: The line numbers may have shifted since I made some edits. The "Group index out of range" error occurs when trying to insert into an empty group. That's unexpected to me, since I know that for lists, it is ok to insert an element to an empty list. I tried a simple experiment on the command line, and I think this is a bug in the Group library that errors when inserting an item into an empty Group? Maybe we should push this up as an issue in the Group label. In the meantime, you can check the length of the self. Group and if it's empty you can use append. Not so clean, but will work for now. This was the error when changing text to blank
Here is a command line experiment that shows a bug where insert doesn't work with an empty Group:
Here is the error that I received:
Overall it seems like this is getting complicated for a simple background, but I guess new features always add these complications. And we're still left with the open question about dealing with fixed size fonts.... |
if (
self._background_color
and len(new_text) + self._padding_left + self._padding_right > 0
): Should be causing the bitmap to not get added if there is no text and padding (i.e. if background would have been 0 size). This could probably use some more testing though. I don't think I checked specifically setting the text to empty. |
Item 3: Here are a couple of possible things that could arise.
One options is that size can be checked inside of One other approach is to remove any background box changes from |
This stopped my program from constantly crashing.. it runs with about 20K ram free and when I went to display text, previously, it would crash. Hasn't crashed yet with this code.. knock on wood. |
I reviewed your changes but I have a few more updates. I don't know the best way of merging both changes, so here is what I will do. I will merge your changes on this pull request, and then I'll merge my updates. I'll send you a note when I merge both and then you can review all these changes. |
… if it will get used.
I think these changes fix the walking text problem and avoid creating a bitmap until it's needed based on users selection of background color and current text+padding.
There is still probably improvement to be had by refactoring the bitmap creation into a function to avoid repetition. I can work on that if this version is working correctly.
@kmatch98 If you have a moment please try this out with display_text_background_color_padding.py and confirm if that seems to be working as expected now.
If these changes do look good I think they will populate over to the main repo PR if you accept them here.