-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew_task.gd
More file actions
43 lines (28 loc) · 862 Bytes
/
Copy pathnew_task.gd
File metadata and controls
43 lines (28 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
extends Control
var app: Control
@onready var title := $Margin/Pane/Body/Title
@onready var description := $Margin/Pane/Body/Description
func setup(new_app: Control):
app = new_app
title.grab_focus()
func _on_AddTaskBtn_pressed() -> void:
if title.text == "":
var new_style := StyleBoxFlat.new()
new_style.bg_color = Color("#802000", 0.25)
title.add_theme_stylebox_override("focus", new_style)
title.placeholder_text = "Task must have a title..."
title.grab_focus()
return
if description.text == "":
description.text = "No description."
var task := {
"title": title.text,
"description": description.text,
}
app.new_task(task)
queue_free()
func _on_cancel_btn_pressed() -> void:
queue_free()
func _on_title_text_submitted(new_text: String) -> void:
description.grab_focus()
# DisplayServer.virtual_keyboard_show("")