Skip to content

Commit

Permalink
Move the title and sub_title docstrings to __ini__
Browse files Browse the repository at this point in the history
According to the current working of out documentation generation pipeline,
this is the way to document a reactive property that is referred to within
the owner class' __init__.

See Textualize#1572 and Textualize#1564.
  • Loading branch information
davep committed Jan 16, 2023
1 parent f72a4cf commit cb7adb7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,21 +262,7 @@ class App(Generic[ReturnType], DOMNode):
]

title: Reactive[str] = Reactive("", compute=False)
"""Reactive[str]: 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.
"""

sub_title: Reactive[str] = Reactive("", compute=False)
"""Reactive[str]: 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.
"""

dark: Reactive[bool] = Reactive(True, compute=False)

def __init__(
Expand Down Expand Up @@ -329,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

0 comments on commit cb7adb7

Please sign in to comment.