Skip to content

Commit 0638f2f

Browse files
authored
Merge pull request #4922 from Textualize/screenshot-command
screenshot, version bump
2 parents c5dea23 + 7c9a219 commit 0638f2f

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## Unreleased
9-
10-
- Disallowed `Screen` instances in `App.SCREENS` and `App.MODES`
11-
- Fixed `App.MODES` being the same for all instances -- per-instance modes now exist internally
12-
8+
## [0.77.0] - 2024-08-22
139

1410
### Added
1511

@@ -24,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2420
- Added `DOMNode.BINDING_GROUP` https://github.com/Textualize/textual/pull/4906
2521
- Added `DOMNode.HELP` classvar which contains Markdown help to be shown in the help panel https://github.com/Textualize/textual/pull/4915
2622
- Added `App.get_system_commands` https://github.com/Textualize/textual/pull/4920
23+
- Added "Save Screenshot" system command https://github.com/Textualize/textual/pull/4922
2724

2825
### Changed
2926

@@ -32,13 +29,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3229
- Changed default command palette binding to `ctrl+p` https://github.com/Textualize/textual/pull/4867
3330
- Removed `ctrl_to_caret` and `upper_case_keys` from Footer. These can be implemented in `App.get_key_display`.
3431
- Renamed `SystemCommands` to `SystemCommandsProvider` https://github.com/Textualize/textual/pull/4920
35-
- Breaking change: Removed ClassicFooter (please use new Footer widget) https://github.com/Textualize/textual/pull/4921
32+
- Breaking change: Removed `ClassicFooter` widget (please use new `Footer` widget) https://github.com/Textualize/textual/pull/4921
33+
- Disallowed `Screen` instances in `App.SCREENS` and `App.MODES`
3634

3735
### Fixed
3836

3937
- Fix crash when `validate_on` value isn't a set https://github.com/Textualize/textual/pull/4868
4038
- Fix `Input.cursor_blink` having no effect on the blink cycle after mounting https://github.com/Textualize/textual/pull/4869
4139
- Fixed scrolling by page not taking scrollbar in to account https://github.com/Textualize/textual/pull/4916
40+
- Fixed `App.MODES` being the same for all instances -- per-instance modes now exist internally
4241

4342
## [0.76.0]
4443

@@ -2310,6 +2309,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
23102309
- New handler system for messages that doesn't require inheritance
23112310
- Improved traceback handling
23122311

2312+
[0.77.0]: https://github.com/Textualize/textual/compare/v0.76.0...v0.77.0
23132313
[0.76.0]: https://github.com/Textualize/textual/compare/v0.75.1...v0.76.0
23142314
[0.75.1]: https://github.com/Textualize/textual/compare/v0.75.0...v0.75.1
23152315
[0.75.0]: https://github.com/Textualize/textual/compare/v0.74.0...v0.75.0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "textual"
3-
version = "0.76.0"
3+
version = "0.77.0"
44
homepage = "https://github.com/Textualize/textual"
55
repository = "https://github.com/Textualize/textual"
66
documentation = "https://textual.textualize.io/"

src/textual/app.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,28 @@ def get_system_commands(self) -> Iterable[SystemCommand]:
992992
self.action_show_help_panel,
993993
)
994994

995+
# Don't save screenshot for web drivers until we have the deliver_file in place
996+
if self._driver.__class__.__name__ in {"LinuxDriver", "WindowsDriver"}:
997+
998+
def export_screenshot() -> None:
999+
"""Export a screenshot and write a notification."""
1000+
filename = self.save_screenshot()
1001+
try:
1002+
self.notify(f"Saved {filename}", title="Screenshot")
1003+
except Exception as error:
1004+
self.log.error(error)
1005+
self.notify(
1006+
"Failed to save screenshot.",
1007+
title="Screenshot",
1008+
severity="warning",
1009+
)
1010+
1011+
yield SystemCommand(
1012+
"Save screenshot",
1013+
"Save an SVG 'screenshot' of the current screen (in the current working directory)",
1014+
export_screenshot,
1015+
)
1016+
9951017
def get_default_screen(self) -> Screen:
9961018
"""Get the default screen.
9971019

0 commit comments

Comments
 (0)