mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
docstring and private
This commit is contained in:
@@ -601,6 +601,10 @@ class App(Generic[ReturnType], DOMNode):
|
||||
|
||||
This property may be used to inspect current bindings.
|
||||
|
||||
Returns:
|
||||
|
||||
A mapping of keys on to node + binding.
|
||||
|
||||
"""
|
||||
|
||||
namespace_binding_map: dict[str, tuple[DOMNode, Binding]] = {}
|
||||
@@ -625,6 +629,8 @@ class App(Generic[ReturnType], DOMNode):
|
||||
def get_css_variables(self) -> dict[str, str]:
|
||||
"""Get a mapping of variables used to pre-populate CSS.
|
||||
|
||||
May be implemented in a subclass to add new CSS variables.
|
||||
|
||||
Returns:
|
||||
A mapping of variable name to value.
|
||||
"""
|
||||
|
||||
@@ -60,12 +60,12 @@ class Footer(Widget):
|
||||
self._key_text: Text | None = None
|
||||
self.auto_links = False
|
||||
|
||||
async def watch_highlight_key(self, value) -> None:
|
||||
async def watch_highlight_key(self, value: str | None) -> None:
|
||||
"""If highlight key changes we need to regenerate the text."""
|
||||
self._key_text = None
|
||||
self.refresh()
|
||||
|
||||
def on_mount(self) -> None:
|
||||
def _on_mount(self) -> None:
|
||||
self.watch(self.screen, "focused", self._bindings_changed)
|
||||
self.watch(self.screen, "stack_updates", self._bindings_changed)
|
||||
|
||||
@@ -73,11 +73,11 @@ class Footer(Widget):
|
||||
self._key_text = None
|
||||
self.refresh()
|
||||
|
||||
async def on_mouse_move(self, event: events.MouseMove) -> None:
|
||||
def _on_mouse_move(self, event: events.MouseMove) -> None:
|
||||
"""Store any key we are moving over."""
|
||||
self.highlight_key = event.style.meta.get("key")
|
||||
|
||||
async def on_leave(self, event: events.Leave) -> None:
|
||||
def _on_leave(self, event: events.Leave) -> None:
|
||||
"""Clear any highlight when the mouse leaves the widget"""
|
||||
if self.screen.is_current:
|
||||
self.highlight_key = None
|
||||
@@ -85,7 +85,7 @@ class Footer(Widget):
|
||||
def __rich_repr__(self) -> rich.repr.Result:
|
||||
yield from super().__rich_repr__()
|
||||
|
||||
def make_key_text(self) -> Text:
|
||||
def _make_key_text(self) -> Text:
|
||||
"""Create text containing all the keys."""
|
||||
base_style = self.rich_style
|
||||
text = Text(
|
||||
@@ -140,5 +140,5 @@ class Footer(Widget):
|
||||
|
||||
def render(self) -> RenderableType:
|
||||
if self._key_text is None:
|
||||
self._key_text = self.make_key_text()
|
||||
self._key_text = self._make_key_text()
|
||||
return self._key_text
|
||||
|
||||
@@ -126,8 +126,8 @@ class Header(Widget):
|
||||
|
||||
DEFAULT_CLASSES = ""
|
||||
|
||||
tall = Reactive(False)
|
||||
"""Track if the `Header` is in a tall state or not."""
|
||||
tall: Reactive[bool] = Reactive(False)
|
||||
"""Set to `True` for a taller header or `False` for a single line header."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user