diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8a9ecc2 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.1 \ No newline at end of file diff --git a/src/ez_lan_manager/pages/BasePage.py b/src/ez_lan_manager/pages/BasePage.py index 48332b1..f90f519 100644 --- a/src/ez_lan_manager/pages/BasePage.py +++ b/src/ez_lan_manager/pages/BasePage.py @@ -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, diff --git a/src/ez_lan_manager/services/ConfigurationService.py b/src/ez_lan_manager/services/ConfigurationService.py index e740fd5..f379680 100644 --- a/src/ez_lan_manager/services/ConfigurationService.py +++ b/src/ez_lan_manager/services/ConfigurationService.py @@ -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