mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
docstrings
This commit is contained in:
@@ -4,7 +4,7 @@ from textual.layout import Vertical
|
||||
|
||||
from rich.text import Text
|
||||
|
||||
TEXT = Text.from_markup(" ".join(str(n) * 5 for n in range(10)))
|
||||
TEXT = Text.from_markup(" ".join(str(n) * 5 for n in range(12)))
|
||||
|
||||
|
||||
class AutoApp(App):
|
||||
|
||||
@@ -211,7 +211,6 @@ class Border:
|
||||
render_options = options.update_dimensions(width, new_height)
|
||||
else:
|
||||
render_options = options.update_width(width)
|
||||
# has_top = has_bottom = False
|
||||
|
||||
lines = console.render_lines(self.renderable, render_options)
|
||||
|
||||
|
||||
@@ -48,6 +48,16 @@ class Layout(ABC):
|
||||
"""
|
||||
|
||||
def get_content_width(self, widget: Widget, container: Size, viewport: Size) -> int:
|
||||
"""Get the width of the content.
|
||||
|
||||
Args:
|
||||
widget (Widget): The container widget.
|
||||
container (Size): The container size.
|
||||
viewport (Size): The viewport size.
|
||||
|
||||
Returns:
|
||||
int: Width of the content.
|
||||
"""
|
||||
width: int | None = None
|
||||
for child in widget.displayed_children:
|
||||
assert isinstance(child, Widget)
|
||||
@@ -61,6 +71,17 @@ class Layout(ABC):
|
||||
def get_content_height(
|
||||
self, widget: Widget, container: Size, viewport: Size, width: int
|
||||
) -> int:
|
||||
"""Get the content height.
|
||||
|
||||
Args:
|
||||
widget (Widget): The container widget.
|
||||
container (Size): The container size.
|
||||
viewport (Size): The viewport.
|
||||
width (int): The content width.
|
||||
|
||||
Returns:
|
||||
int: Content height (in lines).
|
||||
"""
|
||||
if not widget.displayed_children:
|
||||
height = container.height
|
||||
else:
|
||||
|
||||
@@ -408,8 +408,8 @@ class App(Generic[ReturnType], DOMNode):
|
||||
self.devtools.log(
|
||||
DevtoolsLog(output, caller=_textual_calling_frame)
|
||||
)
|
||||
except Exception:
|
||||
self.console.bell()
|
||||
except Exception as error:
|
||||
self.on_exception(error)
|
||||
|
||||
def action_screenshot(self, path: str | None = None) -> None:
|
||||
"""Action to save a screenshot."""
|
||||
|
||||
Reference in New Issue
Block a user