from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from .App import App class Input: def __init__(self, app: App) -> None: self._app = app def handle(self, key: str) -> bool: if 'q' == key: return False elif key in ('j', 'KEY_DOWN'): self.app.cursor.down(len(self.app.items)) elif key in ('k', 'KEY_UP'): self.app.cursor.up() return True @property def app(self) -> App: return self._app