From b40387d667898582eff99fc6f0ed630534d1267a Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Mon, 24 Jun 2024 16:01:05 +0100 Subject: [PATCH] polish --- CHANGELOG.md | 8 ++++++++ src/textual/app.py | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05e08c0fd0..ebc4f1eca5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## Unreleased + +### Changed + +- Breaking change: `App.push_screen` now returns an Awaitable rather than a screen. https://github.com/Textualize/textual/pull/4672 +- Breaking change: `Screen.dismiss` now returns an Awaitable rather than a bool. https://github.com/Textualize/textual/pull/4672 + + ## [0.70.0] - 2024-06-19 ### Fixed diff --git a/src/textual/app.py b/src/textual/app.py index d5a41943b7..01b66ab8a8 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -1938,7 +1938,8 @@ def remove_mode(self, mode: str) -> AwaitComplete: stack = self._screen_stacks[mode] del self._screen_stacks[mode] - async def remove_screens(): + async def remove_screens() -> None: + """Remove screens.""" for screen in reversed(stack): await self._replace_screen(screen) @@ -2173,6 +2174,7 @@ def switch_screen(self, screen: Screen | str) -> AwaitComplete: ) async def do_switch() -> None: + """Task to perform switch.""" next_screen, await_mount = self._get_screen(screen) if screen is self.screen or next_screen is self.screen: self.log.system(f"Screen {screen} is already current.") @@ -2264,6 +2266,7 @@ def pop_screen(self) -> AwaitComplete: ) async def do_pop() -> None: + """Task to pop the screen.""" previous_screen = await self._replace_screen(screen_stack.pop()) previous_screen._pop_result_callback() self.screen.post_message(events.ScreenResume()) @@ -2370,7 +2373,6 @@ def _handle_exception(self, error: Exception) -> None: Args: error: An exception instance. """ - self.log.error(error) self._return_code = 1 # If we're running via pilot and this is the first exception encountered, # take note of it so that we can re-raise for test frameworks later.