Content-Length: 224840 | pFad | http://github.com/adafruit/circuitpython/issues/10226

99 vectorio shapes can be added to groups multiple times · Issue #10226 · adafruit/circuitpython · GitHub
Skip to content
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

vectorio shapes can be added to groups multiple times #10226

Open
Neradoc opened this issue Apr 6, 2025 · 2 comments
Open

vectorio shapes can be added to groups multiple times #10226

Neradoc opened this issue Apr 6, 2025 · 2 comments

Comments

@Neradoc
Copy link

Neradoc commented Apr 6, 2025

CircuitPython version and board name

Adafruit CircuitPython 10.0.0-alpha.2 on 2025-04-04; Waveshare ESP32S3 Touch LCD 2 with ESP32S3

Code/REPL

import board
import displayio
import time
import vectorio

display = board.DISPLAY
display.auto_refresh = False

pal = displayio.Palette(1)
pal[0] = 0xFF0000
shape1 = vectorio.Circle(pixel_shader=pal, x=50, y=50, radius=30)

main_group = displayio.Group()
main_group.append(shape1)
main_group.append(shape1) # expected ValueError: Layer already in a group
display.root_group = main_group

print("refresh")
display.refresh()
shape1.x += 51
print("move")
display.refresh()
print("finished") # never reached

Behavior

vectorio shapes can be added to groups multiple times causing the code to freeze on refresh and not react to ctrl-C (but not crash USB).

It seems like it should raise "Layer already in a group".

@Neradoc Neradoc added the bug label Apr 6, 2025
@dhalbert dhalbert added this to the 10.0.0 milestone Apr 7, 2025
@bablokb
Copy link

bablokb commented Apr 7, 2025

I think there are valid use-cases for having an object in multiple groups. E.g. you have two groups that you alternatively hide. The object in both groups will stay visible. Think of a multiple button-bars, all with a shared OK-button.

In your example you are adding the object to the same group twice. That is a bit different and might be considered as an error.

@FoamyGuy
Copy link
Collaborator

FoamyGuy commented Apr 7, 2025

For the re-used 'Okay' button I think a Bitmap and TileGrid are more likely to be in use than a Vectorio shape. In the case of Bitmap and TileGrid you can have multiple TileGrids that share the same Bitmap, so you could make two TileGrids that re-use the same Ok button graphic Bitmap file and put them in two different Groups.

I haven't traced through all of the code to be sure, but I think that both TileGrid and Vectorio shapes have internal variables related to dirty region and refreshing that are used by logic that is written to assume that there is only a single instance of the thing, and it will be in only a single Group.

If a thing were in multiple Groups it would need to keep straight which instances of itself are dirty and need to be re-drawn on the display whereas I think right now it has only a concept of dirty or not, and not have a concept of "is this instance dirty, and is that other instance dirty independently."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/adafruit/circuitpython/issues/10226

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy