extends Control onready var story_list = $board/story_list onready var card_list = $board/card_list onready var post_it_list = $board/label_list/postIt_list onready var connections_list = $board/label_list/connections_list onready var final_list = $board/final_list onready var story_template = $"templates/Ingest Story" onready var card_template = $"templates/Ingest Card" onready var connection_template = $"templates/Ingest Connection" onready var post_it_template = $"templates/Ingest Post-It" onready var pick_template = $templates/Pick var copybuffer var pick_source var all_cards:Array = [] var all_post_its:Array = [] func _on_add_story_pressed(): var tmp = story_template.duplicate() tmp.show() story_list.add_child(tmp) func show_labels(source): pick_source = source for child in final_list.get_children(): final_list.remove_child(child) for post_it in all_post_its: pick_template.pick = post_it final_list.add_child(pick_template.duplicate()) func pick(pick): pick_source.select(pick) pick_source = null func copy(buffer): copybuffer = buffer func paste(): return copybuffer func _on_save_pressed(): var save_stories = File.new() save_stories.open("res://dev-util/export.save", File.WRITE) var stories = [] for story in story_list.get_children(): stories.append(story.save()) var cards = [] for card in all_cards: cards.append(card.save()) var postits = [] for postit in all_post_its: postits.append(postit.save()) var connections = [] for connection in connections_list.get_children(): connections.append(connection.save()) var save_dict = { stories = stories, cards = cards, postits = postits, connections = connections } save_stories.store_line(to_json(save_dict)) save_stories.close() func import_from_file(fileName:String): var import_source = File.new() import_source.open(fileName, File.READ) var import_dict = parse_json(import_source.get_as_text()) import_source.close() for story in import_dict.stories: var new_story = story_template.duplicate() var new_items = new_story.digest(story, import_dict.cards, import_dict.postits, import_dict.connections) new_story.show() story_list.add_child(new_story) all_cards.append_array(new_items.new_cards) all_post_its.append_array(new_items.new_postits)