Added more experimental ui stuff and renamed ui.py to webui.py.

This commit is contained in:
2026-04-09 12:24:41 +02:00
parent 1980716d3b
commit d74534965c
3 changed files with 27 additions and 13 deletions

View File

@@ -5,7 +5,7 @@ from dotenv import load_dotenv
from dom5game import Dom5game
from servermanager import create_server
from nicegui import ui
from ui import create_ui
from webui import create_ui
import threading
@@ -15,9 +15,11 @@ load_dotenv()
TOKEN = os.getenv("TOKEN")
bot.tracked_games = []
bot.tracked_games_lock = threading.Lock()
def reload_games():
with bot.tracked_games_lock:
bot.tracked_games = []
for _, _, files in os.walk("games"):
for name in files:

5
ui.py
View File

@@ -1,5 +0,0 @@
from nicegui import ui
def create_ui():
ui.label("Amogus")

17
webui.py Normal file
View File

@@ -0,0 +1,17 @@
from nicegui import ui
from main 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)
rows = []
for game in games:
rows.append({"Name": game.name})
ui.table(rows=rows)