def render(self, image): BATTERY_TOP = offset_to_center(image.height, BATTERY_SIZE[1]) CAPACITY_TOP = offset_to_center(image.height, CAPACITY_SIZE[1]) TEXT_TOP = BATTERY_TOP + 4 BATTERY_POS = (BATTERY_LEFT, BATTERY_TOP) CAPACITY_POS = (CAPACITY_LEFT, CAPACITY_TOP) TEXT_POS = (TEXT_LEFT, TEXT_TOP) return apply_layers( image, [ layer(self.battery_image.render, size=BATTERY_SIZE, pos=BATTERY_POS), layer(rectangle, size=self.state["capacity_size"], pos=CAPACITY_POS), layer( self.capacity_text.render, size=TEXT_SIZE, pos=TEXT_POS, ), ], )
def render(self, image): FIRST_COLUMN_POS = 7 FIRST_COLUMN_WIDTH = 52 COLUMN_GAP = 8 SECOND_COLUMN_POS = FIRST_COLUMN_POS + FIRST_COLUMN_WIDTH + COLUMN_GAP STATUS_ICON_SIZE = 24 THIRD_COLUMN_WIDTH = STATUS_ICON_SIZE return apply_layers( image, [ layer( self.text_component.render, size=(FIRST_COLUMN_WIDTH, image.size[1]), pos=(FIRST_COLUMN_POS, 0), ), layer( self.status_icon_component.render, size=(THIRD_COLUMN_WIDTH, STATUS_ICON_SIZE), pos=( SECOND_COLUMN_POS, offset_to_center(image.height, STATUS_ICON_SIZE), ), ), ], )
def render(self, image): FONT_SIZE = self.title.state["font"].size TITLE_POS = ( int(image.width * 0.37), offset_to_center(image.height, FONT_SIZE), ) COVER_IMAGE_OFFSET = 2 COVER_IMAGE_POS = ( int((TITLE_POS[0] - self.cover_image_size[0]) / 2) + COVER_IMAGE_OFFSET, offset_to_center(image.height, self.cover_image_size[1]), ) return apply_layers( image, [ layer( self.cover_image.render, size=self.cover_image_size, pos=COVER_IMAGE_POS, ), layer( self.title.render, size=(image.width - TITLE_POS[0], FONT_SIZE), pos=TITLE_POS, ), ], )
def render(self, image): padding_top = 1 padding_bottom = 3 title_margin_bottom = self.state["title_margin_bottom"] underline_thickness = self.state["underline_thickness"] underline_margin_bottom = self.state["underline_margin_bottom"] title_size = (image.width, self.title.state["font"].size) title_pos = (0, padding_top) underline_horizontal_padding = 4 underline_top = title_pos[1] + title_size[1] + title_margin_bottom underline_size = ( image.width - underline_horizontal_padding * 2, underline_thickness, ) underline_pos = (underline_horizontal_padding, underline_top) list_horizontal_padding = 6 list_top = underline_top + underline_size[1] + underline_margin_bottom list_size = ( image.width - list_horizontal_padding * 2 + 1, image.height - list_top - padding_bottom, ) list_pos = (list_horizontal_padding, list_top) return apply_layers( image, [ layer(self.title.render, size=title_size, pos=title_pos), layer(rectangle, size=underline_size, pos=underline_pos), layer(self.list.render, size=list_size, pos=list_pos), ], )
def render(self, image): BATTERY_OFFSET = -10 # offset from the vertical center of the page BATTERY_TOP = ( offset_pos_for_vertical_center(image.height, BATTERY_SIZE[1]) + BATTERY_OFFSET) CAPACITY_TOP = (offset_pos_for_vertical_center( image.height, MAX_CAPACITY_SIZE[1]) + BATTERY_OFFSET) IP_TEXT_TOP = BATTERY_TOP + BATTERY_SIZE[1] + ROW_SPACING BATTERY_POS = (BATTERY_LEFT, BATTERY_TOP) CAPACITY_POS = (CAPACITY_LEFT, CAPACITY_TOP) CAPACITY_TEXT_POS = (CAPACITY_TEXT_LEFT, BATTERY_TOP) IP_TEXT_POS = (0, IP_TEXT_TOP) return apply_layers( image, [ layer(self.battery_image.render, size=BATTERY_SIZE, pos=BATTERY_POS), layer(rectangle, size=self.state["capacity_size"], pos=CAPACITY_POS), layer( self.capacity_text.render, size=CAPACITY_TEXT_SIZE, pos=CAPACITY_TEXT_POS, ), layer( self.ip_text.render, size=(image.width, IP_FONT_SIZE), pos=IP_TEXT_POS, ), ], )
def render(self, image): return apply_layers( image, [ layer( self.ram_title.render, size=(SUB_TITLE_WIDTH, ROW_HEIGHT), pos=(X_MARGIN, MARGIN_Y), ), layer( self.ram_progress_bar.render, size=(image.width - SUB_TITLE_WIDTH - X_MARGIN * 2, ROW_HEIGHT), pos=(X_MARGIN + SUB_TITLE_WIDTH, MARGIN_Y), ), layer( self.ram_text.render, size=(image.width - X_MARGIN * 2, ROW_HEIGHT), pos=(X_MARGIN, MARGIN_Y + ROW_HEIGHT + SPACING_Y), ), layer( self.swap_title.render, size=(SUB_TITLE_WIDTH, ROW_HEIGHT), pos=(X_MARGIN, int(image.height / 2) + MARGIN_Y), ), layer( self.swap_progress_bar.render, size=(image.width - SUB_TITLE_WIDTH - X_MARGIN * 2, ROW_HEIGHT), pos=(X_MARGIN + SUB_TITLE_WIDTH, int(image.height / 2) + MARGIN_Y), ), layer( self.swap_text.render, size=(image.width - X_MARGIN * 2, ROW_HEIGHT), pos=( X_MARGIN, int(image.height / 2) + MARGIN_Y + ROW_HEIGHT + SPACING_Y, ), ), ], )
def render(self, image): if self.state["show_bootsplash"]: return self.bootsplash.render(image) if self.is_screensaver_running: return self.screensaver.render(image) return apply_layers( image, ( layer( self.stack.render, size=(image.width - self.right_gutter_width, image.height), ), layer( self.right_gutter.render, size=(self.right_gutter_width, image.height), pos=(image.size[0] - self.right_gutter_width, 0), ), ), )
def render(self, image): border_width = 1 left_border_layer = layer(rectangle, size=(border_width, image.height)) layers = [left_border_layer] if self.upper_icon.image: layers.append( layer( self.upper_icon.render, size=self.upper_icon.image.size, pos=self.state["upper_icon_padding"], )) if self.lower_icon.image: icon_size = self.lower_icon.image.size icon_padding = self.state["lower_icon_padding"] icon_pos = (icon_padding[0], image.height - icon_size[1] - icon_padding[1]) layers.append( layer(self.lower_icon.render, size=icon_size, pos=icon_pos)) return apply_layers(image, layers)
def render(self, image): layers = [] arrow_size = (10, 10) if self.upper_arrow_visible: layers.append( layer( arrow, size=arrow_size, pos=self.state["upper_arrow_padding"], )) if self.bottom_arrow_visible: icon_padding = self.state["bottom_arrow_padding"] icon_pos = (icon_padding[0], image.height - arrow_size[1] - icon_padding[1]) layers.append( layer(partial(arrow, rotation=180), size=arrow_size, pos=icon_pos)) return apply_layers(image, layers)
def render(self, image): icon_left_margin = 7 icon_size = (38, 38) icon_pos = (icon_left_margin, offset_to_center(image.height, icon_size[1])) cpu_bars_left_margin = 5 cpu_bars_size = (50, int(image.height * 0.7)) cpu_bars_pos = ( icon_pos[0] + icon_size[0] + cpu_bars_left_margin, offset_to_center(image.height, cpu_bars_size[1]), ) return apply_layers( image, [ layer(self.icon_component.render, size=icon_size, pos=icon_pos), layer(self.cpu_bars_component.render, size=cpu_bars_size, pos=cpu_bars_pos), ], )