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

arcade.gui UIManager (ui_manager.py) clear methods does not remove all widgets from the UImanager #2374

Open
cbfbl opened this issue Sep 26, 2024 · 3 comments

Comments

@cbfbl
Copy link

cbfbl commented Sep 26, 2024

Bug Report

arcade.gui UIManager clear does not remove all ui widgets

System Info

Arcade 2.6.17

vendor: AMD
renderer: AMD Custom GPU 0405 (radeonsi, vangogh, LLVM 17.0.6, DRM 3.54, 6.1.52-valve16-1-neptune-61)
version: (4, 6)
python: 3.11.10 (main, Nov 10 2011, 15:00:00) [GCC 13.2.0]
platform: linux

Actual behavior:

I have 2 widgets added by the add method of UImanager when I call the clear method only one of the widgets is removed

Expected behavior:

All widgets should be removed from the UImanager

Steps to reproduce/example code:

self.gui_manager = gui.UIManager()
self.gui_manager.add(widget1)
self.gui_manager.add(widget2)
self.gui_manager.clear()
#############################
the result:
len(self.gui_manager.children().values()) == 1

Enhancement request:

What should be added/changed?

Documentation request:

What documentation needs to change?

Where is it located?

What is wrong with it? How can it be improved?

@pushfoo
Copy link
Member

pushfoo commented Sep 26, 2024

Hi, would you by any chance be able to help investigate what would be needed to fix this?

To my understanding, you may be better off switching to 3.0.0 previews for the moment:

  1. Most attention is on the 3.0.0 branch (development):
  2. We've mulled a final EOL release of the 2.6.X line to add warnings + links to the 3.0.0 and dev preview doc

@cbfbl
Copy link
Author

cbfbl commented Sep 26, 2024

The fix can be easily done by copying the list of the children, no idea how terrible it is for the performance.

Original code:

def clear(self):
"""
Remove all widgets from UIManager
"""
    for layer in self.children.values():
        for widget in layer:
            self.remove(widget)

Possible fix:

def clear(self):
"""
Remove all widgets from UIManager
"""
    for layer in self.children.values():
        layer = layer[:]
        for widget in layer:
            self.remove(widget)

I did not know 2.6 is EOL, thanks for notifying me, will try to upgrade to 3.0.0 preview.

@pushfoo
Copy link
Member

pushfoo commented Sep 26, 2024

I did not know 2.6 is EOL, thanks for notifying me, will try to upgrade to 3.0.0 preview.

That's understandable. It's why we're considering a final 2.6.18 release.

will try to upgrade to 3.0.0 preview.

The biggest changes are in GUI, a totally reworked camera system, and the shape drawing commands. Note that the dev previews use pyglet 2.1's dev previews, which means there will be pyglet changes as well. For Arcade, rendering changes also mean you have far more freedom to use the latest pyglet features.

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

No branches or pull requests

2 participants