refactor with MVC folder; tests in vrac.py for now

This commit is contained in:
2025-01-30 17:14:46 +01:00
parent 78cdc9028e
commit 471b2c9692
24 changed files with 467 additions and 70 deletions

Binary file not shown.

9
views/base.py Normal file
View File

@@ -0,0 +1,9 @@
class View:
"""Prompt menu, get choices"""
def __init__(self):
pass
def prompt_for_scores(self):
print()
input("Saisir les scores ?")
return True

33
views/menu.py Normal file
View File

@@ -0,0 +1,33 @@
class Menu:
def __init__(self):
self.ITEMS = [
"[1] Créer un nouveau tournoi",
"[2] Enregistrer un nouveau joueur",
"[3] Rapports",
"[4] Quitter"
]
self.RAPPORTS = [
"[1] Afficher la liste des joueurs",
"[2] Afficher l'historique des tournois",
"[3] Afficher le détail d'un tournoi",
"[4] Quitter"
]
def items(self, value):
menu_type = []
if value == 1:
menu_type = self.ITEMS
if value == 2:
menu_type = self.RAPPORTS
for i in menu_type:
print(i)
try:
demande = input("Choix ? : ")
if demande not in range(1, len(menu_type)):
demande = input("Choix ? : ")
except ValueError:
print("Veuillez saisir un chiffre")
demande = input("Choix ? : ")
return demande