Change reactable type

This commit is contained in:
Will McGugan
2023-02-09 09:46:07 +00:00
parent 507a2f8299
commit b0a9c743ea
4 changed files with 6 additions and 12 deletions

View File

@@ -414,10 +414,6 @@ class App(Generic[ReturnType], DOMNode):
"""ReturnType | None: The return type of the app.""" """ReturnType | None: The return type of the app."""
return self._return_value return self._return_value
def _post_mount(self):
"""Called after the object has been mounted."""
Reactive._initialize_object(self)
def animate( def animate(
self, self,
attribute: str, attribute: str,

View File

@@ -210,6 +210,10 @@ class DOMNode(MessagePump):
styles = self._component_styles[name] styles = self._component_styles[name]
return styles return styles
def _post_mount(self):
"""Called after the object has been mounted."""
Reactive._initialize_object(self)
@property @property
def _node_bases(self) -> Iterator[Type[DOMNode]]: def _node_bases(self) -> Iterator[Type[DOMNode]]:
"""Iterator[Type[DOMNode]]: The DOMNode bases classes (including self.__class__)""" """Iterator[Type[DOMNode]]: The DOMNode bases classes (including self.__class__)"""

View File

@@ -11,7 +11,6 @@ from typing import (
Generic, Generic,
Type, Type,
TypeVar, TypeVar,
Union,
) )
import rich.repr import rich.repr
@@ -21,10 +20,9 @@ from ._callback import count_parameters
from ._types import MessageTarget from ._types import MessageTarget
if TYPE_CHECKING: if TYPE_CHECKING:
from .app import App from .dom import DOMNode
from .widget import Widget
Reactable = Union[Widget, App] Reactable = DOMNode
ReactiveType = TypeVar("ReactiveType") ReactiveType = TypeVar("ReactiveType")

View File

@@ -360,10 +360,6 @@ class Widget(DOMNode):
def offset(self, offset: Offset) -> None: def offset(self, offset: Offset) -> None:
self.styles.offset = ScalarOffset.from_offset(offset) self.styles.offset = ScalarOffset.from_offset(offset)
def _post_mount(self):
"""Called after the object has been mounted."""
Reactive._initialize_object(self)
ExpectType = TypeVar("ExpectType", bound="Widget") ExpectType = TypeVar("ExpectType", bound="Widget")
@overload @overload