def __init__(self, node=None, out_edges=None, *args, **kw): super(NodeWidget, self).__init__(*args, **kw) self.out_edges = get_default(out_edges, {}) if node: self.set_node(node) from Shapes.Ellipse import Ellipse self.shape = Ellipse(pygame.Rect(self.get_current_rect())) self.params.add_allowed_name('show_group_name') self.params.show_group_name = True self.shape_image = load_image("images/circle_purple_gray.png") self.focused_shape_image = load_image("images/circle.png") self.hovered_shape_image = load_image("images/circle_purple.png")
def __init__(self, *args, **kw): super(GraphWidget, self).__init__(*args, **kw) #pygame.display.set_caption('Graphui | Enough') self.dot = Dot() self.init_control_map() self.dragging_enabled = False self.connecting = False self.disconnecting = False self.preserve_aspect_ratio = True self.bezier_points = 30 self.popup_menu_widget = None self.dot_prog_num = 0 self.status_font = pygame.font.SysFont('serif',min(self.size.final.y/30, 12)) self.rendered_status_texts = [] self.set_status_text(message,15) self.set_status_text('CTRL-H for help', 15) self.set_status_text('Right-Click for menu', 15) self.pan_start_pos = None self.reset_zoom_pan() # TODO get rid of shape in Widget (move it to some ShapeWidget or whatever) #self.shape = None #self.params.fore_color = None self.params.back_color = None self.params.focus_back_color = (20,20,50) self.params.hover_back_color = (10,10,25) self.params.focus_fore_color = (150,150,255) self.params.enabled = False self._last_group = 0 self.rect_image = load_image("images/square_purple_gray.png") self.focused_rect_image = load_image("images/square.png") self.hovered_rect_image = load_image("images/square_purple.png")