def draw(self): theme = self.screen.theme font = self.screen.theme.get_font("small", "sans") if self.temperature_text and self.weather_code is not None: s = self.weather_font.render(chr(self.weather_code), True, (255, 255, 255)) icon_rect = s.get_rect() temperature_text_surface, temperature_rect = text_objects( self.temperature_text, font, theme.font_color ) description_surf, description_rect = text_objects( self.temperature_text2, font, theme.font_color ) arrange_rects((0, 0), icon_rect, temperature_rect, description_rect) entire_rect = icon_rect.unionall((temperature_rect, description_rect)) entire_rect = set_position(entire_rect, self.screen.rects, self.config) self.screen.rects[self.config["id"]] = entire_rect arrange_rects( entire_rect.topleft, icon_rect, temperature_rect, description_rect ) self.screen.blit(s, icon_rect) self.screen.blit(temperature_text_surface, temperature_rect) self.screen.blit(description_surf, description_rect)
def draw(self): rect = self.surface.get_rect() rect = set_position(rect, self.screen.rects, self.config) self.screen.rects[self.config["id"]] = rect self.screen.blit(self.surface, rect)
def draw_all_done(self): done_image_rect = self.done_img.get_rect() all_done_surface, all_done_rect = text_objects( "All done!", self.screen.theme.get_font("small", "sans"), self.screen.theme.font_color, ) all_done_rect.topleft = done_image_rect.topright relax_surf, relax_rect = text_objects( "Relax", self.screen.theme.get_font("small", "sans"), self.screen.theme.font_color, ) relax_rect.topleft = all_done_rect.bottomleft q = [relax_rect, done_image_rect, all_done_rect] entire_rect = q[0].unionall(q[1:]) self.screen.rects[self.config["id"]] = entire_rect entire_rect = set_position(entire_rect, self.screen.rects, self.config) x = entire_rect.left y = entire_rect.top done_image_rect.topleft = (x, y) all_done_rect.topleft = done_image_rect.topright relax_rect.left = all_done_rect.left relax_rect.top = all_done_rect.bottom + self.v_spacing self.screen.blit(self.done_img, done_image_rect) self.screen.blit(relax_surf, relax_rect) self.screen.blit(all_done_surface, all_done_rect)
def draw_tasks(self): drawing_items = [] y = 0 for text in self.task_text(): text_surf, text_rect = text_objects( text, self.screen.theme.get_font("small", "sans"), self.screen.theme.font_color, ) text_rect.top = y y = text_rect.bottom + self.v_spacing drawing_items.append((text_rect, text_surf)) if drawing_items: q = [x[0] for x in drawing_items] entire_rect = q[0].unionall(q[1:]) self.screen.rects[self.config["id"]] = entire_rect entire_rect = set_position(entire_rect, self.screen.rects, self.config) x = entire_rect.left y = entire_rect.top for rect, surface in drawing_items: rect.topleft = (x, y) y = rect.bottom + self.v_spacing self.screen.blit(surface, rect)
def draw(self): now = self.screen.utc_time.astimezone(self.expected_tz).strftime( self.time_format) text_surf = self.font.render(now, True, self.color) text_rect = text_surf.get_rect() text_rect = set_position(text_rect, self.screen.rects, self.config) self.screen.rects[self.id] = text_rect self.screen.blit(text_surf, text_rect)
def draw(self): if self.img: font = self.screen.theme.get_font("extra_small", "sans") text = f"{self.coin}: ${round(self.current, 2):,.2f}" surface = font.render(text, True, self.screen.theme.get_primary_color()) text_rect = surface.get_rect() img_rect = self.img.get_rect() img_rect.topright = text_rect.bottomright entire_rect = text_rect.union(img_rect) set_position(entire_rect, self.screen.rects, self.config) self.screen.rects[self.config.get("id")] = entire_rect text_rect.topright = entire_rect.topright img_rect.topright = text_rect.bottomright self.screen.blit(surface, text_rect) self.screen.blit(self.img, img_rect)