Skip to content

Commit 842148d

Browse files
authored
Merge pull request #1007 from davep/5x5-tidy
Tidy up some of the documentation in the FiveByFive example
2 parents 8603e56 + 7ebfb1e commit 842148d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

examples/five_by_five.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
class Help(Screen):
2525
"""The help screen for the application."""
2626

27-
#: Bindings for the help screen.
2827
BINDINGS = [("escape,space,q,question_mark", "pop_screen", "Close")]
28+
"""Bindings for the help screen."""
2929

3030
def compose(self) -> ComposeResult:
3131
"""Compose the game's help.
@@ -39,8 +39,8 @@ def compose(self) -> ComposeResult:
3939
class WinnerMessage(Static):
4040
"""Widget to tell the user they have won."""
4141

42-
#: The minimum number of moves you can solve the puzzle in.
4342
MIN_MOVES: Final = 14
43+
"""int: The minimum number of moves you can solve the puzzle in."""
4444

4545
@staticmethod
4646
def _plural(value: int) -> str:
@@ -78,11 +78,11 @@ class GameHeader(Widget):
7878
and the count of how many cells are turned on (``#progress``).
7979
"""
8080

81-
#: Keep track of how many moves the player has made.
8281
moves = reactive(0)
82+
"""int: Keep track of how many moves the player has made."""
8383

84-
#: Keep track of how many cells are filled.
8584
filled = reactive(0)
85+
"""int: Keep track of how many cells are filled."""
8686

8787
def compose(self) -> ComposeResult:
8888
"""Compose the game header.
@@ -159,10 +159,9 @@ def compose(self) -> ComposeResult:
159159
class Game(Screen):
160160
"""Main 5x5 game grid screen."""
161161

162-
#: The size of the game grid. Clue's in the name really.
163-
SIZE = 5
162+
SIZE: Final = 5
163+
"""The size of the game grid. Clue's in the name really."""
164164

165-
#: The bindings for the main game grid.
166165
BINDINGS = [
167166
Binding("n", "new_game", "New Game"),
168167
Binding("question_mark", "push_screen('help')", "Help", key_display="?"),
@@ -173,6 +172,7 @@ class Game(Screen):
173172
Binding("right,d,l", "navigate(0,1)", "Move Right", False),
174173
Binding("space", "move", "Toggle", False),
175174
]
175+
"""The bindings for the main game grid."""
176176

177177
@property
178178
def filled_cells(self) -> DOMQuery[GameCell]:
@@ -308,17 +308,17 @@ def on_mount(self) -> None:
308308
class FiveByFive(App[None]):
309309
"""Main 5x5 application class."""
310310

311-
#: The name of the stylesheet for the app.
312311
CSS_PATH = "five_by_five.css"
312+
"""The name of the stylesheet for the app."""
313313

314-
#: The pre-loaded screens for the application.
315314
SCREENS = {"help": Help()}
315+
"""The pre-loaded screens for the application."""
316316

317-
#: App-level bindings.
318317
BINDINGS = [("ctrl+d", "toggle_dark", "Toggle Dark Mode")]
318+
"""App-level bindings."""
319319

320-
# Set the title
321320
TITLE = "5x5 -- A little annoying puzzle"
321+
"""The title of the application."""
322322

323323
def on_mount(self) -> None:
324324
"""Set up the application on startup."""

0 commit comments

Comments
 (0)