def __init__(self, i, tail=None, head=None, data=None, color=None, **kwargs): super(Edge, self).__init__(**kwargs) if there_is(tail): self.tail_x, self.tail_y = tail if there_is(head): self.head_x, self.head_y = head if there_is(color): self.normal_color = color if there_is(data): self.data = data self.ids['handle'].color = self.normal_color self.x_mod = zero_patch(self.head_x, self.tail_x) self.y_mod = zero_patch(self.head_y, self.tail_y) self.i = i #tag to be displayed if the edge has no data self.null_tag = "edge "+str(self.i) self.tag = self.data[self.tag_index] if (len(self.data)>0) else self.null_tag self.info_box=Popup(title=self.tag, content=Label(text='<data void>'), size_hint=(None,None), size=popup_size) self.ids['handle'].bind(on_release=self.interact)
def __init__(self, i, tail=None, head=None, data=None, color=None, **kwargs): super(Edge, self).__init__(**kwargs) if there_is(tail): self.tail_x, self.tail_y = tail if there_is(head): self.head_x, self.head_y = head if there_is(color): self.normal_color = color if there_is(data): self.data = data self.ids['handle'].color = self.normal_color self.x_mod = zero_patch(self.head_x, self.tail_x) self.y_mod = zero_patch(self.head_y, self.tail_y) self.i = i #tag to be displayed if the edge has no data self.null_tag = "edge " + str(self.i) self.tag = self.data[self.tag_index] if ( len(self.data) > 0) else self.null_tag self.info_box = Popup(title=self.tag, content=Label(text='<data void>'), size_hint=(None, None), size=popup_size) self.ids['handle'].bind(on_release=self.interact)
def clear_selection(self): if there_is(self.selection_1): if type(self.selection_1) is int: self.get_graph_node(self.selection_1).deselect() elif type(self.selection_1) is tuple: self.get_graph_edge(self.selection_1).deselect() if there_is(self.selection_2): if type(self.selection_2) is int: self.get_graph_node(self.selection_2).deselect() elif type(self.selection_2) is tuple: self.get_graph_edge(self.selection_2).deselect() self.selection_1, self.selection_2 = None, None
def toggle_active(self, id): if there_is(self.auto_function[id]): self.auto_function[id] = None else: self.auto_function[id] = self.graph_tools.index[id] self.refresh_graph()
def show_load(self): if there_is(self.ids['window'].get_ctrl().item_tools): self.ids['window'].get_ctrl().refresh_graph() content = LoadDialog(load=self.load, cancel=self.dismiss_popup) self._popup = Popup(title="Load file", content=content, size_hint=(0.9, 0.9)) self._popup.open()
def __init__(self, i, data=None, color=None, **kwargs): super(Node,self).__init__(**kwargs) self.i = i self.pos_x, self.pos_y = self.pos self.ids['handle'].bind(on_release=self.interact) if there_is(color): self.color = color if there_is(data): self.data = data self.ids['handle'].color = self.color #tag to be displayed if the node has no data self.null_tag = "node "+str(self.i) self.tag = self.data[self.tag_index] if (len(self.data)>0) else self.null_tag self.info_box=Popup(title=self.tag, content=Label(text='<data void>'), size_hint=(None,None), size=popup_size)
def __init__(self, i, data=None, color=None, **kwargs): super(Node, self).__init__(**kwargs) self.i = i self.pos_x, self.pos_y = self.pos self.ids['handle'].bind(on_release=self.interact) if there_is(color): self.color = color if there_is(data): self.data = data self.ids['handle'].color = self.color #tag to be displayed if the node has no data self.null_tag = "node " + str(self.i) self.tag = self.data[self.tag_index] if ( len(self.data) > 0) else self.null_tag self.info_box = Popup(title=self.tag, content=Label(text='<data void>'), size_hint=(None, None), size=popup_size)
def remove_leveler(self): if there_is(self.leveler): self.ids['back_drop'].remove_widget(self.leveler)
def __init__(self, scale_index=None, **kwargs): super(GraphItems,self).__init__(**kwargs) if there_is(scale_index): self.scale_index = scale_index
def run_auto(self): for function in self.auto_function: if there_is(function): function(self.selection_1,self.selection_2)
def __init__(self, scale_index=None, **kwargs): super(GraphItems, self).__init__(**kwargs) if there_is(scale_index): self.scale_index = scale_index
def run_auto(self): for function in self.auto_function: if there_is(function): function(self.selection_1, self.selection_2)