Skip to content

Commit 00bcd82

Browse files
authored
Merge pull request #1142 from Textualize/blog-release-0-4-0
blog post
2 parents 249b0d3 + 8badadb commit 00bcd82

File tree

10 files changed

+82
-8
lines changed

10 files changed

+82
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +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-
## [0.4.0] - Unreleased
8+
## [0.4.0] - 2022-11-08
99

1010
### Changed
1111

docs/blog/images/faster-updates.excalidraw.svg

Lines changed: 16 additions & 0 deletions
Loading

docs/blog/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
# Textual Blog
22

3-
Welcome to the Textual blog, where we post about the latest releases and developments in the Textual world.

docs/blog/posts/release0-4-0.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
draft: true
3+
date: 2022-11-08
4+
categories:
5+
- Release
6+
authors:
7+
- willmcgugan
8+
---
9+
10+
# Version 0.4.0
11+
12+
We've released version 0.4.0 of [Textual](https://pypi.org/search/?q=textual).
13+
14+
As this is the first post tagged with `release` let me first explain where the blog fits in with releases. We plan on doing a post for every note-worthy release. Which likely means all but the most trivial updates (typos just aren't that interesting). Blog posts will be supplementary to release notes which you will find on the [Textual repository](https://github.com/Textualize/textual).
15+
16+
Blog posts will give a little more background for the highlights in a release, and a rationale for changes and new additions. We embrace *building in public*, which means that we would like you to be as up-to-date with new developments as if you were sitting in our office. It's a small office, and you might not be a fan of the Scottish weather (it's [dreich](https://www.bbc.co.uk/news/uk-scotland-50476008)), but you can be here virtually.
17+
18+
<!-- more -->
19+
20+
Release 0.4.0 follows 0.3.0, released on October 31st. Here are the highlights of the update.
21+
22+
## Updated Mount Method
23+
24+
The [mount](/api/widget/#textual.widget.Widget.mount) method has seen some work. We've dropped the ability to assign an `id` via keyword attributes, which wasn't terribly useful. Now, an `id` must be assigned via the constructor.
25+
26+
The mount method has also grown `before` and `after` parameters which tell Textual where to add a new Widget (the default was to add it to the end). Here are a few examples:
27+
28+
```python
29+
30+
# Mount at the start
31+
self.mount(Button(id="Buy Coffee"), before=0)
32+
33+
# Mount after a selector
34+
self.mount(Static("Password is incorrect"), after="Dialog Input.-error")
35+
36+
tweet = self.query_one("Tweet")
37+
self.mount(Static("Consider switching to Mastodon"), after=tweet)
38+
39+
```
40+
41+
Textual needs much of the same kind of operations as the [JS API](https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild) exposed by the browser. But we are determined to make this way more intuitive. The new mount method is a step towards that.
42+
43+
## Faster Updates
44+
45+
Textual now writes to stdout in a thread. The upshot of this is that Textual can work on the next update before the terminal has displayed the previous frame.
46+
47+
This means smoother updates all round! You may notice this when scrolling and animating, but even if you don't you will have more CPU cycles to play with.
48+
49+
<div class="excalidraw">
50+
--8<-- "docs/blog/images/faster-updates.excalidraw.svg"
51+
</div>
52+
53+
54+
## Multiple CSS Paths
55+
56+
Up to version 0.3.0, Textual would only read a single CSS file set in the `CSS_PATH` class variable. You can now supply a list of paths if you have more than one CSS file.
57+
58+
This change was prompted by [tuilwindcss](https://github.com/koaning/tuilwindcss/) which brings a TailwindCSS like approach to building Textual Widgets. Also checkout [calmcode.io](https://calmcode.io/) by the same author, which is an amazing resource.

docs/custom_theme/main.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<meta property="og:url" content="{{ page.canonical_url | url }}">
1616
<meta property="og:site_name" content="Textual Documentation">
1717
<meta property="og:description" content="Textual is a TUI framework for Python, inspired by modern web development.">
18-
1918
<meta property="og:image" content="https://raw.githubusercontent.com/Textualize/textual/main/imgs/textual.png">
2019

2120
{% endblock %}

docs/stylesheets/custom.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ h3 .doc-heading code {
1313
monospace;
1414
}
1515

16-
body[data-md-color-primary="indigo"] .excalidraw svg {
16+
body[data-md-color-primary="black"] .excalidraw svg {
1717
filter: invert(100%) hue-rotate(180deg);
1818
}
1919

20-
body[data-md-color-primary="indigo"] .excalidraw svg rect {
20+
body[data-md-color-primary="black"] .excalidraw svg rect {
2121
fill: transparent;
2222
}
2323

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ theme:
175175
name: Switch to dark mode
176176
- media: "(prefers-color-scheme: dark)"
177177
scheme: slate
178-
primary: indigo
178+
primary: black
179179
toggle:
180180
icon: material/weather-night
181181
name: Switch to light mode
@@ -189,6 +189,7 @@ plugins:
189189
as_creation: date
190190
categories:
191191
- categories
192+
- release
192193
- tags
193194
- search:
194195
- autorefs:

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.4.0a3"
3+
version = "0.4.0"
44
homepage = "https://github.com/Textualize/textual"
55
description = "Modern Text User Interface framework"
66
authors = ["Will McGugan <[email protected]>"]

src/textual/pilot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async def press(self, *keys: str) -> None:
3232
"""Simulate key-presses.
3333
3434
Args:
35-
*key: Keys to press.
35+
*keys: Keys to press.
3636
3737
"""
3838
if keys:

src/textual/reactive.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def init(
6868
layout (bool, optional): Perform a layout on change. Defaults to False.
6969
repaint (bool, optional): Perform a repaint on change. Defaults to True.
7070
always_update(bool, optional): Call watchers even when the new value equals the old value. Defaults to False.
71+
7172
Returns:
7273
Reactive: A Reactive instance which calls watchers or initialize.
7374
"""

0 commit comments

Comments
 (0)