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

[BUG] ValueError in Dooit: SCREENS Contains Instance Instead of Callable Screen Type #198

Closed
zx0r opened this issue Nov 5, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@zx0r
Copy link

zx0r commented Nov 5, 2024

Hi bro)

Describe the bug 🐛
Dooit Initialization Error: SCREENS Configuration Incorrectly Uses Instance

Desktop Environment 👽
 - OS: Gentoo Base System release 2.16
 - Linux unixp0rn 6.11.5-gentoo-x86_64
 - XDG_SESSION_TYPE: wayland
 - Window Manager: Hyprland
 
# sudo -e /usr/lib/python3.12/site-packages/dooit/ui/tui.py
# error 🚫
 ------------------------------------------------------------------------------
# class Dooit(App):
#     CSS = screen_CSS
#     SCREENS = {
#         "main": MainScreen(name="main"),
#         "help": HelpScreen(name="help"),
#     }
# fix ✅
 ------------------------------------------------------------------------------
class Dooit(App):
    CSS = screen_CSS
    # Reference the screen classes without instantiating them
    SCREENS = {
        "main": MainScreen,  # Use the class directly
        "help": HelpScreen,  # Use the class directly
    }

Additional context 📝
The error traceback indicated that the issue was caused by incorrectly instantiating the screens within the SCREENS dictionary. To fix this, the SCREENS declaration was modified to only include the class references without instantiation:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.12/dooit", line 5, in <module>
    from dooit.__main__ import main
  File "/usr/lib/python3.12/site-packages/dooit/__main__.py", line 3, in <module>
    from dooit.ui.tui import Dooit
  File "/usr/lib/python3.12/site-packages/dooit/ui/tui.py", line 17, in <module>
    class Dooit(App):
  File "/usr/lib/python3.12/site-packages/textual/message_pump.py", line 109, in __new__
    class_obj = super().__new__(cls, name, bases, class_dict, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/textual/app.py", line 790, in __init_subclass__
    raise ValueError(
ValueError: SCREENS should contain a Screen type or callable, not an instance (got instance of MainScreen for 'main')

Screenshots 📺

captura-2024-11-05-1730815042
captura-2024-11-05-1730816716
captura-2024-11-05-1730815148

@zx0r zx0r added the bug Something isn't working label Nov 5, 2024
@kraanzu
Copy link
Member

kraanzu commented Nov 5, 2024

Hi @zx0r , Yes The current version uses a very old release of Textual, the underlying TUI library hence the issue. How are you installing dooit? The version needs to be pinned if you're using distro-specific package manager. No idea about gentoo sorry, I guess it was emerge ? Can you share some details?

Plus, I'll make a new release tomm so things should sort out when the package is updated:)

@zx0r
Copy link
Author

zx0r commented Nov 5, 2024

Portage package manager priority)

captura-2024-11-05-1730831026

@kraanzu
Copy link
Member

kraanzu commented Nov 10, 2024

Hi again @zx0r ! Sorry totally forgot about this, I've released a newer version, are you familiar with gentoo packaging?

@kraanzu
Copy link
Member

kraanzu commented Nov 13, 2024

Hey @zx0r , that was a question. I've got 0 idea about gentoo packaging.

Is this the place where you got the package from? https://gpo.zugaina.org/app-text/dooit/RDep

@zx0r
Copy link
Author

zx0r commented Nov 14, 2024

Hi bro)

Project:GURU
The goal of the GURU project is to create an official repository of new Gentoo packages that are maintained collaboratively by Gentoo users. It follows the tradition of Sunrise project but aims to improve its maintainability by reducing the involvement of Gentoo developers and letting experienced contributors take care of reviewing work of others.

https://github.com/gentoo-mirror/guru/tree/master/app-text/dooit

Screenshots 📺
captura-2024-11-14-1731595761

@kraanzu
Copy link
Member

kraanzu commented Nov 14, 2024

Hi @henri-gasc!

Look like you made the contribution to GURU for dooit. Can you update to the latest version? I can help if required :)

@henri-gasc
Copy link

No need for help, I will update it soon. I did not see there was an update

@kraanzu
Copy link
Member

kraanzu commented Nov 14, 2024

Thank you!

Heads up: I'll also release a new version in a few hours with a patch bump.

@henri-gasc
Copy link

I pushed the update, you can close this issue

@kraanzu
Copy link
Member

kraanzu commented Nov 17, 2024

@zx0r, please double check from your side and feel free to open any other issues if you have :)

@kraanzu kraanzu closed this as completed Nov 17, 2024
Copy link

Did we solve your problem?
Glad we could help!

Consider sponsoring my work through github sponsors 😄
@kraanzu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants