def __init__(self, width=800, height=600, flags=0, fps=20): super(AppWidget, self).__init__(text='', pos=Point((0,0)), size=Point((width, height))) self.fps = fps from twisted.internet.task import LoopingCall self._lc = LoopingCall(self._iteration) self.set_size(width, height, flags) self.params.back_color = (0,0,0) self.last_surface = None from Lib.Font import get_font self._fps_font = get_font(30) self._count = 0
def render_group_text(self, parent_offset, surface): if not self.params.show_group_name: return if not self.node.value.group_name: return font_height = self.font.get_height() group_font_height = font_height / 3 text = self.node.value.group_name label_pos = parent_offset + self.pos.current if (not self.cached_group_rendered_text or font_height != self.cached_font_height or text != self.cached_group_text): self.cached_group_text = text self.cached_font_height = font_height text_color = self.get_current_text_color() group_name_font = get_font(group_font_height) self.cached_group_rendered_text = group_name_font.render(text, True, text_color) surface.blit(self.cached_group_rendered_text, tuple(label_pos))
def update_default_font(self): self.default_font = get_font(self.font_size)