コード例 #1
0
ファイル: roster_view.py プロジェクト: bsmr/rr-pq-cli
    def __init__(self, screen: T.Any) -> None:
        super().__init__(screen)

        self.on_create = EventHandler()
        self.on_play = EventHandler()
        self.on_delete = EventHandler()
        self.on_quit = EventHandler()

        self.choices: T.List[Choice] = [
            Choice(
                keys=list(map(ord, "cC")),
                desc="[C] Create new character",
                callback=self.on_create,
            ),
            Choice(
                keys=list(map(ord, "pP")),
                desc="[P] Play",
                callback=self.on_play,
            ),
            Choice(
                keys=list(map(ord, "dD")),
                desc="[D] Delete character",
                callback=self.on_delete,
            ),
            Choice(
                keys=list(KEYS_CANCEL), desc="[Q] Quit", callback=self.on_quit
            ),
        ]
コード例 #2
0
ファイル: menu_view.py プロジェクト: tree-s/pq-cli
    def __init__(self,
                 screen: T.Any,
                 title: str,
                 active_choice: int = 0) -> None:
        super().__init__(screen)

        self.on_cancel = EventHandler()
        self.on_confirm = EventHandler()

        self._title = f"{title}:"
        self._choices: T.List[Choice] = []
        self._active_choice = active_choice
コード例 #3
0
    def __init__(self, screen: T.Any) -> None:
        super().__init__(screen)

        self.on_cancel = EventHandler()
        self.on_confirm = EventHandler()

        self._active_widget = 0
        self._win: T.Optional[T.Any] = None
        self._stats_win: T.Optional[T.Any] = None

        self._stats_builder = StatsBuilder()
        self._stats = self._stats_builder.roll()
コード例 #4
0
    def __init__(self,
                 screen: T.Any,
                 character_name: T.Optional[str] = None) -> None:
        super().__init__(screen)

        self.on_cancel = EventHandler()
        self.on_confirm = EventHandler()

        self._active_widget = 0
        self._win: T.Optional[T.Any] = None
        self._text_win: T.Optional[T.Any] = None
        self._text = character_name or generate_name()
コード例 #5
0
ファイル: confirm_view.py プロジェクト: bsmr/rr-pq-cli
    def __init__(self, screen: T.Any, title: str) -> None:
        super().__init__(screen)

        self.title = f"{title}:"
        self.on_cancel = EventHandler()
        self.on_confirm = EventHandler()

        self.choices: T.List[Choice] = [
            Choice(
                keys=list(map(ord, "yY")),
                desc=f"[Y] Yes",
                callback=self.on_confirm,
            ),
            Choice(
                keys=list(map(ord, "nNqQ\N{ESC}")),
                desc="[N] No",
                callback=self.on_cancel,
            ),
        ]
コード例 #6
0
ファイル: __init__.py プロジェクト: bsmr/rr-pq-cli
    def __init__(
        self,
        screen: T.Any,
        roster: Roster,
        player: Player,
        args: argparse.Namespace,
    ) -> None:
        super().__init__(screen)
        self.on_exit = EventHandler()

        self._roster = roster
        self._player = player
        self._args = args

        self._simulation = Simulation(player)
        self._last_tick = datetime.datetime.now()
コード例 #7
0
 def __init__(self, *args: T.Any, **kwargs: T.Any) -> None:
     self._focused = False
     self._on_focus_change = EventHandler()
     super().__init__(*args, **kwargs)