Skip to content

Commit

Permalink
disable modes
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Dec 3, 2024
1 parent 9d23750 commit b85e5c0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/textual/demo/demo_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,13 @@ def action_maximize(self) -> None:
title="Maximize",
severity="warning",
)

def check_action(self, action: str, parameters: tuple[object, ...]) -> bool | None:
"""Disable switching to a mode we are already on."""
if (
action == "switch_mode"
and parameters
and self.current_mode == parameters[0]
):
return None
return True

0 comments on commit b85e5c0

Please sign in to comment.