def draw_list_item(self, drawing_context: DrawingContext.DrawingContext, rect: Geometry.IntRect) -> None: with drawing_context.saver(): draw_rect = Geometry.IntRect(origin=rect.top_left + Geometry.IntPoint(y=4, x=4), size=Geometry.IntSize(h=72, w=72)) drawing_context.add(self.__create_thumbnail(draw_rect)) drawing_context.fill_style = "#000" drawing_context.font = "11px serif" drawing_context.fill_text(self.title_str, rect.left + 4 + 72 + 4, rect.top + 4 + 12) drawing_context.fill_text(self.format_str, rect.left + 4 + 72 + 4, rect.top + 4 + 12 + 15) drawing_context.fill_text(self.datetime_str, rect.left + 4 + 72 + 4, rect.top + 4 + 12 + 15 + 15) if self.status_str: drawing_context.fill_text(self.status_str, rect.left + 4 + 72 + 4, rect.top + 4 + 12 + 15 + 15 + 15) else: drawing_context.fill_style = "#888" drawing_context.fill_text(self.project_str, rect.left + 4 + 72 + 4, rect.top + 4 + 12 + 15 + 15 + 15)
def _repaint(self, drawing_context: DrawingContext.DrawingContext) -> None: super()._repaint(drawing_context) with self.__drawing_context_lock: drawing_context.add(self.__drawing_context) if self.__display_frame_rate_id: Utility.fps_tick("display_" + self.__display_frame_rate_id) if self.__display_frame_rate_id: fps = Utility.fps_get("display_" + self.__display_frame_rate_id) fps2 = Utility.fps_get("frame_" + self.__display_frame_rate_id) fps3 = Utility.fps_get("update_" + self.__display_frame_rate_id) canvas_bounds = self.canvas_bounds if canvas_bounds: with drawing_context.saver(): font = "normal 11px serif" text_pos = canvas_bounds.top_right + Geometry.IntPoint( y=0, x=-100) drawing_context.begin_path() drawing_context.move_to(text_pos.x, text_pos.y) drawing_context.line_to(text_pos.x + 120, text_pos.y) drawing_context.line_to(text_pos.x + 120, text_pos.y + 60) drawing_context.line_to(text_pos.x, text_pos.y + 60) drawing_context.close_path() drawing_context.fill_style = "rgba(255, 255, 255, 0.6)" drawing_context.fill() drawing_context.font = font drawing_context.text_baseline = "middle" drawing_context.text_align = "left" drawing_context.fill_style = "#000" drawing_context.fill_text("display:" + fps, text_pos.x + 8, text_pos.y + 10) drawing_context.fill_text("frame:" + fps2, text_pos.x + 8, text_pos.y + 30) drawing_context.fill_text("update:" + fps3, text_pos.x + 8, text_pos.y + 50)
def draw_grid_item(self, drawing_context: DrawingContext.DrawingContext, rect: Geometry.IntRect) -> None: drawing_context.add(self.__create_thumbnail(rect.inset(6)))
def render(self, drawing_context: DrawingContext.DrawingContext): drawing_context.add(self.__drawing_context)