def delete_link(sender, link): """ Deletes a link and removes the topics (in and out) it represents from the corresponding nodes :param sender: Not used :param link: The id of the link item :return: Nothing """ global links_dict link_conf = dpg.get_item_configuration(link) output_node = link_conf['user_data']['node_id_out'] input_node = link_conf['user_data']['node_id_in'] topic_out = link_conf['user_data']['topic_out'] topic_in = link_conf['user_data']['topic_in'].replace(' ', '_') del links_dict[topic_out.split('-')[0]] topic_out = topic_out.replace(' ', '_') for n in nodes_list: if output_node == n.id: n.remove_topic_out(topic_out) n.links_list.remove(link) if input_node == n.id: n.remove_topic_in(topic_in) n.links_list.remove(link) dpg.delete_item(link)
def ignore(): file = dpg.get_value(files_id) if file is not None: items = dpg.get_item_configuration(files_id)["items"] ignore_files = dpg.get_item_configuration(ignore_id)["items"] ignore_files.append(file) dpg.configure_item(ignore_id, items=ignore_files) index = -1 found_index = 0 for item in items: index += 1 if item == file: found_index = index break del items[found_index] dpg.configure_item(files_id, items=items) callback(None)
def add_file_if_new(file): items = dpg.get_item_configuration(files_id)["items"] new_items = [file] for item in items: if item != file: new_items.append(item) dpg.configure_item(files_id, items=new_items)
def parse_node(self): lines = [] with open(self.file_path, "r") as file: lines = file.readlines() for line in lines: if line.__contains__('#include "'): split_line = line.split('"') if split_line[1] not in dpg.get_item_configuration(ignore_id)["items"]: add_file_if_new(split_line[1]) self.links.append(IncludeNode(split_line[1], self.level+1))
def cb_table_result_selected(row_tag): children = get_item_children(row_tag) child_value = get_item_configuration(children[1][0])['label'] _load_record_from_id(_try_parse_int(child_value))
def fvalue(self, instance: Widget) -> Any: return dpgcore.get_item_configuration(instance.id)[self.key]
def get_config(self) -> ItemConfigData: return dpgcore.get_item_configuration(self.id)
def display_raw_configuration(self) -> t.Dict: """ Note that raw dpg_id is not treated """ return dpg.get_item_configuration(item=self.dpg_id)