Forgor.
This commit is contained in:
26
webui.py
26
webui.py
@@ -1,17 +1,23 @@
|
|||||||
from nicegui import ui
|
from nicegui import ui
|
||||||
from bot_instance import bot
|
from bot_instance import bot
|
||||||
|
|
||||||
# reminder:
|
|
||||||
# tracked_games etc erst in andere variable kopieren und lock benutzen.
|
|
||||||
|
|
||||||
|
|
||||||
def create_ui():
|
def create_ui():
|
||||||
ui.label("Amogus")
|
pages = ui.sub_pages()
|
||||||
|
|
||||||
with bot.tracked_games_lock:
|
|
||||||
games = list(bot.tracked_games)
|
|
||||||
rows = []
|
rows = []
|
||||||
for game in games:
|
for game in bot.tracked_games:
|
||||||
rows.append({"Name": game.name})
|
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