Skip to content

Commit

Permalink
Merge pull request #3751 from Textualize/documentation-fixes
Browse files Browse the repository at this point in the history
Documentation fixes.
  • Loading branch information
rodrigogiraoserrao authored Nov 27, 2023
2 parents b70a8f1 + c19d54d commit fe0892e
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 21 deletions.
2 changes: 2 additions & 0 deletions docs/api/containers.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
::: textual.containers

::: textual.widgets.ContentSwitcher
2 changes: 1 addition & 1 deletion docs/styles/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 2 additions & 4 deletions docs/widgets/toast.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions mkdocs-nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ nav:
- "widgets/tabbed_content.md"
- "widgets/tabs.md"
- "widgets/text_area.md"
- "widgets/toast.md"
- "widgets/tree.md"
- API:
- "api/index.md"
Expand Down
2 changes: 1 addition & 1 deletion src/textual/_system_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async def search(self, query: str) -> Hits:
"""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.
Expand Down
6 changes: 3 additions & 3 deletions src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ def validate_sub_title(self, sub_title: Any) -> str:

@property
def workers(self) -> WorkerManager:
"""The [worker](guide/workers/) manager.
"""The [worker](/guide/workers/) manager.
Returns:
An object to manage workers.
Expand Down Expand Up @@ -987,8 +987,8 @@ def _log(
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.
Expand Down
4 changes: 2 additions & 2 deletions src/textual/await_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def __init__(self, *coroutines: Coroutine[Any, Any, Any]) -> None:
"""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:
Expand Down
2 changes: 1 addition & 1 deletion src/textual/document/_syntax_aware_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def prepare_query(self, query: str) -> Query | None:
To execute a query, call `query_syntax_tree`.
Args:
The string query to prepare.
query: The string query to prepare.
Returns:
The prepared query.
Expand Down
5 changes: 3 additions & 2 deletions src/textual/dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from inspect import getfile
from typing import (
TYPE_CHECKING,
Any,
Callable,
ClassVar,
Iterable,
Expand Down Expand Up @@ -1140,12 +1141,12 @@ def query_one(

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.
Expand Down
2 changes: 1 addition & 1 deletion src/textual/fuzzy.py
Original file line number Diff line number Diff line change
@@ -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.
"""

Expand Down
10 changes: 5 additions & 5 deletions src/textual/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -3244,18 +3244,18 @@ def release_mouse(self) -> None:
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:
Expand Down
2 changes: 1 addition & 1 deletion src/textual/widgets/_data_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2363,7 +2363,7 @@ def sort(
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:
Expand Down

0 comments on commit fe0892e

Please sign in to comment.