2 Commits

Author SHA1 Message Date
David Rodenkirchen e92dc25ade wip / do not merge 2026-04-16 07:26:50 +02:00
David Rodenkirchen e0ed3c7059 update sanitized backup 2026-04-16 07:07:00 +02:00
7 changed files with 884 additions and 605 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4 -47
View File
@@ -1,15 +1,9 @@
import logging
import tracemalloc
import sys
from pathlib import Path
from uuid import uuid4
import gc
import time
import threading
from collections import Counter
from datetime import datetime, UTC
from rio import App, Theme, Color, Font, ComponentPage, Session
from from_root import from_root
@@ -19,49 +13,9 @@ from src.ezgg_lan_manager.helpers.LoggedInGuard import logged_in_guard, not_logg
from src.ezgg_lan_manager.services.LocalDataService import LocalData
from src.ezgg_lan_manager.types.UserSession import UserSession
tracemalloc.start(25)
logger = logging.getLogger("EzggLanManager")
def log_object_summary():
gc.collect()
objs = gc.get_objects()
counter = Counter(type(obj).__name__ for obj in objs)
timestamp = datetime.now(UTC).isoformat()
with open("memory_objects.log", "a") as f:
f.write(f"\n=== {timestamp} ===\n")
f.write(f"Total objects: {len(objs)}\n")
for name, count in counter.most_common(25):
f.write(f"{name}: {count}\n")
def log_top_allocations():
snapshot = tracemalloc.take_snapshot()
top_stats = snapshot.statistics('lineno')
timestamp = datetime.now(UTC).isoformat()
with open("memory_allocations.log", "a") as f:
f.write(f"\n=== {timestamp} ===\n")
for stat in top_stats[:10]:
f.write(str(stat) + "\n")
def start_hourly_logger():
def loop():
while True:
log_object_summary()
log_top_allocations()
time.sleep(3) # 1 hour
t = threading.Thread(target=loop, daemon=True)
t.start()
if __name__ == "__main__":
start_hourly_logger()
theme = Theme.from_colors(
primary_color=Color.from_hex("ffffff"),
secondary_color=Color.from_hex("018786"),
@@ -73,7 +27,10 @@ if __name__ == "__main__":
corner_radius_small=0,
corner_radius_medium=0,
corner_radius_large=0,
font=Font(from_root("src/ezgg_lan_manager/assets/fonts/joystix.otf"))
font=Font(
regular=from_root("src/ezgg_lan_manager/assets/fonts/PixelOperatorMono.ttf"),
bold=from_root("src/ezgg_lan_manager/assets/fonts/PixelOperatorMono-Bold.ttf"),
)
)
default_attachments: list = [LocalData(stored_session_token=None)]
default_attachments.extend(init_services())
@@ -47,8 +47,8 @@ class DesktopNavigation(Component):
return Card(
Column(
Text(lan_info.name, align_x=0.5, margin_top=0.3, style=TextStyle(fill=self.session.theme.hud_color, font_size=1.9)),
Text(f"Edition {lan_info.iteration}", align_x=0.5, style=TextStyle(fill=self.session.theme.hud_color, font_size=1.2), margin_top=0.3, margin_bottom=2),
Text(lan_info.name, align_x=0.5, margin_top=0.3, style=TextStyle(fill=self.session.theme.hud_color, font_size=2.5), font_weight="bold"),
Text(f"Edition {lan_info.iteration}", align_x=0.5, style=TextStyle(fill=self.session.theme.hud_color, font_size=1.6), margin_top=0.3, margin_bottom=2, font_weight="bold"),
user_info_and_login_box,
*navigation,
Text("Unsere Sponsoren", align_x=0.5, style=TextStyle(fill=self.session.theme.hud_color, font_size=0.9), margin_bottom=0.5, margin_top=1),
@@ -1,7 +1,7 @@
from rio import Component, TextStyle, Color, Link, Button, Text
class DesktopNavigationButton(Component):
STYLE = TextStyle(fill=Color.from_hex("02dac5"), font_size=0.9)
STYLE = TextStyle(fill=Color.from_hex("02dac5"), font_size=1.2, font_weight="bold")
TEAM_STYLE = TextStyle(fill=Color.from_hex("F0EADE"), font_size=0.9)
label: str
target_url: str