displayio: make Group use a python list internally#4233
Conversation
|
I can't make the |
|
Note that it would be possible to add just the sort method without using a list internally — that function can sort any continuous array of python objects. |
d23a7ed to
fa1b6af
Compare
|
@deshipu Is this ready for review? Could you update the title to match your implementation? Thanks! |
df5989d to
5b503ab
Compare
|
Sorry, I missed the title is wrong. I rebased on top of main now, and removed the unnecessary changes. It's ready for reviews, thank you. |
tannewt
left a comment
There was a problem hiding this comment.
Thank you for tackling this!
I think you should add a deprecation notice in the docs of max_size (yay!!!) to say it'll be removed in 7.x and make it do nothing internally.
|
Thank you for your review, I will work on this further over the weekend. |
Since we want to expose the list of group's children to the user, we should only have the original objects in it, without any other additional data, and compute the native object as needed.
This is a first go at it, done by naive replacing of all array operations with corresponding operations on the list. Note that there is a lot of unnecessary type conversions, here. Also, list_pop has been copied, because it's decalerd STATIC in py/objlist.h
Still accept it as an argument. Add deprecation note.
5a49467 to
38fb7b5
Compare
Note that for some reason this makes the binary 500 bytes larger!
tannewt
left a comment
There was a problem hiding this comment.
Code looks good to me! Thank you! ugame10 looks unhappy though unfortunately.

The
displayio.Groupshould use a python list for keeping its members, so that we don't have to setmax_sizeexplicitly, and we can use list-like methods likesorton it.