From: Eduardo Date: Mon, 2 Oct 2023 01:15:43 +0000 (+0200) Subject: show database tasks! X-Git-Url: http://git.edufdez.es/?a=commitdiff_plain;h=18a2579024ae59e9e36cfcd83823b43eac281135;p=The%20Cutests%20To-Do%20List.git show database tasks! --- 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)