We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Since updating from 0.60.0 to 0.62.0, my screen namespaced action has broken despite no other changes.
screen
The method names that are being looked up are no longer correctly accounting for namespaces in some circumstances:
<action> 'app.bell' has no target. Could not find methods '_action_app.bell' or 'action_app.bell'
<action> 'screen.foo' has no target. Could not find methods '_action_screen.foo' or 'action_screen.foo'
I think the namespace is not actually being used, and methods like action_app.bell are being looked up on the current widget/screen/app.
action_app.bell
(Aside: It'd be nice if those logs told us where we're looking for the methods)
I expect the following app to ring the bell via App.action_bell, however nothing happens.
App.action_bell
from textual import __version__ from textual.app import App, ComposeResult from textual.screen import Screen from textual.widgets import Label class HomeScreen(Screen[None]): def compose(self) -> ComposeResult: yield Label(f"Textual version: {__version__}") yield Label("[@click=app.bell]Ring the bell![/]") class ScreenNamespace(App[None]): def get_default_screen(self) -> HomeScreen: return HomeScreen() if __name__ == "__main__": app = ScreenNamespace() app.run()
If I change app.bell to bell, it works, which is also surprising to me (I thought it would no longer look up the app namespace).
app.bell
bell
app
Why does the foo action defined on my App fire here, even though I'm using @click=foo and not @click=app.foo?
foo
@click=foo
@click=app.foo
from textual import __version__ from textual.app import App, ComposeResult from textual.screen import Screen from textual.widgets import Label class HomeScreen(Screen[None]): def compose(self) -> ComposeResult: yield Label(f"Textual version: {__version__}") yield Label("[@click=foo]Ring the bell![/]") # this fires the action on app?! class ScreenNamespace(App[None]): def get_default_screen(self) -> HomeScreen: return HomeScreen() def action_foo(self) -> None: self.app.panic("The action fired!") if __name__ == "__main__": app = ScreenNamespace() app.run()
If I move the action_foo into my screen, and update the markup to use @click=screen.foo, it still doesn't fire.
action_foo
@click=screen.foo
from textual import __version__ from textual.app import App, ComposeResult from textual.screen import Screen from textual.widgets import Label class HomeScreen(Screen[None]): def compose(self) -> ComposeResult: yield Label(f"Textual version: {__version__}") yield Label("[@click=screen.foo]Ring the bell![/]") def action_foo(self) -> None: self.app.panic("The action fired!") class ScreenNamespace(App[None]): def get_default_screen(self) -> HomeScreen: return HomeScreen() if __name__ == "__main__": app = ScreenNamespace() app.run()
The text was updated successfully, but these errors were encountered:
Probably cross reference #4534 too.
Sorry, something went wrong.
Also #3690 is probably relevant here too (as a longer-term issue that seems to relate to part of this).
Don't forget to star the repository!
Follow @textualizeio for Textual updates.
Successfully merging a pull request may close this issue.
Since updating from 0.60.0 to 0.62.0, my
screen
namespaced action has broken despite no other changes.The method names that are being looked up are no longer correctly accounting for namespaces in some circumstances:
I think the namespace is not actually being used, and methods like
action_app.bell
are being looked up on the current widget/screen/app.(Aside: It'd be nice if those logs told us where we're looking for the methods)
First issue
I expect the following app to ring the bell via
App.action_bell
, however nothing happens.If I change
app.bell
tobell
, it works, which is also surprising to me (I thought it would no longer look up theapp
namespace).Second issue which may be the same issue
Why does the
foo
action defined on my App fire here, even though I'm using@click=foo
and not@click=app.foo
?If I move the
action_foo
into my screen, and update the markup to use@click=screen.foo
, it still doesn't fire.The text was updated successfully, but these errors were encountered: