WIP: Seating Plan
This commit is contained in:
@@ -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
|
||||
)
|
||||
Reference in New Issue
Block a user