make portrait mode optional
This commit is contained in:
parent
4018502a63
commit
530efcd286
@ -9,7 +9,6 @@ from src.ez_lan_manager.types.User import User
|
|||||||
|
|
||||||
class LoginBox(Component):
|
class LoginBox(Component):
|
||||||
status_change_cb: EventHandler = None
|
status_change_cb: EventHandler = None
|
||||||
TEXT_STYLE = TextStyle(fill=Color.from_hex("02dac5"), font_size=0.9)
|
|
||||||
user_name_input_text: str = ""
|
user_name_input_text: str = ""
|
||||||
password_input_text: str = ""
|
password_input_text: str = ""
|
||||||
user_name_input_is_valid = True
|
user_name_input_is_valid = True
|
||||||
@ -57,7 +56,7 @@ class LoginBox(Component):
|
|||||||
is_valid=self.password_input_is_valid
|
is_valid=self.password_input_is_valid
|
||||||
)
|
)
|
||||||
login_button = Button(
|
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",
|
shape="rectangle",
|
||||||
style="minor",
|
style="minor",
|
||||||
color="secondary",
|
color="secondary",
|
||||||
@ -65,14 +64,14 @@ class LoginBox(Component):
|
|||||||
on_press=self._on_login_pressed
|
on_press=self._on_login_pressed
|
||||||
)
|
)
|
||||||
register_button = Button(
|
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",
|
shape="rectangle",
|
||||||
style="minor",
|
style="minor",
|
||||||
color="secondary",
|
color="secondary",
|
||||||
on_press=lambda: self.session.navigate_to("./register")
|
on_press=lambda: self.session.navigate_to("./register")
|
||||||
)
|
)
|
||||||
forgot_password_button = Button(
|
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",
|
shape="rectangle",
|
||||||
style="minor",
|
style="minor",
|
||||||
color="secondary",
|
color="secondary",
|
||||||
@ -95,7 +94,7 @@ class LoginBox(Component):
|
|||||||
),
|
),
|
||||||
margin_bottom=0.5
|
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
|
spacing=0.4
|
||||||
),
|
),
|
||||||
fill=Color.TRANSPARENT,
|
fill=Color.TRANSPARENT,
|
||||||
|
|||||||
@ -21,8 +21,8 @@ class NewsPost(Component):
|
|||||||
grow_x=True,
|
grow_x=True,
|
||||||
margin=2,
|
margin=2,
|
||||||
margin_bottom=0,
|
margin_bottom=0,
|
||||||
|
fill=self.session.theme.background_color,
|
||||||
style=TextStyle(
|
style=TextStyle(
|
||||||
fill=self.session.theme.background_color,
|
|
||||||
font_size=1.3
|
font_size=1.3
|
||||||
),
|
),
|
||||||
overflow="ellipsize"
|
overflow="ellipsize"
|
||||||
@ -31,8 +31,8 @@ class NewsPost(Component):
|
|||||||
self.date,
|
self.date,
|
||||||
margin=2,
|
margin=2,
|
||||||
align_x=1,
|
align_x=1,
|
||||||
|
fill=self.session.theme.background_color,
|
||||||
style=TextStyle(
|
style=TextStyle(
|
||||||
fill=self.session.theme.background_color,
|
|
||||||
font_size=0.6
|
font_size=0.6
|
||||||
),
|
),
|
||||||
overflow="wrap"
|
overflow="wrap"
|
||||||
@ -44,8 +44,8 @@ class NewsPost(Component):
|
|||||||
margin=2,
|
margin=2,
|
||||||
margin_top=0,
|
margin_top=0,
|
||||||
margin_bottom=0,
|
margin_bottom=0,
|
||||||
|
fill=self.session.theme.background_color,
|
||||||
style=TextStyle(
|
style=TextStyle(
|
||||||
fill=self.session.theme.background_color,
|
|
||||||
font_size=0.8
|
font_size=0.8
|
||||||
),
|
),
|
||||||
overflow="ellipsize"
|
overflow="ellipsize"
|
||||||
@ -53,9 +53,7 @@ class NewsPost(Component):
|
|||||||
Text(
|
Text(
|
||||||
self.text,
|
self.text,
|
||||||
margin=2,
|
margin=2,
|
||||||
style=TextStyle(
|
fill=self.session.theme.background_color,
|
||||||
fill=self.session.theme.background_color
|
|
||||||
),
|
|
||||||
overflow="wrap"
|
overflow="wrap"
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
@ -65,8 +63,8 @@ class NewsPost(Component):
|
|||||||
margin=2,
|
margin=2,
|
||||||
margin_top=0,
|
margin_top=0,
|
||||||
margin_bottom=1,
|
margin_bottom=1,
|
||||||
|
fill=self.session.theme.background_color,
|
||||||
style=TextStyle(
|
style=TextStyle(
|
||||||
fill=self.session.theme.background_color,
|
|
||||||
font_size=0.5,
|
font_size=0.5,
|
||||||
italic=True
|
italic=True
|
||||||
),
|
),
|
||||||
|
|||||||
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import * # type: ignore
|
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 import ConfigurationService, DatabaseService
|
||||||
from src.ez_lan_manager.components.DesktopNavigation import DesktopNavigation
|
from src.ez_lan_manager.components.DesktopNavigation import DesktopNavigation
|
||||||
@ -11,6 +11,7 @@ class BasePage(Component):
|
|||||||
color = "secondary"
|
color = "secondary"
|
||||||
corner_radius = (0, 0.5, 0, 0)
|
corner_radius = (0, 0.5, 0, 0)
|
||||||
footer_size = 53.1
|
footer_size = 53.1
|
||||||
|
force_portrait_mode = False
|
||||||
|
|
||||||
@event.periodic(60)
|
@event.periodic(60)
|
||||||
async def check_db_conn(self) -> None:
|
async def check_db_conn(self) -> None:
|
||||||
@ -32,6 +33,10 @@ class BasePage(Component):
|
|||||||
self.footer_size = 53.1
|
self.footer_size = 53.1
|
||||||
self.force_refresh()
|
self.force_refresh()
|
||||||
|
|
||||||
|
def enforce_portrait_mode(self) -> None:
|
||||||
|
self.force_portrait_mode = True
|
||||||
|
self.force_refresh()
|
||||||
|
|
||||||
def build(self) -> Component:
|
def build(self) -> Component:
|
||||||
content = Card(
|
content = Card(
|
||||||
PageView(),
|
PageView(),
|
||||||
@ -39,7 +44,7 @@ class BasePage(Component):
|
|||||||
min_width=38,
|
min_width=38,
|
||||||
corner_radius=(0, 0.5, 0, 0)
|
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(
|
return Container(
|
||||||
content=Column(
|
content=Column(
|
||||||
Column(
|
Column(
|
||||||
@ -53,7 +58,7 @@ class BasePage(Component):
|
|||||||
Row(
|
Row(
|
||||||
Spacer(grow_x=True, grow_y=False),
|
Spacer(grow_x=True, grow_y=False),
|
||||||
Card(
|
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,
|
color=self.session.theme.neutral_color,
|
||||||
corner_radius=(0, 0, 0.5, 0.5),
|
corner_radius=(0, 0, 0.5, 0.5),
|
||||||
grow_x=False,
|
grow_x=False,
|
||||||
@ -72,10 +77,21 @@ class BasePage(Component):
|
|||||||
grow_y=True
|
grow_y=True
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return Text(
|
return Column(
|
||||||
"Der EZ LAN Manager wird\nauf mobilen Endgeräten nur\nim Querformat unterstützt.\nBitte drehe dein Gerät.",
|
Text(
|
||||||
align_x=0.5,
|
"Wir empfehlen auf\nmobilen Endgeräten im\nQuerformat zu arbeiten.\n\nBitte drehe dein Gerät.",
|
||||||
align_y=0.5,
|
fill=Color.from_hex("FFFFFF"),
|
||||||
style=TextStyle(fill=Color.from_hex("FFFFFF"), font_size=0.8)
|
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
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -78,8 +78,8 @@ class ManageNewsPage(Component):
|
|||||||
Column(
|
Column(
|
||||||
Text(
|
Text(
|
||||||
text="News Verwaltung",
|
text="News Verwaltung",
|
||||||
|
fill=self.session.theme.background_color,
|
||||||
style=TextStyle(
|
style=TextStyle(
|
||||||
fill=self.session.theme.background_color,
|
|
||||||
font_size=1.2
|
font_size=1.2
|
||||||
),
|
),
|
||||||
margin_top=2,
|
margin_top=2,
|
||||||
@ -88,8 +88,8 @@ class ManageNewsPage(Component):
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
text="Neuen News Post erstellen",
|
text="Neuen News Post erstellen",
|
||||||
|
fill=self.session.theme.background_color,
|
||||||
style=TextStyle(
|
style=TextStyle(
|
||||||
fill=self.session.theme.background_color,
|
|
||||||
font_size=1.1
|
font_size=1.1
|
||||||
),
|
),
|
||||||
margin_top=2,
|
margin_top=2,
|
||||||
@ -106,8 +106,8 @@ class ManageNewsPage(Component):
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
text="Post erfolgreich erstellt",
|
text="Post erfolgreich erstellt",
|
||||||
|
fill=self.session.theme.success_color,
|
||||||
style=TextStyle(
|
style=TextStyle(
|
||||||
fill=self.session.theme.success_color,
|
|
||||||
font_size=0.7 if self.show_success_message else 0
|
font_size=0.7 if self.show_success_message else 0
|
||||||
),
|
),
|
||||||
margin_top=0.1,
|
margin_top=0.1,
|
||||||
@ -116,8 +116,8 @@ class ManageNewsPage(Component):
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
text="Bisherige Posts",
|
text="Bisherige Posts",
|
||||||
|
fill=self.session.theme.background_color,
|
||||||
style=TextStyle(
|
style=TextStyle(
|
||||||
fill=self.session.theme.background_color,
|
|
||||||
font_size=1.1
|
font_size=1.1
|
||||||
),
|
),
|
||||||
margin_top=2,
|
margin_top=2,
|
||||||
|
|||||||
@ -232,7 +232,6 @@ class DatabaseService:
|
|||||||
except aiomysql.InterfaceError:
|
except aiomysql.InterfaceError:
|
||||||
pool_init_result = await self.init_db_pool()
|
pool_init_result = await self.init_db_pool()
|
||||||
if not pool_init_result:
|
if not pool_init_result:
|
||||||
print(self._connection_pool)
|
|
||||||
raise NoDatabaseConnectionError
|
raise NoDatabaseConnectionError
|
||||||
return await self.get_news(dt_start, dt_end)
|
return await self.get_news(dt_start, dt_end)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user