def __init__(self, app: Application) -> None: super().__init__(app) # Create Options self.bar_option = OptionBar(Point(0, 0), self.app.size.width) self.bar_option.add_element("Project") # Create Status self.bar_status = OptionBar(Point(0, self.app.size.height - 32), self.app.size.width) self.bar_status.add_element("Status Bar") # Define Colours self.colour_bkg = Colour(36, 36, 36).to_hex()
def render(self, gfx: Graphics) -> None: # Render Background gfx.draw_rect(Point(0, 0), self.app.get_dimensions(), self.colour_bkg, True) # Render Options self.bar_option.render(gfx) # Render Content gfx.draw_text("Content Placeholder", Point(10, 40)) # Render Status self.bar_status.render(gfx)
def render(self, gfx: Graphics) -> None: # Render Logo gfx.draw_image( ImageLoader.load("logo"), Point(self.app.get_dimensions().width / 2, self.app.get_dimensions().height / 2), Align.CENTER)
def loop() -> None: # Not Running if self.running is not True: return # Timer Start loop_time: int = (time.time() * 1000) # Controller Actions self.controller.get_actions().each(lambda it: self.action(it)) # Application Tick self.state_active.tick() self.state_active.tick_event() # Application Render gfx.draw_rect(Point(0, 0), self.size, "black", True) self.state_active.render(gfx) # Schedule Loop loop_time = (time.time() * 1000) - loop_time loop_wait: int = 0 if loop_time < tick_ms: loop_wait = tick_ms - loop_time self.app.after(int(loop_wait), loop)
def render(self, gfx: Graphics) -> None: # Load Logo self.logo = ImageTk.PhotoImage(Image.open("resources/images/brand/riem_logo.png")) # NOTE: this is currently assuming the file exists in project # change this later to use a predefined byte array # Render Logo gfx.draw_image(self.logo, Point(self.app.get_dimensions().width / 2, self.app.get_dimensions().height / 2), Align.CENTER)
def __init__(self, canvas: Any, default_text: Dict[str, str] = None, offset: Point = Point(0, 0)) -> None: # NOTE: canvas should have specific type here # Public Properties self.canvas = canvas self.offset = offset # Custom Defaults if default_text is not None: for key in default_text: # Invalid Key if key not in Graphics.text_default.keys(): raise Exception("%s is not a valid default text option!" % key) # Update Value Graphics.text_default[key] = default_text[key]
def __init__(self, offset: Point = Point(-30, 0)) -> None: self.option = ArrayList() self.active = 0 self.offset = offset
def render_title(self, gfx: Graphics, value: str) -> None: gfx.draw_text(value, Point(25, 25), Align.LEFT, "Inconsolata 22", "#E62959", "#801731")
def render_hint(self, gfx: Graphics, value: str) -> None: gfx.draw_text(value, Point(10, self.app.get_dimensions().height - 25), Align.LEFT, "Inconsolata 12")
def render(self, gfx: Graphics, pos: int) -> None: gfx.draw_text(self.label, Point(10, self.option_bar.get_pos().y + 8), Align.LEFT, self.text["font"], self.text["colour"])