You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+15-1
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
8
8
## Unreleased
9
9
10
+
11
+
### Fixed
12
+
13
+
- Fixed `Pilot.click` not working with `times` parameter https://github.com/Textualize/textual/pull/5398
14
+
15
+
### Added
16
+
17
+
- Added `from_app_focus` to `Focus` event to indicate if a widget is being focused because the app itself has regained focus or not https://github.com/Textualize/textual/pull/5379
18
+
-- Added `Select.type_to_search` which allows you to type to move the cursor to a matching option https://github.com/Textualize/textual/pull/5403
19
+
10
20
### Changed
11
21
22
+
- The content of an `Input` will now only be automatically selected when the widget is focused by the user, not when the app itself has regained focus (similar to web browsers). https://github.com/Textualize/textual/pull/5379
23
+
- Updated `TextArea` and `Input` behavior when there is a selection and the user presses left or right https://github.com/Textualize/textual/pull/5400
12
24
- Footer can now be scrolled horizontally without holding `shift`https://github.com/Textualize/textual/pull/5404
13
25
26
+
14
27
## [1.0.0] - 2024-12-12
15
28
16
29
### Added
@@ -20,7 +33,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
20
33
- Added `system` boolean to Binding, which hides the binding from the help panel https://github.com/Textualize/textual/pull/5352
21
34
- Added support for double/triple/etc clicks via `chain` attribute on `Click` events https://github.com/Textualize/textual/pull/5369
22
35
- Added `times` parameter to `Pilot.click` method, for simulating rapid clicks https://github.com/Textualize/textual/pull/5369
23
-
36
+
- Text can now be select using mouse or keyboard in the Input widget https://github.com/Textualize/textual/pull/5340
37
+
24
38
### Changed
25
39
26
40
- Breaking change: Change default quit key to `ctrl+q`https://github.com/Textualize/textual/pull/5352
Copy file name to clipboardExpand all lines: docs/guide/queries.md
+11-2
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# DOM Queries
2
2
3
-
In the previous chapter we introduced the [DOM](../guide/CSS.md#the-dom) which is how Textual apps keep track of widgets. We saw how you can apply styles to the DOM with CSS [selectors](./CSS.md#selectors).
3
+
In the [CSS chapter](./CSS.md) we introduced the [DOM](../guide/CSS.md#the-dom) which is how Textual apps keep track of widgets. We saw how you can apply styles to the DOM with CSS [selectors](./CSS.md#selectors).
4
4
5
5
Selectors are a very useful idea and can do more than apply styles. We can also find widgets in Python code with selectors, and make updates to widgets in a simple expressive way. Let's look at how!
6
6
@@ -19,7 +19,7 @@ We could do this with the following line of code:
19
19
send_button =self.query_one("#send")
20
20
```
21
21
22
-
This will retrieve a widget with an ID of `send`, if there is exactly one.
22
+
This will retrieve the first widget discovered with an ID of `send`.
23
23
If there are no matching widgets, Textual will raise a [NoMatches][textual.css.query.NoMatches] exception.
24
24
25
25
You can also add a second parameter for the expected type, which will ensure that you get the type you are expecting.
@@ -41,6 +41,15 @@ For instance, the following would return a `Button` instance (assuming there is
41
41
my_button =self.query_one(Button)
42
42
```
43
43
44
+
`query_one` searches the DOM *below* the widget it is called on, so if you call `query_one` on a widget, it will only find widgets that are descendants of that widget.
45
+
46
+
If you wish to search the entire DOM, you should call `query_one` on the `App` or `Screen` instance.
47
+
48
+
```python
49
+
# Search the entire Screen for a widget with an ID of "send-email"
50
+
self.screen.query_one("#send-email")
51
+
```
52
+
44
53
## Making queries
45
54
46
55
Apps and widgets also have a [query][textual.dom.DOMNode.query] method which finds (or queries) widgets. This method returns a [DOMQuery][textual.css.query.DOMQuery] object which is a list-like container of widgets.
Copy file name to clipboardExpand all lines: docs/widgets/select.md
+4-2
Original file line number
Diff line number
Diff line change
@@ -88,13 +88,15 @@ The following example presents a `Select` created using the `from_values` class
88
88
89
89
## Blank state
90
90
91
-
The widget `Select` has an option `allow_blank` for its constructor.
91
+
The `Select` widget has an option `allow_blank` for its constructor.
92
92
If set to `True`, the widget may be in a state where there is no selection, in which case its value will be the special constant [`Select.BLANK`][textual.widgets.Select.BLANK].
93
93
The auxiliary methods [`Select.is_blank`][textual.widgets.Select.is_blank] and [`Select.clear`][textual.widgets.Select.clear] provide a convenient way to check if the widget is in this state and to set this state, respectively.
94
94
95
+
## Type to search
95
96
96
-
## Reactive Attributes
97
+
The `Select` widget has a `type_to_search` attribute which allows you to type to move the cursor to a matching option when the widget is expanded. To disable this behavior, set the attribute to `False`.
0 commit comments