mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Simplify the tests for a focused game cell
This commit is contained in:
@@ -230,7 +230,7 @@ class Game(Screen):
|
|||||||
|
|
||||||
def action_navigate(self, row: int, col: int) -> None:
|
def action_navigate(self, row: int, col: int) -> None:
|
||||||
"""Navigate to a new cell by the given offsets."""
|
"""Navigate to a new cell by the given offsets."""
|
||||||
if self.focused and isinstance(self.focused, GameCell):
|
if isinstance(self.focused, GameCell):
|
||||||
self.set_focus(
|
self.set_focus(
|
||||||
self.cell(
|
self.cell(
|
||||||
(self.focused.row + row) % self.SIZE,
|
(self.focused.row + row) % self.SIZE,
|
||||||
@@ -240,7 +240,7 @@ class Game(Screen):
|
|||||||
|
|
||||||
def action_move(self) -> None:
|
def action_move(self) -> None:
|
||||||
"""Make a move on the current cell."""
|
"""Make a move on the current cell."""
|
||||||
if self.focused and isinstance(self.focused, GameCell):
|
if isinstance(self.focused, GameCell):
|
||||||
self.focused.press()
|
self.focused.press()
|
||||||
|
|
||||||
def on_mount(self) -> None:
|
def on_mount(self) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user