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

Trying to remove Footer results in "node has no screen" #4711

Closed
ajantti opened this issue Jul 9, 2024 · 3 comments
Closed

Trying to remove Footer results in "node has no screen" #4711

ajantti opened this issue Jul 9, 2024 · 3 comments

Comments

@ajantti
Copy link

ajantti commented Jul 9, 2024

I was playing around with changing binding descriptions like mentioned #1057. (In this case to switch languages.)

I ran into another issue where trying to remove the footer in any way (including self.recompose()) results in "node has no screen" error.

from textual.app import App
from textual import on
from textual.widgets import Footer, Button

class TestApp(App):
    def compose(self):
        yield Button()
        yield Footer()

    @on(Button.Pressed)
    def button_pressed(self):
        self.query_one(Footer).remove()

app = TestApp()
app.run()

Clicking the button gives:

╭─────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────
│ C:\Users\jantti\AppData\Local\Programs\Python\Python310\lib\site-packages\textual\widgets\_footer.py:176 in on_unmount
│
│   173 │   │   self.screen.bindings_updated_signal.subscribe(self, bindings_changed)            ╭──── locals ─────╮
│   174 │                                                                                        │ self = Footer() │
│   175def on_unmount(self) -> None:                                                        ╰─────────────────╯
│ ❱ 176 │   │   self.screen.bindings_updated_signal.unsubscribe(self)
│   177 │
│   178def watch_compact(self, compact: bool) -> None:
│   179 │   │   self.set_class(compact, "-compact")
│
│ C:\Users\jantti\AppData\Local\Programs\Python\Python310\lib\site-packages\textual\dom.py:680 in screen
│
│    677 │   │   while node is not None and not isinstance(node, Screen):                         ╭───────────────── locals ─────────────────╮
│    678 │   │   │   node = node._parentnode = None                            │
│    679 │   │   if not isinstance(node, Screen):                                                 │ Screen = <class 'textual.screen.Screen'> │
│ ❱  680 │   │   │   raise NoScreen("node has no screen")                                         │   self = Footer()                        │
│    681 │   │   return node                                                                      ╰──────────────────────────────────────────╯
│    682 │
│    683 │   @property
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
NoScreen: node has no screen

I tried with the current git main branch.

Textual Diagnostics

Versions

Name Value
Textual 0.71.0
Rich 13.7.1

Python

Name Value
Version 3.10.11
Implementation CPython
Compiler MSC v.1929 64 bit (AMD64)
Executable C:\Users\jantti\AppData\Local\Programs\Python\Python310\python.exe

Operating System

Name Value
System Windows
Release 10
Version 10.0.19045

Terminal

Name Value
Terminal Application Unknown
TERM Not set
COLORTERM Not set
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=119, height=30
legacy_windows True
min_width 1
max_width 119
is_terminal True
encoding utf-8
max_height 30
justify None
overflow None
no_wrap False
highlight None
markup None
height None
Copy link

github-actions bot commented Jul 9, 2024

We found the following entries in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

Thanks. Fixed in 0.72.0

Copy link

github-actions bot commented Jul 9, 2024

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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