Documentation fixes.

This commit is contained in:
Rodrigo Girão Serrão
2023-11-27 10:31:33 +00:00
parent 9a9a072bad
commit c19d54de67
12 changed files with 23 additions and 21 deletions

View File

@@ -1 +1,3 @@
::: textual.containers
::: textual.widgets.ContentSwitcher

View File

@@ -23,7 +23,7 @@ See the [layout](../guide/layout.md) guide for more information.
## Example
Note how the `layout` style affects the arrangement of widgets in the example below.
To learn more about the grid layout, you can see the [layout guide](../guide/layout.md) or the [grid reference](./grid.md).
To learn more about the grid layout, you can see the [layout guide](../guide/layout.md) or the [grid reference](../grid.md).
=== "Output"

View File

@@ -7,9 +7,7 @@ A widget which displays a notification message.
- [ ] Focusable
- [ ] Container
Note that `Toast` isn't designed to be used directly in your applications,
but it is instead used by [`notify`][textual.app.App.notify] to
display a message when using Textual's built-in notification system.
!!! warning "Note that `Toast` isn't designed to be used directly in your applications, but it is instead used by [`notify`][textual.app.App.notify] to display a message when using Textual's built-in notification system."
## Styling
@@ -94,7 +92,7 @@ The toast widget provides the following component classes:
---
::: textual.widgets._toast
::: textual.widgets._toast.Toast
options:
show_root_heading: true
show_root_toc_entry: true

View File

@@ -165,6 +165,7 @@ nav:
- "widgets/tabbed_content.md"
- "widgets/tabs.md"
- "widgets/text_area.md"
- "widgets/toast.md"
- "widgets/tree.md"
- API:
- "api/index.md"

View File

@@ -17,7 +17,7 @@ class SystemCommands(Provider):
"""Handle a request to search for system commands that match the query.
Args:
user_input: The user input to be matched.
query: The user input to be matched.
Yields:
Command hits for use in the command palette.

View File

@@ -561,7 +561,7 @@ class App(Generic[ReturnType], DOMNode):
@property
def workers(self) -> WorkerManager:
"""The [worker](guide/workers/) manager.
"""The [worker](/guide/workers/) manager.
Returns:
An object to manage workers.
@@ -972,8 +972,8 @@ class App(Generic[ReturnType], DOMNode):
def call_from_thread(
self,
callback: Callable[..., CallThreadReturnType | Awaitable[CallThreadReturnType]],
*args: object,
**kwargs: object,
*args: Any,
**kwargs: Any,
) -> CallThreadReturnType:
"""Run a callable from another thread, and return the result.

View File

@@ -16,9 +16,9 @@ class AwaitComplete:
"""Create an AwaitComplete.
Args:
coroutine: One or more coroutines to execute.
coroutines: One or more coroutines to execute.
"""
self.coroutines = coroutines
self.coroutines: tuple[Coroutine[Any, Any, Any], ...] = coroutines
self._future: Future = gather(*self.coroutines)
async def __call__(self) -> Any:

View File

@@ -80,7 +80,7 @@ class SyntaxAwareDocument(Document):
To execute a query, call `query_syntax_tree`.
Args:
The string query to prepare.
query: The string query to prepare.
Returns:
The prepared query.

View File

@@ -12,6 +12,7 @@ from functools import lru_cache, partial
from inspect import getfile
from typing import (
TYPE_CHECKING,
Any,
Callable,
ClassVar,
Iterable,
@@ -1139,12 +1140,12 @@ class DOMNode(MessagePump):
return query.only_one() if expect_type is None else query.only_one(expect_type)
def set_styles(self, css: str | None = None, **update_styles) -> Self:
def set_styles(self, css: str | None = None, **update_styles: Any) -> Self:
"""Set custom styles on this object.
Args:
css: Styles in CSS format.
**update_styles: Keyword arguments map style names on to style.
update_styles: Keyword arguments map style names onto style values.
Returns:
Self.

View File

@@ -1,7 +1,7 @@
"""
Fuzzy matcher.
This class is used by the [command palette](guide/command_palette) to match search terms.
This class is used by the [command palette](/guide/command_palette) to match search terms.
"""

View File

@@ -3239,18 +3239,18 @@ class Widget(DOMNode):
def begin_capture_print(self, stdout: bool = True, stderr: bool = True) -> None:
"""Capture text from print statements (or writes to stdout / stderr).
If printing is captured, the widget will be sent an [events.Print][textual.events.Print] message.
If printing is captured, the widget will be sent an [`events.Print`][textual.events.Print] message.
Call [end_capture_print][textual.widget.Widget.end_capture_print] to disable print capture.
Call [`end_capture_print`][textual.widget.Widget.end_capture_print] to disable print capture.
Args:
stdout: Capture stdout.
stderr: Capture stderr.
stdout: Whether to capture stdout.
stderr: Whether to capture stderr.
"""
self.app.begin_capture_print(self, stdout=stdout, stderr=stderr)
def end_capture_print(self) -> None:
"""End print capture (set with [capture_print][textual.widget.Widget.capture_print])."""
"""End print capture (set with [`begin_capture_print`][textual.widget.Widget.begin_capture_print])."""
self.app.end_capture_print(self)
def check_message_enabled(self, message: Message) -> bool:

View File

@@ -2363,7 +2363,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
Args:
columns: One or more columns to sort by the values in.
key: A function (or other callable) that returns a key to
use for sorting purposes.
use for sorting purposes.
reverse: If True, the sort order will be reversed.
Returns: