def run(self): self.tournament.play_tournament() ViewText("Démarrage du tournoi").show() for round_ in self.tournament.rounds: if round_.status == "terminé": ViewRoundResult(round_).show() else: while round_.status != "terminé": ViewRoundResult(round_, mode_view_results=False).show() if round_.status == "pas encore commencé": mc.ControllerCommandInterpreter( "(t) Procéder au tirage des matchs", { "t": ControllerDrawGames(round_) }).run() round_.start() ControllerSaveTournament(self.tournament).run() continue else: if not round_.status == "matchs terminé, en attente de validation": commands = { str(i + 1): ControllerEnterResults(round_.games[i]) for i in range(len(round_.games)) } commands.update({ "s": ControllerSaveTournament(self.tournament) }) mc.ControllerCommandInterpreter( "(X) Entrer le résultat du match X\n" "(s) Sauvegarder le tournoi", commands).run() else: commands = { str(i + 1): ControllerEnterResults(round_.games[i]) for i in range(len(round_.games)) } commands.update({ "s": ControllerEndRound(self.tournament, round_) }) mc.ControllerCommandInterpreter( "(X) Entrer le résultat du match X\n" "(s) Sauvegarder le tournoi et passer au round suivant", commands).run() ViewRoundResult(round_).show() ViewText("Tournoi Terminé").show() mc.ControllerCommandInterpreter( "(r) Afficher le rapport de tournoi", { "r": ctd.ControllerTournamentReport(self.tournament, self.tournament_database) }).run()
def run(self): ViewDatabaseDetails( "Détails du Tournoi", self.tournament, ["Nom", "Description", "Lieu", "Date de début", "Date de fin", "Nombre de rounds", "Contrôle du temps", "Status"], ["name", "description", "place", "start_date", "end_date", "number_of_rounds", "time_control", "status"] ).show() ViewScoreTable("Classement:", self.tournament.score_table).show() ViewTournamentResult("Résultats du Tournoi:", self.tournament).show() if self.tournament.status != "terminé": commands_message = "(j) Jouer / reprendre le tournoi" commands_list = {"j": ControllerPlayTournament(self.tournament, self.tournament_database)} else: commands_message = "" commands_list = {} commands_message += "\n(p) Afficher la liste des participants" commands_list['p'] = ControllerPlayerDatabase(self.tournament.players, title=f"{self.tournament.name} - Liste des participants") commands_message += "\n(supprimer) Supprimer le tournoi de la base de donnée" commands_list['supprimer'] = ControllerDeleteTournament(self.tournament, self.tournament_database) mc.ControllerCommandInterpreter(commands_message, commands_list).run()
def run(self): view = ViewDatabase(self.tournament_database, "Base de données des Tournois", 'name', 'start_date', 'end_date', 'status', headers=[ "Nom", "Date de début", "Date de fin", "Status" ], sort_by_attribute="start_date", sort_order=True) view.show() commands = { "supprimer " + str(i + 1): ControllerDeleteTournament(self.tournament_database[i], self.tournament_database) for i in range(len(self.tournament_database)) } commands.update({ str(i + 1): ControllerTournamentReport(self.tournament_database[i], self.tournament_database) for i in range(len(self.tournament_database)) } ) mc.ControllerCommandInterpreter( "(X) Afficher le rapport du tournoi numéro X", commands ).run()
def run(self): ViewText("{} VS {}".format(self.game.pair[0], self.game.pair[1])).show() mc.ControllerCommandInterpreter( "(1 / n / 2) Entrez le résultat\n", { "1": ControllerUpdateResult(self.game, "1"), "n": ControllerUpdateResult(self.game, "n"), "2": ControllerUpdateResult(self.game, "2"), }).run()
def run(self): ViewDatabaseDetails("Détails du Joueur", self.player, [ "Nom de Famille", "Prénom", "Date de naissance", "Sexe", "Classement" ], ["last_name", "first_name", "date_of_birth", "sex", "ranking" ]).show() mc.ControllerCommandInterpreter( "(c) Mettre à jour le classement\n" "(supprimer) Supprimer le joueur de la base de données", { "c": ControllerUpdateRanking(self.player), "supprimer": ControllerDeletePlayer(self.player, self.player_database) }).run()
def run(self): ViewDatabase(self.player_database, "Sélection des joueurs:", "last_name", "first_name", "date_of_birth", "ranking", sort_by_attribute="last_name", sort_order=False).show() tournament_players = [] while len(tournament_players) < Tournament.NUMBER_OF_PLAYERS: mc.ControllerCommandInterpreter( "(X) Choisir un joueur par son numéro", { str(i + 1): ControllerAddPlayer(tournament_players, self.player_database[i]) for i in range(len(self.player_database)) }).run() return tournament_players
def run(self): view = ViewDatabase(self.player_database, self.title, 'last_name', 'first_name', 'date_of_birth', 'sex', 'ranking', headers=[ "Nom de famille", "Prénom", "Date de naissance", "Sexe", "Classement" ], selection_mode=True, sort_by_attribute=self.sort_by_attribute, sort_order=self.sort_order) view.show() commands = { str(i + 1): ControllerPlayerReport(self.player_database[i], self.player_database) for i in range(len(self.player_database)) } commands.update({ 'n': ControllerPlayerDatabase(self.player_database, sort_by_attribute="last_name", title=self.title), 'c': ControllerPlayerDatabase(self.player_database, sort_by_attribute="ranking", sort_order=True, title=self.title) }) mc.ControllerCommandInterpreter( "(n) Trier par nom de famille\n" "(c) Trier par classement\n" "(X) Afficher le joueur numéro X", commands).run()