dev_gui #33
14
gui/league_statistic_visitor_gui.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from nicegui import ui, app
|
||||
from gui import gui_style
|
||||
from data import data_api
|
||||
from gui.info_text import info_system
|
||||
|
||||
def setup_routes():
|
||||
@ui.page('/statistic/visitor/{systemname}', dark=True)
|
||||
def gamesystem_statistic_visitor_page(systemname: str):
|
||||
|
||||
if not app.storage.user.get('authenticated', False):
|
||||
ui.navigate.to('/')
|
||||
return
|
||||
|
||||
gui_style.apply_design()
|
||||
|
|
@ -33,19 +33,12 @@ def setup_routes():
|
|||
raw_players = data_api.get_all_players_from_system(system_name)
|
||||
my_id = app.storage.user.get('db_id')
|
||||
|
||||
def add_point():
|
||||
p1_points.value += 1
|
||||
|
||||
def sub_point():
|
||||
p1_points.value -= 1
|
||||
|
||||
with ui.row().classes("w-full items-center justify-between"):
|
||||
p1_points = ui.slider(min=min_score, max=max_score, value=10).classes("w-35")
|
||||
with ui.column().classes("items-center justify-between"):
|
||||
# Punkte Up- Down- Buttons. und Textanzeige
|
||||
ui.button(icon="expand_less", on_click=add_point)
|
||||
ui.label().bind_text_from(p1_points, 'value').classes("text-lg text-normaltext")
|
||||
ui.button(icon="expand_more", on_click=sub_point)
|
||||
with ui.column().classes("items-center justify-between"):
|
||||
p1_points = ui.number(placeholder="Punkte eingeben",
|
||||
min=system_data["min_score"],
|
||||
max=system_data["max_score"],
|
||||
precision=0
|
||||
).classes("w-35").props("clearable")
|
||||
|
||||
with ui.card().classes('w-full max-w-md mx-auto items-center mt-10 p-6'):
|
||||
dropdown_options = {}
|
||||
|
|
@ -56,36 +49,39 @@ def setup_routes():
|
|||
|
||||
opponent_select = ui.select(options=dropdown_options, label='Gegner auswählen').classes('w-full')
|
||||
|
||||
def add_point():
|
||||
p2_points.value += 1
|
||||
|
||||
def sub_point():
|
||||
p2_points.value -= 1
|
||||
|
||||
with ui.row().classes("w-full items-center justify-between"):
|
||||
p2_points = ui.slider(min=min_score, max=max_score, value=10).classes("w-35")
|
||||
with ui.column().classes("items-center justify-between"):
|
||||
# Punkte Up- Down- Buttons. und Textanzeige
|
||||
ui.button(icon="expand_less", on_click=add_point)
|
||||
ui.label().bind_text_from(p2_points, 'value').classes("text-lg text-normaltext")
|
||||
ui.button(icon="expand_more", on_click=sub_point)
|
||||
with ui.column().classes("items-center justify-between"):
|
||||
p2_points = ui.number(placeholder="Punkte eingeben",
|
||||
min=system_data["min_score"],
|
||||
max=system_data["max_score"],
|
||||
precision=0
|
||||
).classes("w-35").props("clearable")
|
||||
|
||||
|
||||
|
||||
# Das Match in die Datenbank eintragen lassen und die MMR Berechnung triggern.
|
||||
# Das Match in die Datenbank eintragen lassen.
|
||||
def input_match_to_database():
|
||||
p2_id = opponent_select.value
|
||||
score_p1 = p1_points.value
|
||||
score_p2 = p2_points.value
|
||||
|
||||
|
||||
# Check der Eingegebenen Daten.
|
||||
# Fehler wenn kein Spieler oder keine Punkte eingegeben werden. Das Punkte Eingabefeld fängt mit min_score und max_score ab,
|
||||
# ob für das Spielsystem legale Punkte eingetragen wurden.
|
||||
if p2_id is None:
|
||||
ui.notify("Bitte wähle zuerst einen Gegner aus!", color="red", position="top")
|
||||
return
|
||||
|
||||
score_p1 = p1_points.value
|
||||
score_p2 = p2_points.value
|
||||
if score_p1 is None:
|
||||
ui.notify("Ungültige Punkteeingabe Spieler 1!", color="red", position="top")
|
||||
return
|
||||
|
||||
if score_p2 is None:
|
||||
ui.notify("Ungültige Punkteeingabe Spieler 2!", color="red", position="top")
|
||||
return
|
||||
|
||||
match_id = data_api.add_new_match(system_name, my_id, p2_id, score_p1, score_p2)
|
||||
|
||||
# 4. Erfolgsmeldung und Berechnung
|
||||
ui.notify("Match erfolgreich eingetragen!", color="green")
|
||||
ui.navigate.to(f'/statistic/{system_name}')
|
||||
|
||||
# Buttons ganz unten in einer Reihe
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
BIN
gui/pictures/achievments/AchievementIcon_4_1Sieg.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
gui/pictures/achievments/AchievementIcon_5_5Sieg.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
gui/pictures/achievments/AchievementIcon_6_10Sieg.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
5
main.py
|
|
@ -3,7 +3,7 @@ from dotenv import load_dotenv
|
|||
from nicegui import ui, app
|
||||
|
||||
from data import database
|
||||
from gui import main_gui, match_gui, discord_login, league_statistic_gui, admin_gui, match_history_gui, imprint_gui
|
||||
from gui import main_gui, match_gui, discord_login, league_statistic_gui, admin_gui, match_history_gui, imprint_gui, league_statistic_visitor_gui
|
||||
from wood import logger
|
||||
from gui.info_text import info_system
|
||||
|
||||
|
|
@ -33,6 +33,7 @@ match_gui.setup_routes()
|
|||
admin_gui.setup_routes()
|
||||
match_history_gui.setup_routes()
|
||||
imprint_gui.setup_routes()
|
||||
league_statistic_visitor_gui.setup_routes()
|
||||
|
||||
# 4. Wir starten die NiceGUI App
|
||||
# 4. Starten der App Runtime auf dem Server.
|
||||
ui.run(title="Westside Diceghost Liga", port=9000, storage_secret="EIN_super-geheimes_Pa$$wort#!", favicon="gui/pictures/wsdg.png")
|
||||
|
|
|
|||