diff --git a/src/ez_lan_manager/components/LoginBox.py b/src/ez_lan_manager/components/LoginBox.py index b397b6b..6dceaa4 100644 --- a/src/ez_lan_manager/components/LoginBox.py +++ b/src/ez_lan_manager/components/LoginBox.py @@ -9,7 +9,6 @@ from src.ez_lan_manager.types.User import User class LoginBox(Component): status_change_cb: EventHandler = None - TEXT_STYLE = TextStyle(fill=Color.from_hex("02dac5"), font_size=0.9) user_name_input_text: str = "" password_input_text: str = "" user_name_input_is_valid = True @@ -57,7 +56,7 @@ class LoginBox(Component): is_valid=self.password_input_is_valid ) login_button = Button( - Text("LOGIN", style=self.TEXT_STYLE, justify="center"), + Text("LOGIN", fill=Color.from_hex("02dac5"), style=TextStyle(font_size=0.9), justify="center"), shape="rectangle", style="minor", color="secondary", @@ -65,14 +64,14 @@ class LoginBox(Component): on_press=self._on_login_pressed ) register_button = Button( - Text("REG", style=self.TEXT_STYLE, justify="center"), + Text("REG", fill=Color.from_hex("02dac5"), style=TextStyle(font_size=0.9), justify="center"), shape="rectangle", style="minor", color="secondary", on_press=lambda: self.session.navigate_to("./register") ) forgot_password_button = Button( - Text("LST PWD", style=self.TEXT_STYLE, justify="center"), + Text("LST PWD", fill=Color.from_hex("02dac5"), style=TextStyle(font_size=0.9), justify="center"), shape="rectangle", style="minor", color="secondary", @@ -95,7 +94,7 @@ class LoginBox(Component): ), margin_bottom=0.5 ), - Text(text="Dieses Konto\nist gesperrt", style=TextStyle(fill=self.session.theme.danger_color, font_size=0.9 if self.is_account_locked else 0), align_x=0.5), + Text(text="Dieses Konto\nist gesperrt", fill=self.session.theme.danger_color, style=TextStyle(font_size=0.9 if self.is_account_locked else 0), align_x=0.5), spacing=0.4 ), fill=Color.TRANSPARENT, diff --git a/src/ez_lan_manager/components/NewsPost.py b/src/ez_lan_manager/components/NewsPost.py index 7d814bd..fe92888 100644 --- a/src/ez_lan_manager/components/NewsPost.py +++ b/src/ez_lan_manager/components/NewsPost.py @@ -21,8 +21,8 @@ class NewsPost(Component): grow_x=True, margin=2, margin_bottom=0, + fill=self.session.theme.background_color, style=TextStyle( - fill=self.session.theme.background_color, font_size=1.3 ), overflow="ellipsize" @@ -31,8 +31,8 @@ class NewsPost(Component): self.date, margin=2, align_x=1, + fill=self.session.theme.background_color, style=TextStyle( - fill=self.session.theme.background_color, font_size=0.6 ), overflow="wrap" @@ -44,8 +44,8 @@ class NewsPost(Component): margin=2, margin_top=0, margin_bottom=0, + fill=self.session.theme.background_color, style=TextStyle( - fill=self.session.theme.background_color, font_size=0.8 ), overflow="ellipsize" @@ -53,9 +53,7 @@ class NewsPost(Component): Text( self.text, margin=2, - style=TextStyle( - fill=self.session.theme.background_color - ), + fill=self.session.theme.background_color, overflow="wrap" ), Text( @@ -65,8 +63,8 @@ class NewsPost(Component): margin=2, margin_top=0, margin_bottom=1, + fill=self.session.theme.background_color, style=TextStyle( - fill=self.session.theme.background_color, font_size=0.5, italic=True ), diff --git a/src/ez_lan_manager/pages/BasePage.py b/src/ez_lan_manager/pages/BasePage.py index e5af87d..82add88 100644 --- a/src/ez_lan_manager/pages/BasePage.py +++ b/src/ez_lan_manager/pages/BasePage.py @@ -2,7 +2,7 @@ from __future__ import annotations from typing import * # type: ignore -from rio import Component, event, Spacer, Card, Container, Column, Row, TextStyle, Color, Text, PageView +from rio import Component, event, Spacer, Card, Container, Column, Row, TextStyle, Color, Text, PageView, Button from src.ez_lan_manager import ConfigurationService, DatabaseService from src.ez_lan_manager.components.DesktopNavigation import DesktopNavigation @@ -11,6 +11,7 @@ class BasePage(Component): color = "secondary" corner_radius = (0, 0.5, 0, 0) footer_size = 53.1 + force_portrait_mode = False @event.periodic(60) async def check_db_conn(self) -> None: @@ -32,6 +33,10 @@ class BasePage(Component): self.footer_size = 53.1 self.force_refresh() + def enforce_portrait_mode(self) -> None: + self.force_portrait_mode = True + self.force_refresh() + def build(self) -> Component: content = Card( PageView(), @@ -39,7 +44,7 @@ class BasePage(Component): min_width=38, corner_radius=(0, 0.5, 0, 0) ) - if self.session.window_width > 28: + if self.session.window_width > 28 or self.force_portrait_mode: return Container( content=Column( Column( @@ -53,7 +58,7 @@ class BasePage(Component): Row( Spacer(grow_x=True, grow_y=False), Card( - 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)), + content=Text(f"EZ LAN Manager Version {self.session[ConfigurationService].APP_VERSION} © EZ GG e.V.", align_x=0.5, align_y=0.5, fill=self.session.theme.primary_color, style=TextStyle(font_size=0.5)), color=self.session.theme.neutral_color, corner_radius=(0, 0, 0.5, 0.5), grow_x=False, @@ -72,10 +77,21 @@ class BasePage(Component): grow_y=True ) else: - return Text( - "Der EZ LAN Manager wird\nauf mobilen Endgeräten nur\nim Querformat unterstützt.\nBitte drehe dein Gerät.", - align_x=0.5, - align_y=0.5, - style=TextStyle(fill=Color.from_hex("FFFFFF"), font_size=0.8) + return Column( + Text( + "Wir empfehlen auf\nmobilen Endgeräten im\nQuerformat zu arbeiten.\n\nBitte drehe dein Gerät.", + fill=Color.from_hex("FFFFFF"), + align_x=0.5, + align_y=0.5, + style=TextStyle(font_size=0.8) + ), + Button( + content=Text("Ohne drehen fortfahren", margin=0.2), + style="minor", + shape="rounded", + align_x=0.5, + align_y=0, + on_press=self.enforce_portrait_mode + ) ) diff --git a/src/ez_lan_manager/pages/ManageNewsPage.py b/src/ez_lan_manager/pages/ManageNewsPage.py index aa41017..d8d8886 100644 --- a/src/ez_lan_manager/pages/ManageNewsPage.py +++ b/src/ez_lan_manager/pages/ManageNewsPage.py @@ -78,8 +78,8 @@ class ManageNewsPage(Component): Column( Text( text="News Verwaltung", + fill=self.session.theme.background_color, style=TextStyle( - fill=self.session.theme.background_color, font_size=1.2 ), margin_top=2, @@ -88,8 +88,8 @@ class ManageNewsPage(Component): ), Text( text="Neuen News Post erstellen", + fill=self.session.theme.background_color, style=TextStyle( - fill=self.session.theme.background_color, font_size=1.1 ), margin_top=2, @@ -106,8 +106,8 @@ class ManageNewsPage(Component): ), Text( text="Post erfolgreich erstellt", + fill=self.session.theme.success_color, style=TextStyle( - fill=self.session.theme.success_color, font_size=0.7 if self.show_success_message else 0 ), margin_top=0.1, @@ -116,8 +116,8 @@ class ManageNewsPage(Component): ), Text( text="Bisherige Posts", + fill=self.session.theme.background_color, style=TextStyle( - fill=self.session.theme.background_color, font_size=1.1 ), margin_top=2, diff --git a/src/ez_lan_manager/services/DatabaseService.py b/src/ez_lan_manager/services/DatabaseService.py index 7f6c532..e155fe2 100644 --- a/src/ez_lan_manager/services/DatabaseService.py +++ b/src/ez_lan_manager/services/DatabaseService.py @@ -232,7 +232,6 @@ class DatabaseService: except aiomysql.InterfaceError: pool_init_result = await self.init_db_pool() if not pool_init_result: - print(self._connection_pool) raise NoDatabaseConnectionError return await self.get_news(dt_start, dt_end) except Exception as e: