Skip to content

Commit b2feee0

Browse files
authored
Merge branch 'main' into feat-app-add-is-web-property
2 parents 6d220b3 + 5c2111a commit b2feee0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+4054
-1949
lines changed

CHANGELOG.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,46 @@ 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+
89
## Unreleased
910

11+
### Changed
12+
13+
- Grid will now size children to the maximum height of a row https://github.com/Textualize/textual/pull/5113
14+
- Markdown links will be opened with `App.open_url` automatically https://github.com/Textualize/textual/pull/5113
15+
- The universal selector (`*`) will now not match widgets with the class `-textual-system` (scrollbars, notifications etc) https://github.com/Textualize/textual/pull/5113
16+
- Renamed `Screen.can_view` and `Widget.can_view` to `Screen.can_view_entire` and `Widget.can_view_entire` https://github.com/Textualize/textual/pull/5174
17+
18+
### Added
19+
20+
- Added Link widget https://github.com/Textualize/textual/pull/5113
21+
- Added `open_links` to `Markdown` and `MarkdownViewer` widgets https://github.com/Textualize/textual/pull/5113
22+
- Added `App.DEFAULT_MODE` https://github.com/Textualize/textual/pull/5113
23+
- Added `Containers.HorizontalGroup` and `Containers.VerticalGroup` https://github.com/Textualize/textual/pull/5113
24+
- Added `$`, `£`, ``, `(`, `)` symbols to Digits https://github.com/Textualize/textual/pull/5113
25+
- Added `Button.action` parameter to invoke action when clicked https://github.com/Textualize/textual/pull/5113
26+
- Added `immediate` parameter to scroll methods https://github.com/Textualize/textual/pull/5164
27+
- Added `textual._loop.loop_from_index` https://github.com/Textualize/textual/pull/5164
28+
- Added `min_color` and `max_color` to Sparklines constructor, which take precedence over CSS https://github.com/Textualize/textual/pull/5174
29+
- Added new demo `python -m textual`, not *quite* finished but better than the old one https://github.com/Textualize/textual/pull/5174
30+
- Added `Screen.can_view_partial` and `Widget.can_view_partial` https://github.com/Textualize/textual/pull/5174
31+
- Added `App.is_web` property to indicate if the app is running via a web browser https://github.com/Textualize/textual/pull/5128
32+
33+
### Fixed
34+
35+
- Fixed glitchy ListView https://github.com/Textualize/textual/issues/5163
36+
37+
## [0.84.0] - 2024-10-22
38+
1039
### Fixed
1140

1241
- Fixed `RadioSet` not being scrollable https://github.com/Textualize/textual/issues/5100
42+
- Fixed infinite loop in TextArea https://github.com/Textualize/textual/pull/5154
1343

1444
### Added
1545

1646
- Added `background-tint` CSS rule https://github.com/Textualize/textual/pull/5117
17-
- Added `App.is_web` property to indicate if the app is running via a web browser https://github.com/Textualize/textual/pull/5128
47+
- Added `:first-of-type`, `:last-of-type`, `:odd`, and `:even` pseudo classes https://github.com/Textualize/textual/pull/5139
1848

1949
## [0.83.0] - 2024-10-10
2050

@@ -2453,6 +2483,7 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
24532483
- New handler system for messages that doesn't require inheritance
24542484
- Improved traceback handling
24552485

2486+
[0.84.0]: https://github.com/Textualize/textual/compare/v0.83.0...v0.84.0
24562487
[0.83.0]: https://github.com/Textualize/textual/compare/v0.82.0...v0.83.0
24572488
[0.82.0]: https://github.com/Textualize/textual/compare/v0.81.0...v0.82.0
24582489
[0.81.0]: https://github.com/Textualize/textual/compare/v0.80.1...v0.81.0

docs/api/layout.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "textual.layout"
3+
---
4+
5+
6+
::: textual.layout

