Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Jun 17, 2024
2 parents 2408053 + 0d78a58 commit a566558
Show file tree
Hide file tree
Showing 22 changed files with 420 additions and 228 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Recompose will now keep widgets with matching IDs (with the same parent)
- Added `state` to Reactive

### Fixed

- Fixed erroneous mouse 'ButtonDown' reporting for mouse movement when any-event mode is enabled in xterm. https://github.com/Textualize/textual/pull/3647

## [0.69.0] - 2024-06-16

### Added

- Added `App.simulate_key` https://github.com/Textualize/textual/pull/4657

### Fixed

- Fixed issue with pop_screen launched from an action https://github.com/Textualize/textual/pull/4657

### Changed

- `App.check_bindings` is now private
- `App.action_check_bindings` is now `App.action_simulate_key`

## [0.68.0] - 2024-06-14

Expand Down Expand Up @@ -571,6 +590,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed display of keys when used in conjunction with other keys https://github.com/Textualize/textual/pull/3050
- Fixed double detection of <kbd>Escape</kbd> on Windows https://github.com/Textualize/textual/issues/4038


## [0.47.1] - 2024-01-05

### Fixed
Expand Down Expand Up @@ -2139,6 +2159,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.69.0]: https://github.com/Textualize/textual/compare/v0.68.0...v0.69.0
[0.68.0]: https://github.com/Textualize/textual/compare/v0.67.1...v0.68.0
[0.67.1]: https://github.com/Textualize/textual/compare/v0.67.0...v0.67.1
[0.67.0]: https://github.com/Textualize/textual/compare/v0.66.0...v0.67.0
Expand Down
6 changes: 3 additions & 3 deletions docs/guide/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,16 @@ Textual supports the following builtin actions which are defined on the app.
- [action_add_class][textual.app.App.action_add_class]
- [action_back][textual.app.App.action_back]
- [action_bell][textual.app.App.action_bell]
- [action_check_bindings][textual.app.App.action_check_bindings]
- [action_focus][textual.app.App.action_focus]
- [action_focus_next][textual.app.App.action_focus_next]
- [action_focus_previous][textual.app.App.action_focus_previous]
- [action_focus][textual.app.App.action_focus]
- [action_pop_screen][textual.app.App.action_pop_screen]
- [action_push_screen][textual.app.App.action_push_screen]
- [action_quit][textual.app.App.action_quit]
- [action_remove_class][textual.app.App.action_remove_class]
- [action_screenshot][textual.app.App.action_screenshot]
- [action_switch_screen][textual.app.App.action_switch_screen]
- [action_simulate_key][textual.app.App.action_simulate_key]
- [action_suspend_process][textual.app.App.action_suspend_process]
- [action_switch_screen][textual.app.App.action_switch_screen]
- [action_toggle_class][textual.app.App.action_toggle_class]
- [action_toggle_dark][textual.app.App.action_toggle_dark]
10 changes: 9 additions & 1 deletion docs/widgets/toast.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@ A widget which displays a notification message.
You can customize the style of Toasts by targeting the `Toast` [CSS type](../guide/CSS.md#type-selector).
For example:


```scss
Toast {
padding: 3;
}
```

If you wish to change the location of Toasts, it is possible by targeting the `ToastRack` CSS type.
For example:

```scss
ToastRack {
align: right top;
}
```

The three severity levels also have corresponding
[classes](../guide/CSS.md#class-name-selector), allowing you to target the
different styles of notification. They are:
Expand Down
2 changes: 1 addition & 1 deletion examples/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class DictionaryApp(App):
"""Searches ab dictionary API as-you-type."""
"""Searches a dictionary API as-you-type."""

CSS_PATH = "dictionary.tcss"

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.68.0"
version = "0.69.0"
homepage = "https://github.com/Textualize/textual"
repository = "https://github.com/Textualize/textual"
documentation = "https://textual.textualize.io/"
Expand Down
12 changes: 7 additions & 5 deletions src/textual/_immutable_sequence_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from sys import maxsize
from typing import Generic, Iterator, Sequence, TypeVar, overload
from typing import TYPE_CHECKING, Generic, Iterator, Sequence, TypeVar, overload

T = TypeVar("T")

Expand All @@ -19,11 +19,13 @@ def __init__(self, wrap: Sequence[T]) -> None:
"""
self._wrap = wrap

@overload
def __getitem__(self, index: int) -> T: ...
if TYPE_CHECKING:

@overload
def __getitem__(self, index: slice) -> ImmutableSequenceView[T]: ...
@overload
def __getitem__(self, index: int) -> T: ...

@overload
def __getitem__(self, index: slice) -> ImmutableSequenceView[T]: ...

def __getitem__(self, index: int | slice) -> T | ImmutableSequenceView[T]:
return (
Expand Down
10 changes: 6 additions & 4 deletions src/textual/_node_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,13 @@ def __iter__(self) -> Iterator[Widget]:
def __reversed__(self) -> Iterator[Widget]:
return reversed(self._nodes)

@overload
def __getitem__(self, index: int) -> Widget: ...
if TYPE_CHECKING:

@overload
def __getitem__(self, index: slice) -> list[Widget]: ...
@overload
def __getitem__(self, index: int) -> Widget: ...

@overload
def __getitem__(self, index: slice) -> list[Widget]: ...

def __getitem__(self, index: int | slice) -> Widget | list[Widget]:
return self._nodes[index]
72 changes: 36 additions & 36 deletions src/textual/_work_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,42 @@ class WorkerDeclarationError(Exception):
"""An error in the declaration of a worker method."""


@overload
def work(
method: Callable[FactoryParamSpec, Coroutine[None, None, ReturnType]],
*,
name: str = "",
group: str = "default",
exit_on_error: bool = True,
exclusive: bool = False,
description: str | None = None,
thread: bool = False,
) -> Callable[FactoryParamSpec, "Worker[ReturnType]"]: ...


@overload
def work(
method: Callable[FactoryParamSpec, ReturnType],
*,
name: str = "",
group: str = "default",
exit_on_error: bool = True,
exclusive: bool = False,
description: str | None = None,
thread: bool = False,
) -> Callable[FactoryParamSpec, "Worker[ReturnType]"]: ...

if TYPE_CHECKING:

@overload
def work(
*,
name: str = "",
group: str = "default",
exit_on_error: bool = True,
exclusive: bool = False,
description: str | None = None,
thread: bool = False,
) -> Decorator[..., ReturnType]: ...
@overload
def work(
method: Callable[FactoryParamSpec, Coroutine[None, None, ReturnType]],
*,
name: str = "",
group: str = "default",
exit_on_error: bool = True,
exclusive: bool = False,
description: str | None = None,
thread: bool = False,
) -> Callable[FactoryParamSpec, "Worker[ReturnType]"]: ...

@overload
def work(
method: Callable[FactoryParamSpec, ReturnType],
*,
name: str = "",
group: str = "default",
exit_on_error: bool = True,
exclusive: bool = False,
description: str | None = None,
thread: bool = False,
) -> Callable[FactoryParamSpec, "Worker[ReturnType]"]: ...

@overload
def work(
*,
name: str = "",
group: str = "default",
exit_on_error: bool = True,
exclusive: bool = False,
description: str | None = None,
thread: bool = False,
) -> Decorator[..., ReturnType]: ...


def work(
Expand Down Expand Up @@ -103,7 +103,7 @@ def decorator(
method: (
Callable[DecoratorParamSpec, ReturnType]
| Callable[DecoratorParamSpec, Coroutine[None, None, ReturnType]]
)
),
) -> Callable[DecoratorParamSpec, Worker[ReturnType]]:
"""The decorator."""

Expand Down
7 changes: 4 additions & 3 deletions src/textual/_xterm_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,14 @@ def parse_mouse_code(self, code: str) -> events.Event | None:
)
button = 0
else:
if buttons & 32:
button = (buttons + 1) & 3
# XTerm events for mouse movement can look like mouse button down events. But if there is no key pressed,
# it's a mouse move event.
if buttons & 32 or button == 0:
event_class = events.MouseMove
else:
event_class = events.MouseDown if state == "M" else events.MouseUp

button = (buttons + 1) & 3

event = event_class(
x,
y,
Expand Down
Loading

0 comments on commit a566558

Please sign in to comment.