Forgor.
This commit is contained in:
26
webui.py
26
webui.py
@@ -1,17 +1,23 @@
|
||||
from nicegui import ui
|
||||
from bot_instance import bot
|
||||
|
||||
# reminder:
|
||||
# tracked_games etc erst in andere variable kopieren und lock benutzen.
|
||||
|
||||
|
||||
def create_ui():
|
||||
ui.label("Amogus")
|
||||
|
||||
with bot.tracked_games_lock:
|
||||
games = list(bot.tracked_games)
|
||||
pages = ui.sub_pages()
|
||||
rows = []
|
||||
for game in games:
|
||||
rows.append({"Name": game.name})
|
||||
for game in bot.tracked_games:
|
||||
pages.add(f"/{game.name}", lambda name=game.name: sub_page(name))
|
||||
rows.append({"Name": game.name, "Turn": game.turn})
|
||||
|
||||
ui.table(rows=rows)
|
||||
pages.add("/", lambda: main_page(rows))
|
||||
|
||||
ui.run(reload=False)
|
||||
|
||||
|
||||
def main_page(rows):
|
||||
ui.label("test")
|
||||
ui.table(rows=rows, title="Currently Running Games")
|
||||
|
||||
|
||||
def sub_page(name: str):
|
||||
ui.label(name)
|
||||
|
||||
Reference in New Issue
Block a user