From 33d937d3850cbd39f1049f7f5183168ad2201216 Mon Sep 17 00:00:00 2001 From: David Rodenkirchen Date: Sat, 30 May 2026 23:12:39 +0200 Subject: [PATCH] add lan info location --- config.example.toml | 2 ++ src/elm/components/LanInfoBox.py | 4 +++- src/elm/services/ConfigurationService.py | 4 +++- src/elm/types/ConfigurationTypes.py | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config.example.toml b/config.example.toml index 5a28413..8a449b0 100644 --- a/config.example.toml +++ b/config.example.toml @@ -9,6 +9,8 @@ has_showers=false ts3_address="" discord_invite_link="" + location_name="" + location_link="" [database] database_host="localhost" diff --git a/src/elm/components/LanInfoBox.py b/src/elm/components/LanInfoBox.py index 041f13d..e9b7e7c 100644 --- a/src/elm/components/LanInfoBox.py +++ b/src/elm/components/LanInfoBox.py @@ -1,4 +1,4 @@ -from rio import Component, Rectangle, Row, Text, Spacer, ProgressBar, Column, Color, TextStyle +from rio import Component, Rectangle, Row, Text, Spacer, ProgressBar, Column, Color, TextStyle, Link from rio.event import on_populate from elm.services import ConfigurationService @@ -36,6 +36,7 @@ class LanInfoBox(Component): stroke_color=self.session.theme.box_border_color, ), Column( + Row(Text("Location:", font_size=0.7), Spacer(), Link(Text(lan_info.location_name, fill=self.session.theme.primary_color, font_size=0.8, overflow="nowrap"), target_url=lan_info.location_link)), Row(Text("Start:", font_size=0.7), Spacer(), Text(lan_info.date_from.strftime("%d.%m.%Y"), fill=self.session.theme.primary_color, font_size=0.8, overflow="nowrap")), Row(Text("Ende:", font_size=0.7), Spacer(), Text(lan_info.date_till.strftime("%d.%m.%Y"), fill=self.session.theme.primary_color, font_size=0.8, overflow="nowrap")), Row(Text("Einlass:", font_size=0.7), Spacer(), Text(lan_info.date_from.strftime("%H:%M Uhr"), fill=self.session.theme.primary_color, font_size=0.8, overflow="nowrap")), @@ -81,6 +82,7 @@ class LanInfoBox(Component): stroke_color=self.session.theme.box_border_color, ), Column( + Row(Text("Location:", font_size=0.9), Spacer(), Link(Text(lan_info.location_name, fill=self.session.theme.primary_color, font_size=0.9, overflow="nowrap"), target_url=lan_info.location_link)), Row(Text("Start:", font_size=0.9), Spacer(), Text(lan_info.date_from.strftime("%d.%m.%Y"), fill=self.session.theme.primary_color, font_size=0.9, overflow="nowrap")), Row(Text("Ende:", font_size=0.9), Spacer(), Text(lan_info.date_till.strftime("%d.%m.%Y"), fill=self.session.theme.primary_color, font_size=0.9, overflow="nowrap")), Row(Text("Einlass:", font_size=0.9), Spacer(), Text(lan_info.date_from.strftime("%H:%M Uhr"), fill=self.session.theme.primary_color, font_size=0.9, overflow="nowrap")), diff --git a/src/elm/services/ConfigurationService.py b/src/elm/services/ConfigurationService.py index e9cbd86..1f844ec 100644 --- a/src/elm/services/ConfigurationService.py +++ b/src/elm/services/ConfigurationService.py @@ -103,7 +103,9 @@ class ConfigurationService: has_wifi=lan_info["has_wifi"], has_showers=lan_info["has_showers"], ts3_address=lan_info["ts3_address"], - discord_invite_link=lan_info["discord_invite_link"] + discord_invite_link=lan_info["discord_invite_link"], + location_name=lan_info["location_name"], + location_link=lan_info["location_link"] ) except KeyError: logger.fatal("Error loading LAN Info, exiting...") diff --git a/src/elm/types/ConfigurationTypes.py b/src/elm/types/ConfigurationTypes.py index 7a505d3..5ad1302 100644 --- a/src/elm/types/ConfigurationTypes.py +++ b/src/elm/types/ConfigurationTypes.py @@ -34,6 +34,8 @@ class LanInfo: has_showers: bool ts3_address: str discord_invite_link: str + location_name: str + location_link: str @dataclass(frozen=True)