From 2532525817b75b9d1fd56a8f00de6f030c5773a9 Mon Sep 17 00:00:00 2001 From: hobbesjaap Date: Sat, 5 Apr 2025 16:03:55 +0800 Subject: [PATCH] created updating sidebar for visual signposting --- godot/Assets/icons/noun-chat-92638.svg | 3 +- godot/Assets/icons/noun-dutch-1054558.svg | 2 +- godot/Assets/icons/noun-english-1054579.svg | 2 +- godot/Assets/icons/noun-file-59659.svg | 3 +- .../Assets/icons/noun-floppy-disk-104320.svg | 2 +- godot/Assets/icons/noun-glasses-56317.svg | 3 +- godot/Assets/icons/noun-history-101708.svg | 2 +- .../Assets/icons/noun-input-field-104354.svg | 2 +- godot/Assets/icons/noun-manual-241665.svg | 2 +- godot/Assets/icons/noun-message-92639.svg | 2 +- godot/Assets/icons/noun-power-101711.svg | 2 +- godot/Assets/icons/noun-press-104313.svg | 2 +- godot/Assets/icons/noun-settings-56313.svg | 2 +- godot/Assets/icons/noun-upgrade-104308.svg | 2 +- godot/ObservationWindow.gd | 1 + godot/global_ints.gd | 3 + godot/main_screen.gd | 64 +++++++++- godot/main_screen.tscn | 112 ++++++++++++------ 18 files changed, 160 insertions(+), 51 deletions(-) diff --git a/godot/Assets/icons/noun-chat-92638.svg b/godot/Assets/icons/noun-chat-92638.svg index 562c7cf..c6c56e2 100644 --- a/godot/Assets/icons/noun-chat-92638.svg +++ b/godot/Assets/icons/noun-chat-92638.svg @@ -1,4 +1,5 @@ + - + diff --git a/godot/Assets/icons/noun-dutch-1054558.svg b/godot/Assets/icons/noun-dutch-1054558.svg index f778355..574f0c3 100644 --- a/godot/Assets/icons/noun-dutch-1054558.svg +++ b/godot/Assets/icons/noun-dutch-1054558.svg @@ -1,6 +1,6 @@ - + diff --git a/godot/Assets/icons/noun-english-1054579.svg b/godot/Assets/icons/noun-english-1054579.svg index 551ed2b..8c9d72f 100644 --- a/godot/Assets/icons/noun-english-1054579.svg +++ b/godot/Assets/icons/noun-english-1054579.svg @@ -1,6 +1,6 @@ - + diff --git a/godot/Assets/icons/noun-file-59659.svg b/godot/Assets/icons/noun-file-59659.svg index b24fb5c..b3afae2 100644 --- a/godot/Assets/icons/noun-file-59659.svg +++ b/godot/Assets/icons/noun-file-59659.svg @@ -1,4 +1,5 @@ + - + diff --git a/godot/Assets/icons/noun-floppy-disk-104320.svg b/godot/Assets/icons/noun-floppy-disk-104320.svg index 82c4715..4d8251f 100644 --- a/godot/Assets/icons/noun-floppy-disk-104320.svg +++ b/godot/Assets/icons/noun-floppy-disk-104320.svg @@ -1,6 +1,6 @@ - + diff --git a/godot/Assets/icons/noun-glasses-56317.svg b/godot/Assets/icons/noun-glasses-56317.svg index cdafa1c..12e22c0 100644 --- a/godot/Assets/icons/noun-glasses-56317.svg +++ b/godot/Assets/icons/noun-glasses-56317.svg @@ -1,4 +1,5 @@ + - + diff --git a/godot/Assets/icons/noun-history-101708.svg b/godot/Assets/icons/noun-history-101708.svg index 8d23a7c..9b939c3 100644 --- a/godot/Assets/icons/noun-history-101708.svg +++ b/godot/Assets/icons/noun-history-101708.svg @@ -1,6 +1,6 @@ - + diff --git a/godot/Assets/icons/noun-input-field-104354.svg b/godot/Assets/icons/noun-input-field-104354.svg index e5d8066..11c5cc6 100644 --- a/godot/Assets/icons/noun-input-field-104354.svg +++ b/godot/Assets/icons/noun-input-field-104354.svg @@ -1,6 +1,6 @@ - + diff --git a/godot/Assets/icons/noun-manual-241665.svg b/godot/Assets/icons/noun-manual-241665.svg index 4fc9988..361c2a0 100644 --- a/godot/Assets/icons/noun-manual-241665.svg +++ b/godot/Assets/icons/noun-manual-241665.svg @@ -1,6 +1,6 @@ - + diff --git a/godot/Assets/icons/noun-message-92639.svg b/godot/Assets/icons/noun-message-92639.svg index 37afc3e..7beab9b 100644 --- a/godot/Assets/icons/noun-message-92639.svg +++ b/godot/Assets/icons/noun-message-92639.svg @@ -1,6 +1,6 @@ - + diff --git a/godot/Assets/icons/noun-power-101711.svg b/godot/Assets/icons/noun-power-101711.svg index ccd22a4..7b98145 100644 --- a/godot/Assets/icons/noun-power-101711.svg +++ b/godot/Assets/icons/noun-power-101711.svg @@ -1,6 +1,6 @@ - + diff --git a/godot/Assets/icons/noun-press-104313.svg b/godot/Assets/icons/noun-press-104313.svg index 24b437f..a5906f2 100644 --- a/godot/Assets/icons/noun-press-104313.svg +++ b/godot/Assets/icons/noun-press-104313.svg @@ -1,6 +1,6 @@ - + diff --git a/godot/Assets/icons/noun-settings-56313.svg b/godot/Assets/icons/noun-settings-56313.svg index a950abc..af9d344 100644 --- a/godot/Assets/icons/noun-settings-56313.svg +++ b/godot/Assets/icons/noun-settings-56313.svg @@ -1,6 +1,6 @@ - + diff --git a/godot/Assets/icons/noun-upgrade-104308.svg b/godot/Assets/icons/noun-upgrade-104308.svg index ab253da..1f92f04 100644 --- a/godot/Assets/icons/noun-upgrade-104308.svg +++ b/godot/Assets/icons/noun-upgrade-104308.svg @@ -1,6 +1,6 @@ - + diff --git a/godot/ObservationWindow.gd b/godot/ObservationWindow.gd index fb02b2e..8824d83 100644 --- a/godot/ObservationWindow.gd +++ b/godot/ObservationWindow.gd @@ -20,6 +20,7 @@ func _process(_delta) -> void: func calculate_percentages() -> void: + @warning_ignore("integer_division") global_ints.total_observed_time = global_ints.total_behaviours / 3 global_ints.one_behaviour_percent = int((float(global_ints.one_behaviour_score) / global_ints.total_behaviours) * 100) diff --git a/godot/global_ints.gd b/godot/global_ints.gd index 03442e8..ee08905 100644 --- a/godot/global_ints.gd +++ b/godot/global_ints.gd @@ -3,6 +3,9 @@ extends Node var date = {} var ddmmyyyy : String +# 1 = Instruction, 2 = Names, 3 = Config, 4 = Observe, 5 = Results +var app_state : int + var update_text : String var web_release_version : float diff --git a/godot/main_screen.gd b/godot/main_screen.gd index b5a46f9..6d7d269 100644 --- a/godot/main_screen.gd +++ b/godot/main_screen.gd @@ -6,13 +6,15 @@ var csv_url = "https://raw.githubusercontent.com/hobbesjaap/time-sampling-form/m var update_text_url = "https://raw.githubusercontent.com/hobbesjaap/time-sampling-form/main/updater/update_text.md" var update_text : String var text_buffer : String +var os_list : Array = ["Linux", "Windows", "macOS", "OSX"] @onready var date_time_display = $"%CurrentTime" @onready var minute_label = $"StartScreen/InstructionPanel/MinuteBox/MinuteLabel" +@onready var styleBox_highlight : StyleBoxFlat = $"%OneInstrPanel".get_theme_stylebox("panel").duplicate() +@onready var styleBox_orig : StyleBoxFlat = $"%TwoNamesPanel".get_theme_stylebox("panel").duplicate() func check_for_updates() -> void: - var os_list : Array = ["Linux", "Windows", "macOS", "OSX"] if os_list.has(OS.get_name()): print("We're on desktop. So let's check for updates!") $"%HTTPRequest".request(csv_url) @@ -87,13 +89,30 @@ func update_date() -> void: global_ints.date = Time.get_datetime_dict_from_system() global_ints.ddmmyyyy = str(global_ints.date.day, "-", global_ints.date.month, "-", global_ints.date.year) +func set_app_window_size() -> void: + var desktop_x : int = DisplayServer.screen_get_size(DisplayServer.window_get_current_screen()).x + var desktop_y : int = DisplayServer.screen_get_size(DisplayServer.window_get_current_screen()).y + + @warning_ignore("narrowing_conversion") + var app_window_x : int = desktop_x * 0.7 + @warning_ignore("narrowing_conversion") + var app_window_y : int = desktop_y * 0.7 + var app_window_size = Vector2i(app_window_x, app_window_y) + + DisplayServer.window_set_min_size(Vector2i(app_window_x, app_window_y)) + get_window().size = app_window_size + @warning_ignore("integer_division") + DisplayServer.window_set_position(Vector2i(int(desktop_x/6), int(desktop_y/6))) + func _ready() -> void: - DisplayServer.window_set_min_size(Vector2i(1280, 720)) + #DisplayServer.window_set_min_size(Vector2i(1280, 720)) + if os_list.has(OS.get_name()): + set_app_window_size() minute_label.text = str(global_ints.observation_minutes) global_ints.observed_person_name = "" refresh_descriptors() $"StartScreen".show() - $"%NameChangePanel".show() + $"%NameChangePanel".hide() $"%InstructionScreen".show() $"%WarningLabel".hide() $"ObservationWindow".hide() @@ -105,7 +124,45 @@ func _ready() -> void: check_for_updates() +func set_all_boxes_to_normal() -> void: + $"%OneInstrPanel".add_theme_stylebox_override("panel", styleBox_orig) + $"%TwoNamesPanel".add_theme_stylebox_override("panel", styleBox_orig) + $"%ThreeConfigPanel".add_theme_stylebox_override("panel", styleBox_orig) + $"%FourObservePanel".add_theme_stylebox_override("panel", styleBox_orig) + $"%FiveResultsPanel".add_theme_stylebox_override("panel", styleBox_orig) + + +func state_changed_check() -> void: + styleBox_highlight.set("bg_color", Color.html("#F2CC8F")) + + if $"%InstructionScreen".visible == true: + global_ints.app_state = 1 + set_all_boxes_to_normal() + $"%OneInstrPanel".add_theme_stylebox_override("panel", styleBox_highlight) + + if $"%NameChangePanel".visible == true: + global_ints.app_state = 2 + set_all_boxes_to_normal() + $"%TwoNamesPanel".add_theme_stylebox_override("panel", styleBox_highlight) + + if $"%InstructionPanel".visible == true: + global_ints.app_state = 3 + set_all_boxes_to_normal() + $"%ThreeConfigPanel".add_theme_stylebox_override("panel", styleBox_highlight) + + if $"%ObservationWindow".visible == true: + global_ints.app_state = 4 + set_all_boxes_to_normal() + $"%FourObservePanel".add_theme_stylebox_override("panel", styleBox_highlight) + + if $"%Results".visible == true: + global_ints.app_state = 5 + set_all_boxes_to_normal() + $"%FiveResultsPanel".add_theme_stylebox_override("panel", styleBox_highlight) + + func _process(_delta) -> void: + state_changed_check() check_time_var += 1 if check_time_var == 10: @@ -180,6 +237,7 @@ func _on_ChangeItems_pressed() -> void: func _on_InsOkButton_pressed() -> void: $"%InstructionScreen".hide() + $"%NameChangePanel".show() func _on_MinuteMinus_button_down() -> void: diff --git a/godot/main_screen.tscn b/godot/main_screen.tscn index 5a15917..f8db79f 100644 --- a/godot/main_screen.tscn +++ b/godot/main_screen.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=25 format=3 uid="uid://b1pk005at7x26"] +[gd_scene load_steps=29 format=3 uid="uid://b1pk005at7x26"] [ext_resource type="Theme" uid="uid://bki1nuccpiu3o" path="res://wb_theme.tres" id="1"] [ext_resource type="Script" uid="uid://rbmcgn3hetrs" path="res://main_screen.gd" id="2"] @@ -11,7 +11,11 @@ [ext_resource type="Script" uid="uid://dflvmgvxwqrrf" path="res://TimerBar.gd" id="10"] [ext_resource type="Script" uid="uid://t1pvqg6e78j" path="res://ProgressBar.gd" id="11"] [ext_resource type="Texture2D" uid="uid://yf4ormoh8hes" path="res://Assets/icons/main_icon.png" id="12"] +[ext_resource type="Texture2D" uid="uid://bq56uvokwfppt" path="res://Assets/icons/noun-manual-241665.svg" id="12_p3r6q"] [ext_resource type="Texture2D" uid="uid://lafpc8rl5lg0" path="res://Assets/icons/noun-input-field-104354.svg" id="12_vtqql"] +[ext_resource type="Texture2D" uid="uid://ddvmq6m5ux17h" path="res://Assets/icons/noun-settings-56313.svg" id="14_3qsiq"] +[ext_resource type="Texture2D" uid="uid://xjf2x5br6qq2" path="res://Assets/icons/noun-glasses-56317.svg" id="15_7087c"] +[ext_resource type="Texture2D" uid="uid://bvpi0st2kfg0" path="res://Assets/icons/noun-file-59659.svg" id="16_do8p6"] [sub_resource type="StyleBoxFlat" id="2"] bg_color = Color(1, 1, 1, 1) @@ -1206,7 +1210,6 @@ unique_name_in_owner = true unique_name_in_owner = true [node name="StartScreen" type="CanvasLayer" parent="."] -visible = false [node name="InstructionPanel" type="Panel" parent="StartScreen"] unique_name_in_owner = true @@ -1216,10 +1219,12 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = -640.0 +offset_left = -511.0 offset_top = -289.0 -offset_right = 640.0 -offset_bottom = 359.0 +offset_right = 630.0 +offset_bottom = 350.0 +grow_horizontal = 2 +grow_vertical = 2 theme_override_styles/panel = SubResource("1") [node name="MinuteBox" type="HBoxContainer" parent="StartScreen/InstructionPanel"] @@ -1253,26 +1258,31 @@ text = "+" [node name="CurrentTime" type="Label" parent="StartScreen/InstructionPanel"] unique_name_in_owner = true layout_mode = 0 -offset_left = 1196.0 -offset_top = 506.0 -offset_right = 1275.0 -offset_bottom = 529.0 +offset_left = 1067.0 +offset_top = 620.0 +offset_right = 1146.0 +offset_bottom = 643.0 theme_override_colors/font_color = Color(0, 0, 0, 1) theme_override_fonts/font = SubResource("4") text = "99:99" +horizontal_alignment = 2 [node name="MinuteExplanation" type="Label" parent="StartScreen/InstructionPanel"] -layout_mode = 0 +layout_mode = 1 +anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 offset_left = -322.5 -offset_top = -197.0 +offset_top = -203.0 offset_right = 322.5 -offset_bottom = -163.0 +offset_bottom = -169.0 +grow_horizontal = 2 +grow_vertical = 2 theme = ExtResource("1") text = "INSTR_OBS" +horizontal_alignment = 1 [node name="ObservationItemsTitle" type="Label" parent="StartScreen/InstructionPanel"] layout_mode = 0 @@ -1289,18 +1299,22 @@ theme_override_fonts/font = SubResource("5") text = "OBS_ITEMS" [node name="Title" type="Label" parent="StartScreen/InstructionPanel"] -layout_mode = 0 +layout_mode = 1 +anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = -172.5 -offset_top = -250.0 -offset_right = 172.5 -offset_bottom = -200.0 +offset_left = -174.5 +offset_top = -248.5 +offset_right = 170.5 +offset_bottom = -216.5 +grow_horizontal = 2 +grow_vertical = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) theme_override_fonts/font = SubResource("6") text = "TITLE" +horizontal_alignment = 1 [node name="BottomButtons" type="HBoxContainer" parent="StartScreen/InstructionPanel"] layout_mode = 0 @@ -1338,15 +1352,18 @@ theme = ExtResource("1") text = "BUT_STRT" [node name="GridObservations" type="GridContainer" parent="StartScreen/InstructionPanel"] -layout_mode = 0 +layout_mode = 1 +anchors_preset = 8 anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = -589.0 -offset_top = -57.0 -offset_right = 603.0 -offset_bottom = 167.0 +offset_left = -499.5 +offset_top = -56.5 +offset_right = 499.5 +offset_bottom = 167.5 +grow_horizontal = 2 +grow_vertical = 2 columns = 3 [node name="AcronymLabel" type="Label" parent="StartScreen/InstructionPanel/GridObservations"] @@ -1820,6 +1837,7 @@ offset_bottom = 649.0 text = "BUT_CLEAR" [node name="ObservationWindow" type="CanvasLayer" parent="."] +unique_name_in_owner = true visible = false script = ExtResource("7") @@ -2000,6 +2018,7 @@ unique_name_in_owner = true wait_time = 20.0 [node name="Results" type="CanvasLayer" parent="."] +unique_name_in_owner = true visible = false script = ExtResource("9") @@ -2165,13 +2184,19 @@ offset_right = 120.0 offset_bottom = 660.0 theme_override_constants/separation = 0 -[node name="Panel" type="Panel" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer"] +[node name="OneInstrPanel" type="Panel" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer"] +unique_name_in_owner = true custom_minimum_size = Vector2(120, 120) layout_mode = 2 size_flags_vertical = 3 theme_override_styles/panel = SubResource("StyleBoxFlat_musqq") -[node name="Instructions" type="Label" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/Panel"] +[node name="Noun-manual-241665" type="Sprite2D" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/OneInstrPanel"] +position = Vector2(59, 58) +scale = Vector2(0.04, 0.04) +texture = ExtResource("12_p3r6q") + +[node name="Instructions" type="Label" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/OneInstrPanel"] layout_mode = 1 anchors_preset = 7 anchor_left = 0.5 @@ -2190,18 +2215,19 @@ theme_override_font_sizes/font_size = 14 text = "LAB_INSTR" horizontal_alignment = 1 -[node name="Panel2" type="Panel" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer"] +[node name="TwoNamesPanel" type="Panel" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer"] +unique_name_in_owner = true custom_minimum_size = Vector2(0, 120) layout_mode = 2 size_flags_vertical = 3 theme_override_styles/panel = SubResource("StyleBoxFlat_musqq") -[node name="Noun-input-field-104354" type="Sprite2D" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/Panel2"] -position = Vector2(60, 64) +[node name="Noun-input-field-104354" type="Sprite2D" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/TwoNamesPanel"] +position = Vector2(60, 59) scale = Vector2(0.04, 0.04) texture = ExtResource("12_vtqql") -[node name="Names" type="Label" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/Panel2"] +[node name="Names" type="Label" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/TwoNamesPanel"] layout_mode = 1 anchors_preset = 7 anchor_left = 0.5 @@ -2220,13 +2246,19 @@ theme_override_font_sizes/font_size = 14 text = "LAB_NAMES" horizontal_alignment = 1 -[node name="Panel3" type="Panel" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer"] +[node name="ThreeConfigPanel" type="Panel" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer"] +unique_name_in_owner = true custom_minimum_size = Vector2(0, 120) layout_mode = 2 size_flags_vertical = 3 theme_override_styles/panel = SubResource("StyleBoxFlat_musqq") -[node name="Configure" type="Label" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/Panel3"] +[node name="Noun-settings-56313" type="Sprite2D" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/ThreeConfigPanel"] +position = Vector2(59, 60) +scale = Vector2(0.04, 0.04) +texture = ExtResource("14_3qsiq") + +[node name="Configure" type="Label" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/ThreeConfigPanel"] layout_mode = 1 anchors_preset = 7 anchor_left = 0.5 @@ -2245,13 +2277,19 @@ theme_override_font_sizes/font_size = 14 text = "LAB_CONFIG" horizontal_alignment = 1 -[node name="Panel4" type="Panel" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer"] +[node name="FourObservePanel" type="Panel" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer"] +unique_name_in_owner = true custom_minimum_size = Vector2(0, 120) layout_mode = 2 size_flags_vertical = 3 theme_override_styles/panel = SubResource("StyleBoxFlat_musqq") -[node name="Observe" type="Label" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/Panel4"] +[node name="Noun-glasses-56317" type="Sprite2D" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/FourObservePanel"] +position = Vector2(59, 56) +scale = Vector2(0.04, 0.04) +texture = ExtResource("15_7087c") + +[node name="Observe" type="Label" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/FourObservePanel"] layout_mode = 1 anchors_preset = 7 anchor_left = 0.5 @@ -2270,13 +2308,19 @@ theme_override_font_sizes/font_size = 14 text = "LAB_OBS" horizontal_alignment = 1 -[node name="Panel5" type="Panel" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer"] +[node name="FiveResultsPanel" type="Panel" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer"] +unique_name_in_owner = true custom_minimum_size = Vector2(0, 120) layout_mode = 2 size_flags_vertical = 3 theme_override_styles/panel = SubResource("StyleBoxFlat_musqq") -[node name="Results" type="Label" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/Panel5"] +[node name="Noun-file-59659" type="Sprite2D" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/FiveResultsPanel"] +position = Vector2(60, 56) +scale = Vector2(0.04, 0.04) +texture = ExtResource("16_do8p6") + +[node name="Results" type="Label" parent="TopMenuBar/HBoxContainer/Panel/VBoxContainer/FiveResultsPanel"] layout_mode = 1 anchors_preset = 7 anchor_left = 0.5