Added more experimental ui stuff and renamed ui.py to webui.py.
This commit is contained in:
4
main.py
4
main.py
@@ -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:
|
||||
|
||||
17
webui.py
Normal file
17
webui.py
Normal 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)
|
||||
Reference in New Issue
Block a user