Default with_self to False in walk_children

This commit is contained in:
Darren Burns
2022-12-21 11:12:22 +00:00
parent 8c864030e2
commit 032c9211f4
3 changed files with 6 additions and 6 deletions

View File

@@ -1491,7 +1491,7 @@ class App(Generic[ReturnType], DOMNode):
nodes: set[DOMNode] = {
child
for node in self._require_stylesheet_update
for child in node.walk_children()
for child in node.walk_children(with_self=True)
}
self._require_stylesheet_update.clear()
self.stylesheet.update_nodes(nodes, animate=True)

View File

@@ -488,7 +488,7 @@ class Stylesheet:
animate (bool, optional): Enable CSS animation. Defaults to False.
"""
self.update_nodes(root.walk_children(), animate=animate)
self.update_nodes(root.walk_children(with_self=True), animate=animate)
def update_nodes(self, nodes: Iterable[DOMNode], animate: bool = False) -> None:
"""Update styles for nodes.

View File

@@ -615,7 +615,7 @@ class DOMNode(MessagePump):
"""Reset styles back to their initial state"""
from .widget import Widget
for node in self.walk_children():
for node in self.walk_children(with_self=True):
node._css_styles.reset()
if isinstance(node, Widget):
node._set_dirty()
@@ -648,7 +648,7 @@ class DOMNode(MessagePump):
self,
filter_type: type[WalkType],
*,
with_self: bool = True,
with_self: bool = False,
method: WalkMethod = "depth",
reverse: bool = False,
) -> list[WalkType]:
@@ -658,7 +658,7 @@ class DOMNode(MessagePump):
def walk_children(
self,
*,
with_self: bool = True,
with_self: bool = False,
method: WalkMethod = "depth",
reverse: bool = False,
) -> list[DOMNode]:
@@ -668,7 +668,7 @@ class DOMNode(MessagePump):
self,
filter_type: type[WalkType] | None = None,
*,
with_self: bool = True,
with_self: bool = False,
method: WalkMethod = "depth",
reverse: bool = False,
) -> list[DOMNode] | list[WalkType]: