summaryrefslogtreecommitdiffstats
path: root/screens
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2022-08-26 03:48:27 -0400
committerdusoleil <howcansocksbereal@gmail.com>2022-08-26 03:48:27 -0400
commitfebc05f628793d252066a173e8fce0826b2190fd (patch)
tree163b05a21767704b70a1add51d94abc2f64f3b97 /screens
parent4dc99b2d0ac8cb741d1cd968d46026fae70d031e (diff)
downloadPlanner-febc05f628793d252066a173e8fce0826b2190fd.tar.gz
Planner-febc05f628793d252066a173e8fce0826b2190fd.zip
Flesh Out Navigation and Populate Screens with Data
Diffstat (limited to 'screens')
-rw-r--r--screens/Task/Body.gd12
-rw-r--r--screens/Task/Body.tscn10
-rw-r--r--screens/Task/Header.gd5
-rw-r--r--screens/Task/Header.tscn1
-rw-r--r--screens/Task/SubtaskItem.gd4
-rw-r--r--screens/Task/SubtaskItem.tscn6
-rw-r--r--screens/TimeSlot/Body.gd13
-rw-r--r--screens/TimeSlot/Body.tscn6
-rw-r--r--screens/TimeSlot/Header.gd5
-rw-r--r--screens/TimeSlot/Header.tscn1
-rw-r--r--screens/TimeSlot/TaskItem.gd17
-rw-r--r--screens/TimeSlot/TaskItem.tscn15
12 files changed, 80 insertions, 15 deletions
diff --git a/screens/Task/Body.gd b/screens/Task/Body.gd
new file mode 100644
index 0000000..05c9e9e
--- /dev/null
+++ b/screens/Task/Body.gd
@@ -0,0 +1,12 @@
+extends VBoxContainer
+
+func populate(data):
+ $"%Length".text = "%d min" % data.estimated_length
+ $"%Description".text = data.description if data.description != null else ""
+ var tasks = SubTask.get_by_task(data.id)
+ var SubTaskItem = load("res://screens/Task/SubTaskItem.tscn")
+ var task_list = $"%SubTaskList"
+ for task in tasks:
+ var item = SubTaskItem.instance()
+ item.populate(task)
+ task_list.add_child(item) \ No newline at end of file
diff --git a/screens/Task/Body.tscn b/screens/Task/Body.tscn
index 9185ad4..7f57ab2 100644
--- a/screens/Task/Body.tscn
+++ b/screens/Task/Body.tscn
@@ -1,7 +1,7 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://fonts/DroidSans.ttf" type="DynamicFontData" id=1]
-[ext_resource path="res://screens/Task/SubtaskItem.tscn" type="PackedScene" id=2]
+[ext_resource path="res://screens/Task/Body.gd" type="Script" id=3]
[sub_resource type="DynamicFont" id=2]
size = 100
@@ -16,12 +16,14 @@ margin_left = 20.0
margin_top = 20.0
margin_right = 1046.0
margin_bottom = 1664.0
+script = ExtResource( 3 )
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_right = 1026.0
margin_bottom = 300.0
[node name="Length" type="Label" parent="HBoxContainer"]
+unique_name_in_owner = true
margin_right = 511.0
margin_bottom = 300.0
rect_min_size = Vector2( 0, 300 )
@@ -32,6 +34,7 @@ valign = 1
clip_text = true
[node name="Description" type="TextEdit" parent="HBoxContainer"]
+unique_name_in_owner = true
margin_left = 515.0
margin_right = 1026.0
margin_bottom = 300.0
@@ -48,10 +51,7 @@ margin_right = 1026.0
margin_bottom = 1644.0
size_flags_vertical = 3
-[node name="SubtaskList" type="VBoxContainer" parent="ScrollContainer"]
+[node name="SubTaskList" type="VBoxContainer" parent="ScrollContainer"]
unique_name_in_owner = true
margin_right = 1026.0
-margin_bottom = 110.0
size_flags_horizontal = 3
-
-[node name="TaskItem" parent="ScrollContainer/SubtaskList" instance=ExtResource( 2 )]
diff --git a/screens/Task/Header.gd b/screens/Task/Header.gd
index ed2fe98..8f6c3f7 100644
--- a/screens/Task/Header.gd
+++ b/screens/Task/Header.gd
@@ -1,4 +1,7 @@
extends HBoxContainer
+func populate(data):
+ $"%Name".text = data.name
+
func _on_Back_button_up():
- $"/root/Main".nav_screen("TimeSlot")
+ $"/root/Main".nav_back()
diff --git a/screens/Task/Header.tscn b/screens/Task/Header.tscn
index 89e488c..66cb874 100644
--- a/screens/Task/Header.tscn
+++ b/screens/Task/Header.tscn
@@ -15,6 +15,7 @@ margin_bottom = 198.0
script = ExtResource( 2 )
[node name="Name" type="Label" parent="."]
+unique_name_in_owner = true
margin_top = 30.0
margin_right = 799.0
margin_bottom = 147.0
diff --git a/screens/Task/SubtaskItem.gd b/screens/Task/SubtaskItem.gd
new file mode 100644
index 0000000..157ed5c
--- /dev/null
+++ b/screens/Task/SubtaskItem.gd
@@ -0,0 +1,4 @@
+extends MarginContainer
+
+func populate(data):
+ $"Button".text = data.name \ No newline at end of file
diff --git a/screens/Task/SubtaskItem.tscn b/screens/Task/SubtaskItem.tscn
index 48fc590..11bcd0b 100644
--- a/screens/Task/SubtaskItem.tscn
+++ b/screens/Task/SubtaskItem.tscn
@@ -1,16 +1,18 @@
-[gd_scene load_steps=3 format=2]
+[gd_scene load_steps=4 format=2]
[ext_resource path="res://fonts/DroidSans.ttf" type="DynamicFontData" id=1]
+[ext_resource path="res://screens/Task/SubtaskItem.gd" type="Script" id=2]
[sub_resource type="DynamicFont" id=1]
size = 72
font_data = ExtResource( 1 )
-[node name="TaskItem" type="MarginContainer"]
+[node name="SubTaskItem" type="MarginContainer"]
margin_right = 1026.0
margin_bottom = 110.0
custom_constants/margin_top = 5
custom_constants/margin_bottom = 5
+script = ExtResource( 2 )
[node name="Button" type="Button" parent="."]
margin_top = 5.0
diff --git a/screens/TimeSlot/Body.gd b/screens/TimeSlot/Body.gd
new file mode 100644
index 0000000..aa1f352
--- /dev/null
+++ b/screens/TimeSlot/Body.gd
@@ -0,0 +1,13 @@
+extends VBoxContainer
+
+func populate(data):
+ var start_time = DataHelpers.timeofday(data.start_time)
+ var end_time = DataHelpers.timeofday(data.end_time)
+ $"%TimeRange".text = "%s - %s" % [start_time, end_time]
+ var tasks = Task.get_by_timeslot(data.id)
+ var TaskItem = load("res://screens/TimeSlot/TaskItem.tscn")
+ var task_list = $"%TaskList"
+ for task in tasks:
+ var item = TaskItem.instance()
+ item.populate(task)
+ task_list.add_child(item)
diff --git a/screens/TimeSlot/Body.tscn b/screens/TimeSlot/Body.tscn
index 2e6460a..0456acb 100644
--- a/screens/TimeSlot/Body.tscn
+++ b/screens/TimeSlot/Body.tscn
@@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://fonts/DroidSans.ttf" type="DynamicFontData" id=1]
-[ext_resource path="res://screens/TimeSlot/TaskItem.tscn" type="PackedScene" id=2]
+[ext_resource path="res://screens/TimeSlot/Body.gd" type="Script" id=3]
[sub_resource type="DynamicFont" id=2]
size = 100
@@ -12,6 +12,7 @@ margin_left = 20.0
margin_top = 20.0
margin_right = 1046.0
margin_bottom = 1664.0
+script = ExtResource( 3 )
[node name="TimeRange" type="Label" parent="."]
unique_name_in_owner = true
@@ -31,7 +32,4 @@ size_flags_vertical = 3
[node name="TaskList" type="VBoxContainer" parent="ScrollContainer"]
unique_name_in_owner = true
margin_right = 1026.0
-margin_bottom = 110.0
size_flags_horizontal = 3
-
-[node name="TaskItem" parent="ScrollContainer/TaskList" instance=ExtResource( 2 )]
diff --git a/screens/TimeSlot/Header.gd b/screens/TimeSlot/Header.gd
index 009a9b4..8f6c3f7 100644
--- a/screens/TimeSlot/Header.gd
+++ b/screens/TimeSlot/Header.gd
@@ -1,4 +1,7 @@
extends HBoxContainer
+func populate(data):
+ $"%Name".text = data.name
+
func _on_Back_button_up():
- $"/root/Main".nav_screen("Task")
+ $"/root/Main".nav_back()
diff --git a/screens/TimeSlot/Header.tscn b/screens/TimeSlot/Header.tscn
index 2823e6a..eec311c 100644
--- a/screens/TimeSlot/Header.tscn
+++ b/screens/TimeSlot/Header.tscn
@@ -15,6 +15,7 @@ margin_bottom = 198.0
script = ExtResource( 2 )
[node name="Name" type="Label" parent="."]
+unique_name_in_owner = true
margin_top = 30.0
margin_right = 799.0
margin_bottom = 147.0
diff --git a/screens/TimeSlot/TaskItem.gd b/screens/TimeSlot/TaskItem.gd
new file mode 100644
index 0000000..c2ab487
--- /dev/null
+++ b/screens/TimeSlot/TaskItem.gd
@@ -0,0 +1,17 @@
+extends MarginContainer
+
+var task_id
+
+func populate(data):
+ task_id = data.id
+ $"%Name".text = data.name
+ $"%Length".text = "%d min" % data.estimated_length
+ var freq = $"%Frequency"
+ freq.text = DataHelpers.frequency(data.frequency)
+ if freq.text.length() > 10:
+ freq["custom_fonts/font"] = freq["custom_fonts/font"].duplicate()
+ freq["custom_fonts/font"].size /= 2
+
+
+func _on_Button_button_up():
+ $"/root/Main".nav_screen("Task", Task, "get_by_id", [task_id])
diff --git a/screens/TimeSlot/TaskItem.tscn b/screens/TimeSlot/TaskItem.tscn
index 75ef95d..1a9948d 100644
--- a/screens/TimeSlot/TaskItem.tscn
+++ b/screens/TimeSlot/TaskItem.tscn
@@ -1,16 +1,22 @@
-[gd_scene load_steps=3 format=2]
+[gd_scene load_steps=5 format=2]
[ext_resource path="res://fonts/DroidSans.ttf" type="DynamicFontData" id=1]
+[ext_resource path="res://screens/TimeSlot/TaskItem.gd" type="Script" id=2]
[sub_resource type="DynamicFont" id=1]
size = 72
font_data = ExtResource( 1 )
+[sub_resource type="DynamicFont" id=2]
+size = 72
+font_data = ExtResource( 1 )
+
[node name="TaskItem" type="MarginContainer"]
margin_right = 1026.0
margin_bottom = 110.0
custom_constants/margin_top = 5
custom_constants/margin_bottom = 5
+script = ExtResource( 2 )
[node name="Button" type="Button" parent="."]
margin_top = 5.0
@@ -24,6 +30,7 @@ margin_bottom = 100.0
alignment = 2
[node name="Name" type="Label" parent="Button/HBoxContainer"]
+unique_name_in_owner = true
margin_top = 8.0
margin_right = 493.0
margin_bottom = 92.0
@@ -33,6 +40,7 @@ text = "Stretching"
clip_text = true
[node name="Length" type="Label" parent="Button/HBoxContainer"]
+unique_name_in_owner = true
margin_left = 497.0
margin_top = 8.0
margin_right = 722.0
@@ -42,12 +50,15 @@ text = "10 min"
align = 2
[node name="Frequency" type="Label" parent="Button/HBoxContainer"]
+unique_name_in_owner = true
margin_left = 726.0
margin_top = 8.0
margin_right = 1026.0
margin_bottom = 92.0
rect_min_size = Vector2( 300, 0 )
-custom_fonts/font = SubResource( 1 )
+custom_fonts/font = SubResource( 2 )
text = "Daily"
align = 2
clip_text = true
+
+[connection signal="button_up" from="Button" to="." method="_on_Button_button_up"]