add dynamic verison file
This commit is contained in:
parent
fe5566749d
commit
7be5dc6a9b
@ -4,6 +4,7 @@ from typing import * # type: ignore
|
||||
|
||||
from rio import Component, event, Spacer, Card, Container, Column, Row, Rectangle, TextStyle, Color, Text
|
||||
|
||||
from src.ez_lan_manager import ConfigurationService
|
||||
from src.ez_lan_manager.components.DesktopNavigation import DesktopNavigation
|
||||
|
||||
class BasePage(Component):
|
||||
@ -38,7 +39,7 @@ class BasePage(Component):
|
||||
Row(
|
||||
Spacer(grow_x=True, grow_y=False),
|
||||
Card(
|
||||
content=Text("EZ LAN Manager Version 0.0.1 © EZ GG e.V.", align_x=0.5, align_y=0.5, style=TextStyle(fill=self.session.theme.primary_color, font_size=0.5)),
|
||||
content=Text(f"EZ LAN Manager Version {self.session[ConfigurationService].APP_VERSION} © EZ GG e.V.", align_x=0.5, align_y=0.5, style=TextStyle(fill=self.session.theme.primary_color, font_size=0.5)),
|
||||
color=self.session.theme.neutral_color,
|
||||
corner_radius=(0, 0, 0.5, 0.5),
|
||||
grow_x=False,
|
||||
|
||||
@ -12,6 +12,13 @@ logger = logging.getLogger(__name__.split(".")[-1])
|
||||
|
||||
class ConfigurationService:
|
||||
def __init__(self, config_file_path: Path) -> None:
|
||||
try:
|
||||
with open(from_root("VERSION"), "r") as version_file:
|
||||
self._version = version_file.read().strip()
|
||||
except FileNotFoundError:
|
||||
logger.warning("Could not find VERSION file, defaulting to '0.0.0'")
|
||||
self._version = "0.0.0"
|
||||
|
||||
try:
|
||||
with open(config_file_path, "rb") as config_file:
|
||||
self._config = tomllib.load(config_file)
|
||||
@ -81,3 +88,7 @@ class ConfigurationService:
|
||||
except KeyError:
|
||||
logger.fatal("Error loading seating configuration, exiting...")
|
||||
sys.exit(1)
|
||||
|
||||
@property
|
||||
def APP_VERSION(self) -> str:
|
||||
return self._version
|
||||
|
||||
Loading…
Reference in New Issue
Block a user