Exemple #1
0
    def get_command(self):
        """Get the user input and convert it to a command instance."""
        command_input = input("Enter your command: ")

        # The 1st command in list must always be the PrintUnknownCommand, which is used
        # as default command.
        self.command_names = [
            PrintUnknownCommand(self.viewer),
            ExitApplication(),
            GoBackMenu(self._app, self.viewer, "turns", self.tournament),
            EnterScore(self.turn),
        ]

        for command in self.command_names:
            if command.is_valid(command_input):
                self.command = command
    def update_commands(self):
        """Delete the player creation commands if the tournament already started."""
        # The 1st command in list must always be the PrintUnknownCommand, which is used
        # as default command.
        self.command_names = [
            PrintUnknownCommand(self.viewer),
            ExitApplication(),
            GoBackMenu(self._app, self.viewer, "edit_tournament",
                       self.tournament),
            GotoEditPlayer(self._app, self.viewer, self.tournament),
            ListPlayersAlphabeticalCommand(self.viewer),
            ListPlayersRankingCommand(self.viewer),
            AddPlayer(self._app, self.viewer, self.tournament),
            GeneratePlayers(self._app, self.viewer, self.tournament),
        ]

        if len(self.tournament.turns) > 0:
            del self.command_names[-2]
Exemple #3
0
    def get_command(self):
        """Get the user input and convert it to a command instance."""
        command_input = input("Enter your command: ")

        # The 1st command in list must always be the PrintUnknownCommand, which is used
        # as default command.
        self.command_names = [
            PrintUnknownCommand(self.viewer),
            ExitApplication(),
            CreateTournament(self._app, self.viewer),
            GoBackMenu(self._app, self.viewer, "main", None),
            GotoEditTournament(self._app, self.viewer),
            SaveTournamentDatabase(self.viewer),
            LoadTournamentDatabase(self.viewer),
        ]

        for command in self.command_names:
            if command.is_valid(command_input):
                self.command = command
Exemple #4
0
    def get_command(self):
        """Get the user input and convert it to a command instance."""
        command_input = input("Enter your command: ")

        # The 1st command in list must always be the PrintUnknownCommand, which is used
        # as default command.
        self.command_names = [
            PrintUnknownCommand(self.viewer),
            ExitApplication(),
            GoBackMenu(self._app, self.viewer, "tournaments", None),
            GotoTurnsMenu(self._app, self.viewer, self.tournament),
            GotoRankingMenu(self._app, self.viewer, self.tournament),
            EditTournamentLocation(self.tournament),
            EditTournamentDate(self.tournament),
            EditTournamentTurnNumber(self.tournament),
            EditTournamentTimeControl(self.tournament),
            EditTournamentDescription(self.tournament),
        ]

        for command in self.command_names:
            if command.is_valid(command_input):
                self.command = command