docs/examples/widgets/link.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from textual.app import App, ComposeResult
2+
from textual.widgets import Link
3+
4+
5+
class LabelApp(App):
6+
AUTO_FOCUS = None
7+
CSS = """
8+
Screen {
9+
align: center middle;
10+
}
11+
"""
12+
13+
def compose(self) -> ComposeResult:
14+
yield Link(
15+
"Go to textualize.io",
16+
url="https://textualize.io",
17+
tooltip="Click me",
18+
)
19+
20+
21+
if __name__ == "__main__":
22+
app = LabelApp()
23+
app.run()

docs/guide/CSS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,14 @@ Here are some other pseudo classes:
330330
- `:dark` Matches widgets in dark mode (where `App.dark == True`).
331331
- `:disabled` Matches widgets which are in a disabled state.
332332
- `:enabled` Matches widgets which are in an enabled state.
333+
- `:even` Matches a widget at an evenly numbered position within its siblings.
334+
- `:first-of-type` Matches a widget that is the first of its type amongst its siblings.
333335
- `:focus-within` Matches widgets with a focused child widget.
334336
- `:focus` Matches widgets which have input focus.
335337
- `:inline` Matches widgets when the app is running in inline mode.
338+
- `:last-of-type` Matches a widget that is the last of its type amongst its siblings.
336339
- `:light` Matches widgets in dark mode (where `App.dark == False`).
340+
- `:odd` Matches a widget at an oddly numbered position within its siblings.
337341

338342
## Combinators
339343

docs/widget_gallery.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ A simple text label.
121121
[Label reference](./widgets/label.md){ .md-button .md-button--primary }
122122

123123

124+
## Link
125+
126+
A clickable link that opens a URL.
127+
128+
[Link reference](./widgets/link.md){ .md-button .md-button--primary }
129+
130+
124131
## ListView
125132

126133
Display a list of items (items may be other widgets).

docs/widgets/link.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Link
2+
3+
!!! tip "Added in version 0.84.0"
4+
5+
A widget to display a piece of text that opens a URL when clicked, like a web browser link.
6+
7+
- [x] Focusable
8+
- [ ] Container
9+
10+
11+
## Example
12+
13+
A trivial app with a link.
14+
Clicking the link open's a web-browser—as you might expect!
15+
16+
=== "Output"
17+
18+
```{.textual path="docs/examples/widgets/link.py"}
19+
```
20+
21+
=== "link.py"
22+
23+
```python
24+
--8<-- "docs/examples/widgets/link.py"
25+
```
26+
27+
28+
## Reactive Attributes
29+
30+
| Name | Type | Default | Description |
31+
| ------ | ----- | ------- | ----------------------------------------- |
32+
| `text` | `str` | `""` | The text of the link. |
33+
| `url` | `str` | `""` | The URL to open when the link is clicked. |
34+
35+
36+
## Messages
37+
38+
This widget sends no messages.
39+
40+
## Bindings
41+
42+
The Link widget defines the following bindings:
43+
44+
::: textual.widgets.Link.BINDINGS
45+
options:
46+
show_root_heading: false
47+
show_root_toc_entry: false
48+
49+
50+
## Component classes
51+
52+
This widget contains no component classes.
53+
54+
55+
56+
---
57+
58+
59+
::: textual.widgets.Link
60+
options:
61+
heading_level: 2

docs/widgets/masked_input.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The example below shows a masked input to ease entering a credit card number.
1616
```{.textual path="docs/examples/widgets/masked_input.py"}
1717
```
1818

19-
=== "checkbox.py"
19+
=== "masked_input.py"
2020

2121
```python
2222
--8<-- "docs/examples/widgets/masked_input.py"

mkdocs-nav.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ nav:
152152
- "widgets/index.md"
153153
- "widgets/input.md"
154154
- "widgets/label.md"
155+
- "widgets/link.md"
155156
- "widgets/list_item.md"
156157
- "widgets/list_view.md"
157158
- "widgets/loading_indicator.md"
@@ -195,6 +196,7 @@ nav:
195196
- "api/filter.md"
196197
- "api/fuzzy_matcher.md"
197198
- "api/geometry.md"
199+
- "api/layout.md"
198200
- "api/lazy.md"
199201
- "api/logger.md"
200202
- "api/logging.md"

0 commit comments

Comments
 (0)