2 Commits

11 changed files with 600 additions and 888 deletions
+1 -2
View File
@@ -21,7 +21,7 @@ services:
MARIADB_USER: ezgg_lan_manager
MARIADB_PASSWORD: Alkohol1
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost", "-pAlkohol1"]
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"]
interval: 5s
timeout: 3s
retries: 5
@@ -30,7 +30,6 @@ services:
volumes:
- database:/var/lib/mysql
- ./sql/create_database.sql:/docker-entrypoint-initdb.d/init.sql
- ./sql:/sql
volumes:
BIN
View File
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -4
View File
@@ -27,10 +27,7 @@ if __name__ == "__main__":
corner_radius_small=0,
corner_radius_medium=0,
corner_radius_large=0,
font=Font(
regular=from_root("src/ezgg_lan_manager/assets/fonts/PixelOperatorMono.ttf"),
bold=from_root("src/ezgg_lan_manager/assets/fonts/PixelOperatorMono-Bold.ttf"),
)
font=Font(from_root("src/ezgg_lan_manager/assets/fonts/joystix.otf"))
)
default_attachments: list = [LocalData(stored_session_token=None)]
default_attachments.extend(init_services())
@@ -47,8 +47,8 @@ class DesktopNavigation(Component):
return Card(
Column(
Text(lan_info.name, align_x=0.5, margin_top=0.3, style=TextStyle(fill=self.session.theme.hud_color, font_size=2.5), font_weight="bold"),
Text(f"Edition {lan_info.iteration}", align_x=0.5, style=TextStyle(fill=self.session.theme.hud_color, font_size=1.6), margin_top=0.3, margin_bottom=2, font_weight="bold"),
Text(lan_info.name, align_x=0.5, margin_top=0.3, style=TextStyle(fill=self.session.theme.hud_color, font_size=1.9)),
Text(f"Edition {lan_info.iteration}", align_x=0.5, style=TextStyle(fill=self.session.theme.hud_color, font_size=1.2), margin_top=0.3, margin_bottom=2),
user_info_and_login_box,
*navigation,
Text("Unsere Sponsoren", align_x=0.5, style=TextStyle(fill=self.session.theme.hud_color, font_size=0.9), margin_bottom=0.5, margin_top=1),
@@ -1,7 +1,7 @@
from rio import Component, TextStyle, Color, Link, Button, Text
class DesktopNavigationButton(Component):
STYLE = TextStyle(fill=Color.from_hex("02dac5"), font_size=1.2, font_weight="bold")
STYLE = TextStyle(fill=Color.from_hex("02dac5"), font_size=0.9)
TEAM_STYLE = TextStyle(fill=Color.from_hex("F0EADE"), font_size=0.9)
label: str
target_url: str
+12 -2
View File
@@ -1,7 +1,7 @@
from decimal import Decimal
from typing import Optional
from rio import Column, Component, event, Text, TextStyle, Button, Color, Revealer, Row, ProgressCircle, Link
from rio import Column, Component, event, Text, TextStyle, Button, Color, Revealer, Row, ProgressCircle, Link, Image
from src.ezgg_lan_manager import ConfigurationService, UserService, AccountingService
from src.ezgg_lan_manager.components.MainViewContentBox import MainViewContentBox
@@ -14,6 +14,7 @@ class AccountPage(Component):
user: Optional[User] = None
balance: Optional[Decimal] = None
transaction_history: list[Transaction] = list()
payment_qr_image: bytes = None
banking_info_revealer_open: bool = False
paypal_info_revealer_open: bool = False
@@ -28,6 +29,11 @@ class AccountPage(Component):
self.user = await self.session[UserService].get_user(user_id)
self.balance = await self.session[AccountingService].get_balance(user_id)
self.transaction_history = await self.session[AccountingService].get_transaction_history(user_id)
self.payment_qr_image = self.session[AccountingService].make_payment_qr_image(
"Einfach Zocken Gaming Gesellschaft",
"GENODE51BIK",
"DE47517624340019856607",
f"AUFLADUNG - {self.user.user_id} - {self.user.user_name}")
async def _on_banking_info_press(self) -> None:
self.banking_info_revealer_open = not self.banking_info_revealer_open
@@ -36,7 +42,7 @@ class AccountPage(Component):
self.paypal_info_revealer_open = not self.paypal_info_revealer_open
def build(self) -> Component:
if not self.user and not self.balance:
if not self.user or not self.payment_qr_image:
return Column(
MainViewContentBox(
ProgressCircle(
@@ -85,6 +91,10 @@ class AccountPage(Component):
margin=0,
margin_bottom=1,
align_x=0.5
),
Image(self.payment_qr_image,
min_width=20,
min_height=20
)
),
margin=2,
@@ -1,4 +1,6 @@
import io
import logging
import qrcode
from collections.abc import Callable
from datetime import datetime
from decimal import Decimal, ROUND_DOWN
@@ -74,3 +76,29 @@ class AccountingService:
return "0.00 €"
rounded_decimal = str(euros.quantize(Decimal(".01"), rounding=ROUND_DOWN))
return f"{rounded_decimal}"
@staticmethod
def make_payment_qr_image(beneficiary_name, beneficiary_bic, beneficiary_iban, text, amount_euros=None) -> bytes:
text = text.replace("\n",";")
amount_formatted = "EUR{:.2f}".format(amount_euros) if amount_euros else ""
epc_text = f"""BCD
002
1
SCT
{beneficiary_bic}
{beneficiary_name}
{beneficiary_iban}
{amount_formatted}
{text}
"""
qr = qrcode.QRCode(
version=6,
error_correction=qrcode.constants.ERROR_CORRECT_M,
)
qr.add_data(epc_text)
img = qr.make_image()
img_bytes = io.BytesIO()
img.save(img_bytes)
return img_bytes.getvalue()