typing and changelog

This commit is contained in:
Will McGugan
2023-02-09 11:45:19 +00:00
parent 392b56e548
commit 85df8d703e
3 changed files with 10 additions and 5 deletions

View File

@@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Added Shift+scroll wheel and ctrl+scroll wheel to scroll horizontally
- Added `Tree.action_toggle_node` to toggle a node without selecting, and bound it to <kbd>Space</kbd> https://github.com/Textualize/textual/issues/1433
- Added `Tree.reset` to fully reset a `Tree` https://github.com/Textualize/textual/issues/1437
- Added DOMNode.watch method https://github.com/Textualize/textual/pull/1750
- Added DOMNode.watch method https://github.com/Textualize/textual/pull/1750
### Changed
@@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Removed
- Methods `MessagePump.emit` and `MessagePump.emit_no_wait` https://github.com/Textualize/textual/pull/1738
- Removed `reactive.watch` in favor of DOMNode.watch.
## [0.10.1] - 2023-01-20

View File

@@ -4,7 +4,6 @@ import re
from inspect import getfile
from typing import (
TYPE_CHECKING,
Callable,
ClassVar,
Iterable,
Iterator,
@@ -23,6 +22,7 @@ from rich.tree import Tree
from ._context import NoActiveAppError
from ._node_list import NodeList
from ._types import CallbackType
from .binding import Bindings, BindingType
from .color import BLACK, WHITE, Color
from .css._error_tools import friendly_list
@@ -649,7 +649,11 @@ class DOMNode(MessagePump):
return [child for child in self.children if child.display]
def watch(
self, obj: DOMNode, attribute_name: str, callback: Callable, init: bool = True
self,
obj: DOMNode,
attribute_name: str,
callback: CallbackType,
init: bool = True,
) -> None:
"""Watches for modifications to reactive attributes on another object.

View File

@@ -17,7 +17,7 @@ import rich.repr
from . import events
from ._callback import count_parameters
from ._types import MessageTarget
from ._types import MessageTarget, CallbackType
if TYPE_CHECKING:
from .dom import DOMNode
@@ -329,7 +329,7 @@ def _watch(
node: DOMNode,
obj: Reactable,
attribute_name: str,
callback: Callable[[Any], object],
callback: CallbackType,
*,
init: bool = True,
) -> None: