From 18a2579024ae59e9e36cfcd83823b43eac281135 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 2 Oct 2023 03:15:43 +0200 Subject: [PATCH] show database tasks! --- scenes/todo_list/ToDoList.gd | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scenes/todo_list/ToDoList.gd b/scenes/todo_list/ToDoList.gd index 11d745c..d9024a9 100644 --- a/scenes/todo_list/ToDoList.gd +++ b/scenes/todo_list/ToDoList.gd @@ -20,6 +20,16 @@ func _on_Back_pressed(): # return to menu emit_signal("scene_changed", "res://scenes/main_menu/MainMenu.tscn") +func load_tasks(): + var tasks := DB.get_todo_tasks(false) + + for task in tasks: + var el = load("res://custom_elements/todo_list_elements/todo_element.tscn").instantiate() + reorderable_list.call_deferred("add_child", el) + el.call_deferred("set_task", task["rowid"], task["task"], task["done"], 0, task["priority"], "", "") + # TODO: make sure thre is no null before doing set_task + _add_empty_entry_at_bottom(3) + func DEBUG_put_lots_of_tasks(how_many: int): var text_arr := [ "text 1", @@ -49,5 +59,5 @@ func _add_empty_entry_at_bottom(how_many: int): func _on_ready(): bg = Thread.new() - bg.start(DEBUG_put_lots_of_tasks.bind(20)) + bg.start(load_tasks) -- 2.30.2