Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screenshot, version bump #4922

Merged
merged 4 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 https://github.com/Textualize/textual/pull/4922

### Changed

Expand All @@ -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]

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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/"
Expand Down
22 changes: 22 additions & 0 deletions src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,28 @@ def get_system_commands(self) -> Iterable[SystemCommand]:
self.action_show_help_panel,
)

# 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:
"""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.

Expand Down
Loading