diff --git a/src/ez_lan_manager/components/SeatingPlan.py b/src/ez_lan_manager/components/SeatingPlan.py index ee06988..e8bb7d3 100644 --- a/src/ez_lan_manager/components/SeatingPlan.py +++ b/src/ez_lan_manager/components/SeatingPlan.py @@ -5,17 +5,17 @@ from rio import Component, Rectangle, Grid, Column, Row, Text, TextStyle, Color from src.ez_lan_manager.components.SeatingPlanPixels import SeatPixel, WallPixel, InvisiblePixel, TextPixel from src.ez_lan_manager.types.Seat import Seat -MAX_GRID_WIDTH_PIXELS = 34 -MAX_GRID_HEIGHT_PIXELS = 45 +MAX_GRID_WIDTH_PIXELS = 60 +MAX_GRID_HEIGHT_PIXELS = 60 class SeatingPlanLegend(Component): def build(self) -> Component: return Column( Text("Legende", style=TextStyle(fill=self.session.theme.neutral_color), justify="center", margin=1), - Row( - Text("L = Luxus Platz", justify="center", style=TextStyle(fill=self.session.theme.neutral_color)), - Text("N = Normaler Platz", justify="center", style=TextStyle(fill=self.session.theme.neutral_color)), - ), + # Row( # Disabled for upcoming LAN + # Text("L = Luxus Platz", justify="center", style=TextStyle(fill=self.session.theme.neutral_color)), + # Text("N = Normaler Platz", justify="center", style=TextStyle(fill=self.session.theme.neutral_color)), + # ), Row( Rectangle( content=Column( @@ -73,7 +73,8 @@ class SeatingPlan(Component): seating_info: list[Seat] def get_seat(self, seat_id: str) -> Seat: - return next(filter(lambda seat: seat.seat_id == seat_id, self.seating_info)) + seat = next(filter(lambda seat_: seat_.seat_id == seat_id, self.seating_info), None) + return seat if seat else Seat(seat_id="Z99", is_blocked=True, category="LUXUS", user=None) """ This seating plan is for the community center "Bottenhorn" @@ -81,106 +82,150 @@ class SeatingPlan(Component): 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): + for x in range(0, MAX_GRID_WIDTH_PIXELS): + grid.add(WallPixel(), row=0, column=x) + + for y in range(0, MAX_GRID_HEIGHT_PIXELS): grid.add(WallPixel(), row=y, column=0) + for x in range(0, MAX_GRID_WIDTH_PIXELS): + grid.add(WallPixel(), row=MAX_GRID_HEIGHT_PIXELS, column=x) + + for x in range(0, 31): + grid.add(WallPixel(), row=15, column=x) + + for x in range(41, MAX_GRID_WIDTH_PIXELS): + grid.add(WallPixel(), row=32, column=x) + + for x in range(31, 34): + grid.add(WallPixel(), row=32, column=x) + grid.add(WallPixel(), row=19, column=x) + + for x in range(42, MAX_GRID_WIDTH_PIXELS): + grid.add(WallPixel(), row=11, column=x) + grid.add(WallPixel(), row=22, column=x) + + for x in range(22, 30): + grid.add(WallPixel(), row=5, column=x) + grid.add(WallPixel(), row=10, column=x) + + for y in range(5, 11): + grid.add(WallPixel(), row=y, column=21) + grid.add(WallPixel(), row=y, column=30) + + + for y in range(40, MAX_GRID_HEIGHT_PIXELS): + grid.add(WallPixel(), row=y, column=30) + + for y in range(32, 36): + grid.add(WallPixel(), row=y, column=30) + + for y in range(19, 33): + grid.add(WallPixel(), row=y, column=34) + + for y in range(16, 20): + grid.add(WallPixel(), row=y, column=30) + + for y in range(0, 5): + grid.add(WallPixel(), row=y, column=41) + + for y in range(9, 15): + grid.add(WallPixel(), row=y, column=41) + + for y in range(19, 33): + grid.add(WallPixel(), row=y, column=41) + + # Block A - block_a_margin_left = 12 - block_a_margin_top = 1 - (grid - .add(SeatPixel("A01", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A01")), row=block_a_margin_top, column=block_a_margin_left, width=2, height=3) - .add(SeatPixel("A02", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A02")), row=block_a_margin_top + 4, column=block_a_margin_left, width=2, height=3) - .add(SeatPixel("A03", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A03")), row=block_a_margin_top + 8, column=block_a_margin_left, width=2, height=3) - .add(SeatPixel("A10", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A10")), row=block_a_margin_top, column=block_a_margin_left + 3, width=2, height=3) - .add(SeatPixel("A11", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A11")), row=block_a_margin_top + 4, column=block_a_margin_left + 3, width=2, height=3) - .add(SeatPixel("A12", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A12")), row=block_a_margin_top + 8, column=block_a_margin_left + 3, width=2, height=3) - ) + grid.add(SeatPixel("A01", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A01")), row=57, column=2, width=3, height=2) + grid.add(SeatPixel("A02", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A02")), row=57, column=5, width=3, height=2) + grid.add(SeatPixel("A03", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A03")), row=57, column=8, width=3, height=2) + grid.add(SeatPixel("A04", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A04")), row=57, column=11, width=3, height=2) + grid.add(SeatPixel("A05", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A05")), row=57, column=14, width=3, height=2) + grid.add(SeatPixel("A06", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A06")), row=57, column=17, width=3, height=2) + + grid.add(SeatPixel("A10", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A10")), row=55, column=2, width=3, height=2) + grid.add(SeatPixel("A11", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A11")), row=55, column=5, width=3, height=2) + grid.add(SeatPixel("A12", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A12")), row=55, column=8, width=3, height=2) + grid.add(SeatPixel("A13", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A13")), row=55, column=11, width=3, height=2) + grid.add(SeatPixel("A14", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A14")), row=55, column=14, width=3, height=2) + grid.add(SeatPixel("A15", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("A15")), row=55, column=17, width=3, height=2) # Block B - block_b_margin_left = 20 - block_b_margin_top = 1 - (grid - .add(SeatPixel("B01", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B01")), row=block_b_margin_top, column=block_b_margin_left, width=2, height=3) - .add(SeatPixel("B02", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B02")), row=block_b_margin_top + 4, column=block_b_margin_left, width=2, height=3) - .add(SeatPixel("B03", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B03")), row=block_b_margin_top + 8, column=block_b_margin_left, width=2, height=3) - .add(SeatPixel("B10", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B10")), row=block_b_margin_top, column=block_b_margin_left + 3, width=2, height=3) - .add(SeatPixel("B11", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B11")), row=block_b_margin_top + 4, column=block_b_margin_left + 3, width=2, height=3) - .add(SeatPixel("B12", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B12")), row=block_b_margin_top + 8, column=block_b_margin_left + 3, width=2, height=3) - ) + grid.add(SeatPixel("B01", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B01")), row=50, column=2, width=3, height=2) + grid.add(SeatPixel("B02", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B02")), row=50, column=5, width=3, height=2) + grid.add(SeatPixel("B03", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B03")), row=50, column=8, width=3, height=2) + grid.add(SeatPixel("B04", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B04")), row=50, column=11, width=3, height=2) + grid.add(SeatPixel("B05", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B05")), row=50, column=14, width=3, height=2) + + grid.add(SeatPixel("B10", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B10")), row=48, column=2, width=3, height=2) + grid.add(SeatPixel("B11", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B11")), row=48, column=5, width=3, height=2) + grid.add(SeatPixel("B12", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B12")), row=48, column=8, width=3, height=2) + grid.add(SeatPixel("B13", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B13")), row=48, column=11, width=3, height=2) + grid.add(SeatPixel("B14", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("B14")), row=48, column=14, width=3, height=2) # Block C - block_c_margin_left = 28 - block_c_margin_top = 1 - (grid - .add(SeatPixel("C01", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C01")), row=block_c_margin_top, column=block_c_margin_left, width=2, height=3) - .add(SeatPixel("C02", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C02")), row=block_c_margin_top + 4, column=block_c_margin_left, width=2, height=3) - .add(SeatPixel("C03", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C03")), row=block_c_margin_top + 8, column=block_c_margin_left, width=2, height=3) - .add(SeatPixel("C10", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C10")), row=block_c_margin_top, column=block_c_margin_left + 3, width=2, height=3) - .add(SeatPixel("C11", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C11")), row=block_c_margin_top + 4, column=block_c_margin_left + 3, width=2, height=3) - .add(SeatPixel("C12", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C12")), row=block_c_margin_top + 8, column=block_c_margin_left + 3, width=2, height=3) - ) + grid.add(SeatPixel("C01", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C01")), row=43, column=2, width=3, height=2) + grid.add(SeatPixel("C02", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C02")), row=43, column=5, width=3, height=2) + grid.add(SeatPixel("C03", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C03")), row=43, column=8, width=3, height=2) + grid.add(SeatPixel("C04", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C04")), row=43, column=11, width=3, height=2) + grid.add(SeatPixel("C05", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C05")), row=43, column=14, width=3, height=2) + + grid.add(SeatPixel("C10", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C10")), row=41, column=2, width=3, height=2) + grid.add(SeatPixel("C11", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C11")), row=41, column=5, width=3, height=2) + grid.add(SeatPixel("C12", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C12")), row=41, column=8, width=3, height=2) + grid.add(SeatPixel("C13", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C13")), row=41, column=11, width=3, height=2) + grid.add(SeatPixel("C14", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("C14")), row=41, column=14, width=3, height=2) # Block D - block_d_margin_left = 20 - block_d_margin_top = 20 - (grid - .add(SeatPixel("D01", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D01")), row=block_d_margin_top, column=block_d_margin_left, width=2, height=3) - .add(SeatPixel("D02", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D02")), row=block_d_margin_top + 4, column=block_d_margin_left, width=2, height=3) - .add(SeatPixel("D03", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D03")), row=block_d_margin_top + 8, column=block_d_margin_left, width=2, height=3) - .add(SeatPixel("D10", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D10")), row=block_d_margin_top, column=block_d_margin_left + 3, width=2, height=3) - .add(SeatPixel("D11", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D11")), row=block_d_margin_top + 4, column=block_d_margin_left + 3, width=2, height=3) - .add(SeatPixel("D12", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D12")), row=block_d_margin_top + 8, column=block_d_margin_left + 3, width=2, height=3) - ) + grid.add(SeatPixel("D01", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D01")), row=34, column=2, width=3, height=2) + grid.add(SeatPixel("D02", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D02")), row=34, column=5, width=3, height=2) + grid.add(SeatPixel("D03", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D03")), row=34, column=8, width=3, height=2) + grid.add(SeatPixel("D04", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D04")), row=34, column=11, width=3, height=2) + grid.add(SeatPixel("D05", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D05")), row=34, column=14, width=3, height=2) + grid.add(SeatPixel("D06", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D06")), row=34, column=17, width=3, height=2) + + grid.add(SeatPixel("D10", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D10")), row=32, column=2, width=3, height=2) + grid.add(SeatPixel("D11", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D11")), row=32, column=5, width=3, height=2) + grid.add(SeatPixel("D12", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D12")), row=32, column=8, width=3, height=2) + grid.add(SeatPixel("D13", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D13")), row=32, column=11, width=3, height=2) + grid.add(SeatPixel("D14", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D14")), row=32, column=14, width=3, height=2) + grid.add(SeatPixel("D15", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("D15")), row=32, column=17, width=3, height=2) # Block E - block_e_margin_left = 28 - block_e_margin_top = 20 - (grid - .add(SeatPixel("E01", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E01")), row=block_e_margin_top, column=block_e_margin_left, width=2, height=3) - .add(SeatPixel("E02", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E02")), row=block_e_margin_top + 4, column=block_e_margin_left, width=2, height=3) - .add(SeatPixel("E03", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E03")), row=block_e_margin_top + 8, column=block_e_margin_left, width=2, height=3) - .add(SeatPixel("E10", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E10")), row=block_e_margin_top, column=block_e_margin_left + 3, width=2, height=3) - .add(SeatPixel("E11", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E11")), row=block_e_margin_top + 4, column=block_e_margin_left + 3, width=2, height=3) - .add(SeatPixel("E12", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E12")), row=block_e_margin_top + 8, column=block_e_margin_left + 3, width=2, height=3) - ) + grid.add(SeatPixel("E01", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E01")), row=27, column=2, width=3, height=2) + grid.add(SeatPixel("E02", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E02")), row=27, column=5, width=3, height=2) + grid.add(SeatPixel("E03", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E03")), row=27, column=8, width=3, height=2) + grid.add(SeatPixel("E04", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E04")), row=27, column=11, width=3, height=2) + grid.add(SeatPixel("E05", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E05")), row=27, column=14, width=3, height=2) + grid.add(SeatPixel("E06", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E06")), row=27, column=17, width=3, height=2) - # 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) + grid.add(SeatPixel("E10", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E10")), row=25, column=2, width=3, height=2) + grid.add(SeatPixel("E11", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E11")), row=25, column=5, width=3, height=2) + grid.add(SeatPixel("E12", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E12")), row=25, column=8, width=3, height=2) + grid.add(SeatPixel("E13", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E13")), row=25, column=11, width=3, height=2) + grid.add(SeatPixel("E14", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E14")), row=25, column=14, width=3, height=2) + grid.add(SeatPixel("E15", on_press_cb=self.seat_clicked_cb, seat=self.get_seat("E15")), row=25, column=17, width=3, height=2) # 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) - + grid.add(TextPixel(text="Bühne"), row=16, column=1, width=29, height=4) + # # Drinks - grid.add(TextPixel(text="G\ne\nt\nr\nä\nn\nk\ne"), row=21, column=11, width=3, height=11) + grid.add(TextPixel(text="G\ne\nt\nr\nä\nn\nk\ne"), row=20, column=30, width=4, height=12) + # Main Entrance + grid.add(TextPixel(text="H\na\nl\nl\ne\nn\n\ne\ni\nn\ng\na\nn\ng"), row=33, column=56, width=4, height=27) + # # Sleeping - grid.add(TextPixel(icon_name="material/bed"), row=1, column=1, width=4, height=11) + grid.add(TextPixel(icon_name="material/bed"), row=1, column=1, width=20, height=14) # Toilet - grid.add(TextPixel(icon_name="material/floor", no_outline=True), row=1, column=7, width=3, height=2) - grid.add(TextPixel(icon_name="material/north", no_outline=True), row=3, column=7, width=3, height=2) - grid.add(TextPixel(icon_name="material/wc"), row=5, column=7, width=3, height=2) + grid.add(TextPixel(icon_name="material/wc"), row=1, column=42, width=19, height=10) + grid.add(TextPixel(icon_name="material/wc"), row=12, column=42, width=19, height=10) # Entry/Helpdesk - grid.add(TextPixel(text="Einlass\n &Orga"), row=19, column=3, width=7, height=5) + grid.add(TextPixel(text="Einlass\n &Orga"), row=40, column=22, width=8, height=12) - # 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, diff --git a/src/ez_lan_manager/components/SeatingPlanPixels.py b/src/ez_lan_manager/components/SeatingPlanPixels.py index 01ad113..cc467b2 100644 --- a/src/ez_lan_manager/components/SeatingPlanPixels.py +++ b/src/ez_lan_manager/components/SeatingPlanPixels.py @@ -1,6 +1,6 @@ from functools import partial -from rio import Component, Text, Icon, TextStyle, Rectangle, Spacer, Color, PointerEventListener, Column +from rio import Component, Text, Icon, TextStyle, Rectangle, Spacer, Color, PointerEventListener, Column, Row from typing import Optional, Callable from src.ez_lan_manager.types.Seat import Seat @@ -22,13 +22,13 @@ class SeatPixel(Component): def build(self) -> Component: return PointerEventListener( content=Rectangle( - content=Column( - Text(f"{self.seat_id}", style=TextStyle(fill=self.session.theme.primary_color, font_size=0.7), align_x=0.5, selectable=False), - Text(f"{self.seat.category[0]}", style=TextStyle(fill=self.session.theme.primary_color, font_size=0.9), align_x=0.5, selectable=False, overflow="wrap") + content=Row( + Text(f"{self.seat_id}", style=TextStyle(fill=self.session.theme.primary_color, font_size=0.9), align_x=0.5, selectable=False) ), min_width=1, min_height=1, fill=self.determine_color(), + stroke_width = 0.1, hover_stroke_width = 0.1, grow_x=True, grow_y=True,