refactor with MVC folder; tests in vrac.py for now
This commit is contained in:
BIN
views/__pycache__/base.cpython-310.pyc
Normal file
BIN
views/__pycache__/base.cpython-310.pyc
Normal file
Binary file not shown.
9
views/base.py
Normal file
9
views/base.py
Normal 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
33
views/menu.py
Normal 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
|
||||
Reference in New Issue
Block a user