def switch(self, value): if value: WidgetHandler.add_widget(self) Renderer.add_widget(self) else: WidgetHandler.del_widget(self) Renderer.del_widget(self)
def __init__(self, event): x, y = event.data['pos'] self.rect = Rect(x, y, 1, 1) self.color = COLOR_SELECTION super().__init__() Renderer.enable_selection(self) WidgetHandler.enable_selection(self)
def switch(self, event): if event.data['instance'] == 'MainTB': if event.data['value'] is False: WidgetHandler.add_widget(self) Renderer.add_widget(self) else: WidgetHandler.del_widget(self) Renderer.del_widget(self)
def __init__(self): super().__init__() self.f = font.SysFont('Verdana', 16) self.image = Surface((WIDTH, HEIGHT // 5)) self.image.fill(COLOR_BOX) self.rect = self.image.get_rect(bottomleft=(0, HEIGHT)) EventHandler.register(self.switch, 'ToggleTypeMode') WidgetHandler.add_widget(self) Renderer.add_widget(self)
def __init__(self, parent, center): super().__init__(parent) self.layer = 20 self.image = Surface((8, 8), SRCALPHA) draw.circle(self.image, COLOR_CONNECTION, (3, 3), 4) self.rect = self.image.get_rect(center=center) Renderer.add_widget(self) WidgetHandler.add_widget(self) EventHandler.register(self.toggle_selection, 'select', 'deselect')
def __init__(self, parent, idx, h, color): super().__init__(parent) self.image = Surface((10, h)) self.image.fill(color) self.rect = self.image.get_rect() self.x, self.y, self.w, self.h = self.rect self.idx = idx Renderer.add_widget(self) WidgetHandler.add_widget(self)
def __init__(self, parent, idx, char, fuente, color_f): super().__init__(parent) self.fuente = fuente self.char = char self.image = self.fuente.render(char, 1, color_f) self.rect = self.image.get_rect() self.x, self.y, self.w, self.h = self.rect self.idx = idx Renderer.add_widget(self) WidgetHandler.add_widget(self)
def __init__(self, parent_a, parent_b): super().__init__() self.parent_a = parent_a self.parent_b = parent_b self.handles = [self.parent_a, self.parent_b] self.image = self.create() self.rect = self.image.get_rect() self.layer = min([self.parent_a.layer, self.parent_b.layer]) - 1 Renderer.add_widget(self) WidgetHandler.add_widget(self) EventHandler.register(self.event_handle, 'AddMidPoint') EventHandler.register(self.delete, 'DeleteConnection')
def __init__(self, data): super().__init__() self.children = [] self.fuente = font.SysFont('Verdana', 10) self.layer = 1 self.tipo = data['text'] if data['text'] != '' else 'leaf' WidgetHandler.add_widget(self) Renderer.add_widget(self) self.image = self.create() if data['color'] is not None: self.colorize(data['color']) self.text = data['text'] self.rect = self.image.get_rect(center=data['pos']) EventHandler.register(self.toggle_selection, 'select', 'deselect')
def switch(self, event): instance = System.MAIN_TB if event.data[ 'instance'] == 'MainTB' else event.data['instance'] if instance is self: if event.data['value'] is True: WidgetHandler.add_widget(self) Renderer.add_widget(self) EventHandler.register(self.filter, 'Key') self.cursor.switch(True) else: self.return_text() self.clear() WidgetHandler.del_widget(self) Renderer.del_widget(self) EventHandler.deregister(self.filter, 'Key') self.cursor.switch(False)
def on_mouseup(self, event): self.rect.normalize() EventHandler.trigger('EndSelection', 'SelectionObject', {'value': False}) Renderer.del_widget(self) WidgetHandler.del_widget(self)
def remove(self): Renderer.del_widget(self) WidgetHandler.del_widget(self)
def kill(self): WidgetHandler.del_widget(self) Renderer.del_widget(self) super().kill()