mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Tidy up various class properties documentation
Rather than use the Sphinx-influenced '#:' style of comment, switch to the more docstring-a-like approach used in the Google style.
This commit is contained in:
@@ -24,8 +24,8 @@ from rich.markdown import Markdown
|
||||
class Help(Screen):
|
||||
"""The help screen for the application."""
|
||||
|
||||
#: Bindings for the help screen.
|
||||
BINDINGS = [("escape,space,q,question_mark", "pop_screen", "Close")]
|
||||
"""Bindings for the help screen."""
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
"""Compose the game's help.
|
||||
@@ -39,8 +39,8 @@ class Help(Screen):
|
||||
class WinnerMessage(Static):
|
||||
"""Widget to tell the user they have won."""
|
||||
|
||||
#: The minimum number of moves you can solve the puzzle in.
|
||||
MIN_MOVES: Final = 14
|
||||
"""int: The minimum number of moves you can solve the puzzle in."""
|
||||
|
||||
@staticmethod
|
||||
def _plural(value: int) -> str:
|
||||
@@ -78,11 +78,11 @@ class GameHeader(Widget):
|
||||
and the count of how many cells are turned on (``#progress``).
|
||||
"""
|
||||
|
||||
#: Keep track of how many moves the player has made.
|
||||
moves = reactive(0)
|
||||
"""int: Keep track of how many moves the player has made."""
|
||||
|
||||
#: Keep track of how many cells are filled.
|
||||
filled = reactive(0)
|
||||
"""int: Keep track of how many cells are filled."""
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
"""Compose the game header.
|
||||
@@ -159,10 +159,9 @@ class GameGrid(Widget):
|
||||
class Game(Screen):
|
||||
"""Main 5x5 game grid screen."""
|
||||
|
||||
#: The size of the game grid. Clue's in the name really.
|
||||
SIZE = 5
|
||||
"""The size of the game grid. Clue's in the name really."""
|
||||
|
||||
#: The bindings for the main game grid.
|
||||
BINDINGS = [
|
||||
Binding("n", "new_game", "New Game"),
|
||||
Binding("question_mark", "push_screen('help')", "Help", key_display="?"),
|
||||
@@ -173,6 +172,7 @@ class Game(Screen):
|
||||
Binding("right,d,l", "navigate(0,1)", "Move Right", False),
|
||||
Binding("space", "move", "Toggle", False),
|
||||
]
|
||||
"""The bindings for the main game grid."""
|
||||
|
||||
@property
|
||||
def filled_cells(self) -> DOMQuery[GameCell]:
|
||||
@@ -308,17 +308,17 @@ class Game(Screen):
|
||||
class FiveByFive(App[None]):
|
||||
"""Main 5x5 application class."""
|
||||
|
||||
#: The name of the stylesheet for the app.
|
||||
CSS_PATH = "five_by_five.css"
|
||||
"""The name of the stylesheet for the app."""
|
||||
|
||||
#: The pre-loaded screens for the application.
|
||||
SCREENS = {"help": Help()}
|
||||
"""The pre-loaded screens for the application."""
|
||||
|
||||
#: App-level bindings.
|
||||
BINDINGS = [("ctrl+d", "toggle_dark", "Toggle Dark Mode")]
|
||||
"""App-level bindings."""
|
||||
|
||||
# Set the title
|
||||
TITLE = "5x5 -- A little annoying puzzle"
|
||||
"""The title of the application."""
|
||||
|
||||
def on_mount(self) -> None:
|
||||
"""Set up the application on startup."""
|
||||
|
||||
Reference in New Issue
Block a user