Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docstrings to app title an sub-titles #1570

Merged
merged 5 commits into from
Jan 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,20 @@ class App(Generic[ReturnType], DOMNode):
SCREENS: dict[str, Screen | Callable[[], Screen]] = {}
_BASE_PATH: str | None = None
CSS_PATH: CSSPathType = None

TITLE: str | None = None
"""str | None: The default title for the application.

If set to a string, this sets the default title for the application. See
also the `title` attribute.
"""

SUB_TITLE: str | None = None
"""str | None: The default sub-title for the application.

If set to a string, this sets the default sub-title for the application. See
also the `sub_title` attribute.
"""

BINDINGS = [
Binding("ctrl+c", "quit", "Quit", show=False, priority=True),
Expand Down Expand Up @@ -303,10 +315,24 @@ def __init__(
self._animator = Animator(self)
self._animate = self._animator.bind(self)
self.mouse_position = Offset(0, 0)

self.title = (
self.TITLE if self.TITLE is not None else f"{self.__class__.__name__}"
)
"""The title for the application.

The initial value in a running application will be that set in `TITLE`
(if one is set). Assign new values to this instance attribute to change
the title.
"""

self.sub_title = self.SUB_TITLE if self.SUB_TITLE is not None else ""
"""The sub-title for the application.

The initial value in a running application will be that set in `SUB_TITLE`
(if one is set). Assign new values to this instance attribute to change
the sub-title.
"""

self._logger = Logger(self._log)

Expand Down