Remove QuitAction and ActionWithActor!
Move quit event handling to the interface and flatten the Action class hierarchy. There are no longer any actions that don't take an Actor. This has the happy side effect of resolving some pylint errors too. :)
This commit is contained in:
parent
02ed3d1e4a
commit
327cc90b2e
6 changed files with 24 additions and 43 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
'''Defines event handling mechanisms.'''
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import NoReturn, TYPE_CHECKING
|
||||
|
||||
from tcod import event as tev
|
||||
|
||||
|
@ -42,6 +42,11 @@ class InterfaceEventHandler(tev.EventDispatch[bool]):
|
|||
def ev_mousebuttonup(self, event: tev.MouseButtonUp) -> bool:
|
||||
return self._handle_event(event)
|
||||
|
||||
def ev_quit(self, event: tev.Quit) -> NoReturn:
|
||||
# TODO: Maybe show a "do you want to quit?" alert?
|
||||
# TODO: Probably inform the engine that we're shutting down.
|
||||
raise SystemExit()
|
||||
|
||||
def _handle_event(self, event: tev.Event) -> bool:
|
||||
for handler in self._handlers:
|
||||
if handler and handler.dispatch(event):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue