diff --git a/CHANGELOG.md b/CHANGELOG.md index c1d5929535..abec9fa6d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,13 @@ 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 +## [0.30.0] - 2023-07-17 ### Added - Added `DataTable.remove_column` method https://github.com/Textualize/textual/pull/2899 - Added notifications https://github.com/Textualize/textual/pull/2866 +- Added `on_complete` callback to scroll methods https://github.com/Textualize/textual/pull/2903 ### Fixed @@ -1117,6 +1118,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.30.0]: https://github.com/Textualize/textual/compare/v0.29.0...v0.30.0 [0.29.0]: https://github.com/Textualize/textual/compare/v0.28.1...v0.29.0 [0.28.1]: https://github.com/Textualize/textual/compare/v0.28.0...v0.28.1 [0.28.0]: https://github.com/Textualize/textual/compare/v0.27.0...v0.28.0 diff --git a/docs/blog/posts/release0-30-0.md b/docs/blog/posts/release0-30-0.md new file mode 100644 index 0000000000..0e0be12f73 --- /dev/null +++ b/docs/blog/posts/release0-30-0.md @@ -0,0 +1,80 @@ +--- +draft: false +date: 2023-07-17 +categories: + - Release +title: "Textual 0.30.0 adds desktop-style notifications" +authors: + - willmcgugan +--- + +# Textual 0.30.0 adds desktop-style notifications + +We have a new release of Textual to talk about, but before that I'd like to cover a little Textual news. + + + +By sheer coincidence we reached [20,000 stars on GitHub](https://github.com/Textualize/textual) today. +Now stars don't mean all that much (at least until we can spend them on coffee), but its nice to know that twenty thousand developers thought Textual was interesting enough to hit the ★ button. +Thank you! + +In other news: we moved office. +We are now a stone's throw away from Edinburgh Castle. +The office is around three times as big as the old place, which means we have room for wide standup desks and dual monitors. +But more importantly we have room for new employees. +Don't send your CVs just yet, but we hope to grow the team before the end of the year. + +Exciting times. + +## New Release + +And now, for the main feature. +Version 0.30 adds a new notification system. +Similar to desktop notifications, it displays a small window with a title and message (called a *toast*) for a pre-defined number of seconds. + +Notifications are great for short timely messages to add supplementary information for the user. +Here it is in action: + +
+ +
+ +The API is super simple. +To display a notification, call `notify()` with a message and an optional title. + +```python +def on_mount(self) -> None: + self.notify("Hello, from Textual!", title="Welcome") +``` + +## Textualize Video Channel + +In case you missed it; Textualize now has a [YouTube](https://www.youtube.com/channel/UCo4nHAZv_cIlAiCSP2IyiOA) channel. +Our very own [Rodrigo](https://twitter.com/mathsppblog) has recorded a video tutorial series on how to build Textual apps. +Check it out! + +
+ +
+ +We will be adding more videos in the near future, covering anything from beginner to advanced topics. + +Don't worry if you prefer reading to watching videos. +We will be adding plenty more content to the [Textual docs](https://textual.textualize.io/) in the near future. +Watch this space. + +As always, if you want to discuss anything with the Textual developers, join us on the [Discord server](https://discord.gg/Enf6Z3qhVr). diff --git a/pyproject.toml b/pyproject.toml index 6ebfc2cd3e..b3200a34d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "textual" -version = "0.29.0" +version = "0.30.0" homepage = "https://github.com/Textualize/textual" description = "Modern Text User Interface framework" authors = ["Will McGugan "] diff --git a/src/textual/widgets/_toast.py b/src/textual/widgets/_toast.py index 200598cd21..388ec8a6b2 100644 --- a/src/textual/widgets/_toast.py +++ b/src/textual/widgets/_toast.py @@ -40,7 +40,7 @@ class Toast(Static, inherit_css=False): height: auto; visibility: visible; margin-top: 1; - padding: 1 2; + padding: 1 1; background: $panel; tint: white 5%; } @@ -49,8 +49,12 @@ class Toast(Static, inherit_css=False): text-style: bold; } + Toast { + border-right: wide $background; + } + Toast.-information { - border-left: tall $success; + border-left: wide $success; } Toast.-information .toast--title { @@ -58,7 +62,7 @@ class Toast(Static, inherit_css=False): } Toast.-warning { - border-left: tall $warning; + border-left: wide $warning; } Toast.-warning .toast--title { @@ -66,7 +70,7 @@ class Toast(Static, inherit_css=False): } Toast.-error { - border-left: tall $error; + border-left: wide $error; } Toast.-error .toast--title { @@ -139,6 +143,7 @@ class ToastRack(Container, inherit_css=False): layout: vertical; overflow-y: scroll; margin-bottom: 1; + margin-right: 1; } """ diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr index 99113705b5..3dc7e52277 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr +++ b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr @@ -18870,136 +18870,139 @@ font-weight: 700; } - .terminal-2633357467-matrix { + .terminal-3970684023-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2633357467-title { + .terminal-3970684023-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2633357467-r1 { fill: #e1e1e1 } - .terminal-2633357467-r2 { fill: #c5c8c6 } - .terminal-2633357467-r3 { fill: #292929 } - .terminal-2633357467-r4 { fill: #e3e4e4 } - .terminal-2633357467-r5 { fill: #e89719;font-weight: bold } - .terminal-2633357467-r6 { fill: #e3e4e4;font-weight: bold } - .terminal-2633357467-r7 { fill: #e3e4e4;font-weight: bold;font-style: italic; } + .terminal-3970684023-r1 { fill: #e1e1e1 } + .terminal-3970684023-r2 { fill: #c5c8c6 } + .terminal-3970684023-r3 { fill: #56c278 } + .terminal-3970684023-r4 { fill: #2e3339 } + .terminal-3970684023-r5 { fill: #e3e4e4 } + .terminal-3970684023-r6 { fill: #feaa35 } + .terminal-3970684023-r7 { fill: #e89719;font-weight: bold } + .terminal-3970684023-r8 { fill: #e3e4e4;font-weight: bold } + .terminal-3970684023-r9 { fill: #e3e4e4;font-weight: bold;font-style: italic; } + .terminal-3970684023-r10 { fill: #bc4563 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - ToastApp + ToastApp - - - - - - - - It's an older code, sir, but it  - checks out. - - - - Possible trap detected - Now witness the firepower of  - this fully ARMED and OPERATIONAL - battle station! - - - - It's a trap! - - - - It's against my programming to  - impersonate a deity. - + + + + + + + + It's an older code, sir, but it  + checks out. + + + + Possible trap detected + Now witness the firepower of this + fully ARMED and OPERATIONAL + battle station! + + + + It's a trap! + + + + It's against my programming to  + impersonate a deity. + @@ -19030,133 +19033,134 @@ font-weight: 700; } - .terminal-2802608981-matrix { + .terminal-2782348326-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2802608981-title { + .terminal-2782348326-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2802608981-r1 { fill: #e1e1e1 } - .terminal-2802608981-r2 { fill: #292929 } - .terminal-2802608981-r3 { fill: #c5c8c6 } - .terminal-2802608981-r4 { fill: #e3e4e4 } + .terminal-2782348326-r1 { fill: #e1e1e1 } + .terminal-2782348326-r2 { fill: #56c278 } + .terminal-2782348326-r3 { fill: #c5c8c6 } + .terminal-2782348326-r4 { fill: #2e3339 } + .terminal-2782348326-r5 { fill: #e3e4e4 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - NotifyThroughModesApp + NotifyThroughModesApp - - - - This is a mode screen - 4 - - - - 5 - - - - 6 - - - - 7 - - - - 8 - - - - 9 - + + + + This is a mode screen + 4 + + + + 5 + + + + 6 + + + + 7 + + + + 8 + + + + 9 + @@ -19187,133 +19191,134 @@ font-weight: 700; } - .terminal-2760992718-matrix { + .terminal-180633759-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2760992718-title { + .terminal-180633759-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2760992718-r1 { fill: #e1e1e1 } - .terminal-2760992718-r2 { fill: #292929 } - .terminal-2760992718-r3 { fill: #c5c8c6 } - .terminal-2760992718-r4 { fill: #e3e4e4 } + .terminal-180633759-r1 { fill: #e1e1e1 } + .terminal-180633759-r2 { fill: #56c278 } + .terminal-180633759-r3 { fill: #c5c8c6 } + .terminal-180633759-r4 { fill: #2e3339 } + .terminal-180633759-r5 { fill: #e3e4e4 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - NotifyDownScreensApp + NotifyDownScreensApp - - - - Screen 10 - 4 - - - - 5 - - - - 6 - - - - 7 - - - - 8 - - - - 9 - + + + + Screen 10 + 4 + + + + 5 + + + + 6 + + + + 7 + + + + 8 + + + + 9 +