-
-
Notifications
You must be signed in to change notification settings - Fork 993
Closed
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
Technically this isn't an issue with the command palette, it would be an issue with any screen with a background process that causes a query to be handled by the app, but via the command palette is the way that a dev would most likely encounter it and it's where they'd find it most surprising.
Consider this code:
from textual.app import App, ComposeResult
from textual.widgets import Log
class CommandPaletteIsolation(App[None]):
def compose(self) -> ComposeResult:
yield Log()
def tick(self) -> None:
self.query_one(Log).write_line("Tick")
def on_mount(self) -> None:
self.set_interval(1, self.tick)
if __name__ == "__main__":
CommandPaletteIsolation().run()
Let it run for a moment, then summon the command palette and keep it up. The next time tick
runs a NoMatches
will result.
This version, where the default screen isn't being used, isn't a problem:
from textual.app import App, ComposeResult
from textual.screen import Screen
from textual.widgets import Log
class MyScreen(Screen):
def compose(self) -> ComposeResult:
yield Log()
def tick(self) -> None:
self.query_one(Log).write_line("Tick")
def on_mount(self) -> None:
self.set_interval(1, self.tick)
class CommandPaletteIsolation(App[None]):
def on_mount(self) -> None:
self.push_screen(MyScreen())
if __name__ == "__main__":
CommandPaletteIsolation().run()
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request