docstrings

This commit is contained in:
Will McGugan
2022-05-18 15:57:11 +01:00
parent d27d22000b
commit 3b0bb8657e
4 changed files with 24 additions and 4 deletions

View File

@@ -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):

View File

@@ -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)

View File

@@ -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:

View File

@@ -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."""