From b88da06174e582a0a433bdda5fc683a7fa626cfe Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Mon, 17 Oct 2022 15:13:08 +0100 Subject: [PATCH] fix focus glitch --- docs/getting_started.md | 4 ++-- pyproject.toml | 2 +- src/textual/widget.py | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index ba947e440..f9446456a 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -25,13 +25,13 @@ You can install Textual via PyPI. If you plan on developing Textual apps, then you should install `textual[dev]`. The `[dev]` part installs a few extra dependencies for development. ``` -pip install "textual[dev]==0.2.0b6" +pip install "textual[dev]==0.2.0b7" ``` If you only plan on _running_ Textual apps, then you can drop the `[dev]` part: ``` -pip install textual==0.2.0b6 +pip install textual==0.2.0b7 ``` !!! important diff --git a/pyproject.toml b/pyproject.toml index 05a734f90..378015988 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "textual" -version = "0.2.0b6" +version = "0.2.0b7" homepage = "https://github.com/Textualize/textual" description = "Modern Text User Interface framework" authors = ["Will McGugan "] diff --git a/src/textual/widget.py b/src/textual/widget.py index 605157668..dab9e06d1 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -1850,7 +1850,10 @@ class Widget(DOMNode): def set_focus(widget: Widget): """Callback to set the focus.""" - widget.screen.set_focus(self, scroll_visible=scroll_visible) + try: + widget.screen.set_focus(self, scroll_visible=scroll_visible) + except NoScreen: + pass self.app.call_later(set_focus, self)