WIP: Seating Plan
This commit is contained in:
parent
e20ce6b78b
commit
c090717486
124
src/ez_lan_manager/components/SeatingPlan.py
Normal file
124
src/ez_lan_manager/components/SeatingPlan.py
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
from rio import Component, Rectangle, Grid
|
||||||
|
|
||||||
|
from src.ez_lan_manager.components.SeatingPlanPixels import SeatPixel, WallPixel, InvisiblePixel, TextPixel
|
||||||
|
|
||||||
|
MAX_GRID_WIDTH_PIXELS = 34
|
||||||
|
MAX_GRID_HEIGHT_PIXELS = 45
|
||||||
|
|
||||||
|
|
||||||
|
class SeatingPlan(Component):
|
||||||
|
"""
|
||||||
|
This seating plan is for the community center "Bottenhorn"
|
||||||
|
"""
|
||||||
|
def build(self) -> Component:
|
||||||
|
grid = Grid()
|
||||||
|
# Outlines
|
||||||
|
for column_id in range(0, MAX_GRID_WIDTH_PIXELS):
|
||||||
|
grid.add(InvisiblePixel(), row=0, column=column_id)
|
||||||
|
for y in range(0, 13):
|
||||||
|
grid.add(WallPixel(), row=y, column=0)
|
||||||
|
for y in range(13, 19):
|
||||||
|
grid.add(InvisiblePixel(), row=y, column=0)
|
||||||
|
for y in range(19, MAX_GRID_HEIGHT_PIXELS):
|
||||||
|
grid.add(WallPixel(), row=y, column=0)
|
||||||
|
|
||||||
|
# Block A
|
||||||
|
block_a_margin_left = 12
|
||||||
|
block_a_margin_top = 1
|
||||||
|
(grid
|
||||||
|
.add(SeatPixel("A01"), row=block_a_margin_top, column=block_a_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("A02"), row=block_a_margin_top + 4, column=block_a_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("A03"), row=block_a_margin_top + 8, column=block_a_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("A10"), row=block_a_margin_top, column=block_a_margin_left + 3, width=2, height=3)
|
||||||
|
.add(SeatPixel("A11"), row=block_a_margin_top + 4, column=block_a_margin_left + 3, width=2, height=3)
|
||||||
|
.add(SeatPixel("A12"), row=block_a_margin_top + 8, column=block_a_margin_left + 3, width=2, height=3)
|
||||||
|
)
|
||||||
|
|
||||||
|
# Block B
|
||||||
|
block_b_margin_left = 20
|
||||||
|
block_b_margin_top = 1
|
||||||
|
(grid
|
||||||
|
.add(SeatPixel("B01"), row=block_b_margin_top, column=block_b_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("B02"), row=block_b_margin_top + 4, column=block_b_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("B03"), row=block_b_margin_top + 8, column=block_b_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("B10"), row=block_b_margin_top, column=block_b_margin_left + 3, width=2, height=3)
|
||||||
|
.add(SeatPixel("B11"), row=block_b_margin_top + 4, column=block_b_margin_left + 3, width=2, height=3)
|
||||||
|
.add(SeatPixel("B12"), row=block_b_margin_top + 8, column=block_b_margin_left + 3, width=2, height=3)
|
||||||
|
)
|
||||||
|
|
||||||
|
# Block C
|
||||||
|
block_c_margin_left = 28
|
||||||
|
block_c_margin_top = 1
|
||||||
|
(grid
|
||||||
|
.add(SeatPixel("C01"), row=block_c_margin_top, column=block_c_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("C02"), row=block_c_margin_top + 4, column=block_c_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("C03"), row=block_c_margin_top + 8, column=block_c_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("C10"), row=block_c_margin_top, column=block_c_margin_left + 3, width=2, height=3)
|
||||||
|
.add(SeatPixel("C11"), row=block_c_margin_top + 4, column=block_c_margin_left + 3, width=2, height=3)
|
||||||
|
.add(SeatPixel("C12"), row=block_c_margin_top + 8, column=block_c_margin_left + 3, width=2, height=3)
|
||||||
|
)
|
||||||
|
|
||||||
|
# Block D
|
||||||
|
block_d_margin_left = 20
|
||||||
|
block_d_margin_top = 20
|
||||||
|
(grid
|
||||||
|
.add(SeatPixel("D01"), row=block_d_margin_top, column=block_d_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("D02"), row=block_d_margin_top + 4, column=block_d_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("D03"), row=block_d_margin_top + 8, column=block_d_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("D10"), row=block_d_margin_top, column=block_d_margin_left + 3, width=2, height=3)
|
||||||
|
.add(SeatPixel("D11"), row=block_d_margin_top + 4, column=block_d_margin_left + 3, width=2, height=3)
|
||||||
|
.add(SeatPixel("D12"), row=block_d_margin_top + 8, column=block_d_margin_left + 3, width=2, height=3)
|
||||||
|
)
|
||||||
|
|
||||||
|
# Block E
|
||||||
|
block_e_margin_left = 28
|
||||||
|
block_e_margin_top = 20
|
||||||
|
(grid
|
||||||
|
.add(SeatPixel("E01"), row=block_e_margin_top, column=block_e_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("E02"), row=block_e_margin_top + 4, column=block_e_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("E03"), row=block_e_margin_top + 8, column=block_e_margin_left, width=2, height=3)
|
||||||
|
.add(SeatPixel("E10"), row=block_e_margin_top, column=block_e_margin_left + 3, width=2, height=3)
|
||||||
|
.add(SeatPixel("E11"), row=block_e_margin_top + 4, column=block_e_margin_left + 3, width=2, height=3)
|
||||||
|
.add(SeatPixel("E12"), row=block_e_margin_top + 8, column=block_e_margin_left + 3, width=2, height=3)
|
||||||
|
)
|
||||||
|
|
||||||
|
# Middle Wall
|
||||||
|
for y in range(0, 13):
|
||||||
|
grid.add(WallPixel(), row=y, column=10)
|
||||||
|
for y in range(19, MAX_GRID_HEIGHT_PIXELS):
|
||||||
|
grid.add(WallPixel(), row=y, column=10)
|
||||||
|
|
||||||
|
# Stage
|
||||||
|
for x in range(11, MAX_GRID_WIDTH_PIXELS):
|
||||||
|
grid.add(WallPixel(), row=35, column=x)
|
||||||
|
grid.add(TextPixel(text="Bühne"), row=36, column=11, width=24, height=9)
|
||||||
|
|
||||||
|
# Drinks
|
||||||
|
grid.add(TextPixel(text="G\ne\nt\nr\nä\nn\nk\ne"), row=21, column=11, width=3, height=11)
|
||||||
|
|
||||||
|
# Sleeping
|
||||||
|
grid.add(TextPixel(icon_name="material/bed"), row=1, column=1, width=4, height=11)
|
||||||
|
|
||||||
|
# Toilet
|
||||||
|
grid.add(TextPixel(icon_name="material/wc"), row=1, column=7, width=3, height=4)
|
||||||
|
|
||||||
|
# Entry/Helpdesk
|
||||||
|
grid.add(TextPixel(text="Einlass\n &Orga"), row=19, column=3, width=7, height=5)
|
||||||
|
|
||||||
|
# Wall below Entry/Helpdesk
|
||||||
|
for y in range(24, MAX_GRID_HEIGHT_PIXELS):
|
||||||
|
grid.add(WallPixel(), row=y, column=3)
|
||||||
|
|
||||||
|
# Entry Arrow
|
||||||
|
grid.add(TextPixel(icon_name="material/east", no_outline=True), row=15, column=1, width=2, height=2)
|
||||||
|
|
||||||
|
return Rectangle(
|
||||||
|
content=grid,
|
||||||
|
grow_x=True,
|
||||||
|
grow_y=True,
|
||||||
|
stroke_color=self.session.theme.neutral_color,
|
||||||
|
stroke_width=0.1,
|
||||||
|
fill=self.session.theme.primary_color,
|
||||||
|
margin=0.5
|
||||||
|
)
|
||||||
|
|
||||||
82
src/ez_lan_manager/components/SeatingPlanPixels.py
Normal file
82
src/ez_lan_manager/components/SeatingPlanPixels.py
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
from rio import Component, Text, Icon, TextStyle, Rectangle, Spacer, Color
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
|
class SeatPixel(Component):
|
||||||
|
seat_id: str
|
||||||
|
|
||||||
|
def build(self) -> Component:
|
||||||
|
return Rectangle(
|
||||||
|
content=Text(self.seat_id, style=TextStyle(fill=self.session.theme.primary_color, font_size=0.7), align_x=0.5),
|
||||||
|
min_width=1,
|
||||||
|
min_height=1,
|
||||||
|
fill=self.session.theme.success_color,
|
||||||
|
hover_stroke_width = 0.1,
|
||||||
|
grow_x=True,
|
||||||
|
grow_y=True,
|
||||||
|
hover_fill=self.session.theme.hud_color,
|
||||||
|
transition_time=0.4
|
||||||
|
)
|
||||||
|
|
||||||
|
class TextPixel(Component):
|
||||||
|
text: Optional[str] = None
|
||||||
|
icon_name: Optional[str] = None
|
||||||
|
no_outline: bool = False
|
||||||
|
|
||||||
|
def build(self) -> Component:
|
||||||
|
if self.text is not None:
|
||||||
|
content = Text(self.text, style=TextStyle(fill=self.session.theme.neutral_color, font_size=1), align_x=0.5)
|
||||||
|
elif self.icon_name is not None:
|
||||||
|
content = Icon(self.icon_name, fill=self.session.theme.neutral_color)
|
||||||
|
else:
|
||||||
|
content = None
|
||||||
|
return Rectangle(
|
||||||
|
content=content,
|
||||||
|
min_width=1,
|
||||||
|
min_height=1,
|
||||||
|
fill=self.session.theme.primary_color,
|
||||||
|
stroke_width=0.0 if self.no_outline else 0.1,
|
||||||
|
stroke_color=self.session.theme.neutral_color,
|
||||||
|
hover_stroke_width = None if self.no_outline else 0.1,
|
||||||
|
grow_x=True,
|
||||||
|
grow_y=True,
|
||||||
|
hover_fill=None if self.no_outline else self.session.theme.hud_color,
|
||||||
|
transition_time=0.4
|
||||||
|
)
|
||||||
|
|
||||||
|
class WallPixel(Component):
|
||||||
|
def build(self) -> Component:
|
||||||
|
return Rectangle(
|
||||||
|
min_width=1,
|
||||||
|
min_height=1,
|
||||||
|
fill=Color.from_hex("434343"),
|
||||||
|
grow_x=True,
|
||||||
|
grow_y=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
class DebugPixel(Component):
|
||||||
|
def build(self) -> Component:
|
||||||
|
return Rectangle(
|
||||||
|
content=Spacer(),
|
||||||
|
min_width=1,
|
||||||
|
min_height=1,
|
||||||
|
fill=self.session.theme.success_color,
|
||||||
|
hover_stroke_color = self.session.theme.hud_color,
|
||||||
|
hover_stroke_width = 0.1,
|
||||||
|
grow_x=True,
|
||||||
|
grow_y=True,
|
||||||
|
hover_fill=self.session.theme.secondary_color,
|
||||||
|
transition_time=0.1
|
||||||
|
)
|
||||||
|
|
||||||
|
class InvisiblePixel(Component):
|
||||||
|
def build(self) -> Component:
|
||||||
|
return Rectangle(
|
||||||
|
content=Spacer(),
|
||||||
|
min_width=1,
|
||||||
|
min_height=1,
|
||||||
|
fill=self.session.theme.primary_color,
|
||||||
|
hover_stroke_width=0.0,
|
||||||
|
grow_x=True,
|
||||||
|
grow_y=True
|
||||||
|
)
|
||||||
@ -1,12 +1,9 @@
|
|||||||
from rio import Text, Column, TextStyle, Component, event, TextInput, MultiLineTextInput, Row, Button
|
from rio import Text, Column, TextStyle, Component, event
|
||||||
|
|
||||||
from src.ez_lan_manager import ConfigurationService, UserService, MailingService
|
from src.ez_lan_manager import ConfigurationService
|
||||||
from src.ez_lan_manager.components.AnimatedText import AnimatedText
|
|
||||||
from src.ez_lan_manager.components.MainViewContentBox import MainViewContentBox
|
from src.ez_lan_manager.components.MainViewContentBox import MainViewContentBox
|
||||||
|
from src.ez_lan_manager.components.SeatingPlan import SeatingPlan
|
||||||
from src.ez_lan_manager.pages import BasePage
|
from src.ez_lan_manager.pages import BasePage
|
||||||
from src.ez_lan_manager.types.SessionStorage import SessionStorage
|
|
||||||
from src.ez_lan_manager.types.User import User
|
|
||||||
|
|
||||||
|
|
||||||
class SeatingPlanPage(Component):
|
class SeatingPlanPage(Component):
|
||||||
@event.on_populate
|
@event.on_populate
|
||||||
@ -16,8 +13,10 @@ class SeatingPlanPage(Component):
|
|||||||
def build(self) -> Component:
|
def build(self) -> Component:
|
||||||
return BasePage(
|
return BasePage(
|
||||||
content=Column(
|
content=Column(
|
||||||
MainViewContentBox(),
|
MainViewContentBox(Text("Sitzplatz Infobox", margin=1, style=TextStyle(fill=self.session.theme.neutral_color))),
|
||||||
MainViewContentBox(),
|
MainViewContentBox(
|
||||||
|
SeatingPlan()
|
||||||
|
),
|
||||||
align_y=0
|
align_y=0
|
||||||
),
|
),
|
||||||
grow_x=True
|
grow_x=True
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user