From 787ca79ed77409256fd1b7d62d4ab61cd35f71d9 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Thu, 22 Aug 2024 14:46:29 +0100 Subject: [PATCH 1/4] screenshot, version bump --- CHANGELOG.md | 10 +++++----- pyproject.toml | 2 +- src/textual/app.py | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2331695455..4c7afcadb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,7 @@ 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 - -- Disallowed `Screen` instances in `App.SCREENS` and `App.MODES` -- Fixed `App.MODES` being the same for all instances -- per-instance modes now exist internally - +## [0.77.0] - 2024-08-22 ### Added @@ -24,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Added `DOMNode.BINDING_GROUP` https://github.com/Textualize/textual/pull/4906 - Added `DOMNode.HELP` classvar which contains Markdown help to be shown in the help panel https://github.com/Textualize/textual/pull/4915 - Added `App.get_system_commands` https://github.com/Textualize/textual/pull/4920 +- Added "Save Screenshot" system command. ### Changed @@ -33,12 +30,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Removed `ctrl_to_caret` and `upper_case_keys` from Footer. These can be implemented in `App.get_key_display`. - Renamed `SystemCommands` to `SystemCommandsProvider` https://github.com/Textualize/textual/pull/4920 - Breaking change: Removed ClassicFooter (please use new Footer widget) https://github.com/Textualize/textual/pull/4921 +- Disallowed `Screen` instances in `App.SCREENS` and `App.MODES` ### Fixed - Fix crash when `validate_on` value isn't a set https://github.com/Textualize/textual/pull/4868 - Fix `Input.cursor_blink` having no effect on the blink cycle after mounting https://github.com/Textualize/textual/pull/4869 - Fixed scrolling by page not taking scrollbar in to account https://github.com/Textualize/textual/pull/4916 +- Fixed `App.MODES` being the same for all instances -- per-instance modes now exist internally ## [0.76.0] @@ -2310,6 +2309,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040 - New handler system for messages that doesn't require inheritance - Improved traceback handling +[0.77.0]: https://github.com/Textualize/textual/compare/v0.76.0...v0.77.0 [0.76.0]: https://github.com/Textualize/textual/compare/v0.75.1...v0.76.0 [0.75.1]: https://github.com/Textualize/textual/compare/v0.75.0...v0.75.1 [0.75.0]: https://github.com/Textualize/textual/compare/v0.74.0...v0.75.0 diff --git a/pyproject.toml b/pyproject.toml index b63bcf0715..b0108d8379 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "textual" -version = "0.76.0" +version = "0.77.0" homepage = "https://github.com/Textualize/textual" repository = "https://github.com/Textualize/textual" documentation = "https://textual.textualize.io/" diff --git a/src/textual/app.py b/src/textual/app.py index 775280b152..40569a01e1 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -992,6 +992,28 @@ def get_system_commands(self) -> Iterable[SystemCommand]: self.action_show_help_panel, ) + # Don't save screenshot until we have the deliver_file in place + if self._driver.__class__.__name__ in {"LinuxDriver", "WindowsDriver"}: + + def export_screenshot() -> None: + """Export a screenshot and write a notification.""" + filename = self.save_screenshot() + try: + self.notify(f"Saved {filename}", title="Screenshot") + except Exception as error: + self.log.error(error) + self.notify( + "Failed to save screenshot.", + title="Screenshot", + severity="warning", + ) + + yield SystemCommand( + "Save screenshot", + "Save an SVG 'screenshot' of the current screen (in the current working directory)", + export_screenshot, + ) + def get_default_screen(self) -> Screen: """Get the default screen. From 28aef7218cb0d6dfb869de06a34612cc1fcfafdd Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Thu, 22 Aug 2024 14:47:07 +0100 Subject: [PATCH 2/4] comment --- src/textual/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/textual/app.py b/src/textual/app.py index 40569a01e1..ccf6ce93fe 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -992,7 +992,7 @@ def get_system_commands(self) -> Iterable[SystemCommand]: self.action_show_help_panel, ) - # Don't save screenshot until we have the deliver_file in place + # Don't save screenshot for web drivers until we have the deliver_file in place if self._driver.__class__.__name__ in {"LinuxDriver", "WindowsDriver"}: def export_screenshot() -> None: From 1d3115905a190a3212d35bf77bf0eb517bc2085c Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Thu, 22 Aug 2024 14:50:52 +0100 Subject: [PATCH 3/4] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c7afcadb9..405bd7a692 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Added `DOMNode.BINDING_GROUP` https://github.com/Textualize/textual/pull/4906 - Added `DOMNode.HELP` classvar which contains Markdown help to be shown in the help panel https://github.com/Textualize/textual/pull/4915 - Added `App.get_system_commands` https://github.com/Textualize/textual/pull/4920 -- Added "Save Screenshot" system command. +- Added "Save Screenshot" system command https://github.com/Textualize/textual/pull/4922 ### Changed From 7c9a2197635d09103d0ad11b2056c9e0009f9014 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Thu, 22 Aug 2024 14:51:17 +0100 Subject: [PATCH 4/4] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 405bd7a692..46d7e5489f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Changed default command palette binding to `ctrl+p` https://github.com/Textualize/textual/pull/4867 - Removed `ctrl_to_caret` and `upper_case_keys` from Footer. These can be implemented in `App.get_key_display`. - Renamed `SystemCommands` to `SystemCommandsProvider` https://github.com/Textualize/textual/pull/4920 -- Breaking change: Removed ClassicFooter (please use new Footer widget) https://github.com/Textualize/textual/pull/4921 +- Breaking change: Removed `ClassicFooter` widget (please use new `Footer` widget) https://github.com/Textualize/textual/pull/4921 - Disallowed `Screen` instances in `App.SCREENS` and `App.MODES` ### Fixed