initial commit, hope i didnt push any keys :P
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
extends VBoxContainer
|
||||
|
||||
|
||||
onready var settings_api_key = $"%settings_api_key"
|
||||
onready var settings_location = $"%settings_location"
|
||||
onready var settings_celsius = $"%settings_celsius"
|
||||
onready var settings_fahrenheit = $"%settings_fahrenheit"
|
||||
onready var settings_autodark = $"%settings_autodark"
|
||||
onready var settings_12_hour_clock = $"%settings_12_hour_clock"
|
||||
|
||||
var changed := false setget set_changed
|
||||
|
||||
func set_changed(new:bool):
|
||||
changed = true
|
||||
|
||||
func _ready():
|
||||
settings_api_key.text = Config.flags.api_key
|
||||
settings_location.text = Config.flags.location
|
||||
settings_celsius.set_pressed_no_signal(Config.flags.show_celsius)
|
||||
settings_fahrenheit.set_pressed_no_signal( Config.flags.show_fahrenheit )
|
||||
settings_autodark.set_pressed_no_signal(Config.flags.automatic_dark_mode)
|
||||
settings_12_hour_clock.set_pressed_no_signal(Config.flags.use_12_hour_clock)
|
||||
$"%prevent_sleep_mode".set_pressed_no_signal(Config.flags.prevent_sleep_mode)
|
||||
|
||||
func _on_settings_api_key_text_changed(new_text):
|
||||
$api_debounce.start(3.5)
|
||||
|
||||
|
||||
func _on_settings_location_text_changed(new_text):
|
||||
$api_debounce.start(3.5)
|
||||
|
||||
|
||||
func _on_settings_celsius_toggled(button_pressed):
|
||||
Config.flags.show_celsius = button_pressed
|
||||
Config.flags.emit_signal("changed")
|
||||
|
||||
|
||||
func _on_settings_fahrenheit_toggled(button_pressed):
|
||||
Config.flags.show_fahrenheit = button_pressed
|
||||
Config.flags.emit_signal("changed")
|
||||
|
||||
|
||||
func _on_settings_autodark_toggled(button_pressed):
|
||||
Config.flags.automatic_dark_mode = button_pressed
|
||||
Config.flags.emit_signal("changed")
|
||||
|
||||
|
||||
func _on_settings_12_hour_clock_toggled(button_pressed):
|
||||
Config.flags.use_12_hour_clock = button_pressed
|
||||
Config.flags.emit_signal("changed")
|
||||
|
||||
|
||||
func _on_location_debounce_timeout():
|
||||
Config.flags.location = $"%settings_location".text
|
||||
Config.flags.api_key = $"%settings_api_key".text
|
||||
Config.flags.emit_signal("changed")
|
||||
|
||||
|
||||
func _on_show_api_key_toggled(button_pressed):
|
||||
$"%settings_api_key".secret = !button_pressed
|
||||
|
||||
|
||||
func _on_prevent_sleep_mode_toggled(button_pressed):
|
||||
Config.flags.prevent_sleep_mode = button_pressed
|
||||
Config.flags.emit_signal("changed")
|
||||
@@ -0,0 +1,321 @@
|
||||
[gd_scene load_steps=14 format=2]
|
||||
|
||||
[ext_resource path="res://assets/font/resource/menu_header.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://assets/texture/settings/settingtemp_on1.png" type="Texture" id=2]
|
||||
[ext_resource path="res://assets/texture/settings/settingtemp_on2.png" type="Texture" id=3]
|
||||
[ext_resource path="res://assets/texture/settings/settingtemp1.png" type="Texture" id=4]
|
||||
[ext_resource path="res://assets/texture/settings/settingtemp2.png" type="Texture" id=5]
|
||||
[ext_resource path="res://scenes/settings_screen/settings_screen.gd" type="Script" id=6]
|
||||
[ext_resource path="res://assets/texture/buttons/toggle_off.png" type="Texture" id=7]
|
||||
[ext_resource path="res://assets/texture/buttons/toggle_on.png" type="Texture" id=8]
|
||||
[ext_resource path="res://assets/main.tres" type="Theme" id=9]
|
||||
[ext_resource path="res://assets/texture/settings/eye_closed.png" type="Texture" id=10]
|
||||
[ext_resource path="res://assets/texture/settings/eye_open.png" type="Texture" id=11]
|
||||
|
||||
[sub_resource type="Gradient" id=1]
|
||||
offsets = PoolRealArray( 0, 0.256983 )
|
||||
colors = PoolColorArray( 0, 0, 0, 0.262745, 0, 0, 0, 0 )
|
||||
|
||||
[sub_resource type="GradientTexture2D" id=12]
|
||||
gradient = SubResource( 1 )
|
||||
height = 32
|
||||
fill_to = Vector2( 0, 1 )
|
||||
|
||||
[node name="settings_screen" type="VBoxContainer"]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 647.0
|
||||
rect_pivot_offset = Vector2( -354, 186 )
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource( 9 )
|
||||
custom_constants/separation = 0
|
||||
script = ExtResource( 6 )
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 45.0
|
||||
rect_min_size = Vector2( 0, 45 )
|
||||
mouse_filter = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="HBoxContainer"]
|
||||
margin_left = 123.0
|
||||
margin_top = 10.0
|
||||
margin_right = 226.0
|
||||
margin_bottom = 35.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Settings"
|
||||
uppercase = true
|
||||
|
||||
[node name="VBoxContainer" type="MarginContainer" parent="."]
|
||||
margin_top = 45.0
|
||||
margin_right = 350.0
|
||||
margin_bottom = 647.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="VBoxContainer"]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 21.0
|
||||
rect_min_size = Vector2( 0, 21 )
|
||||
mouse_filter = 2
|
||||
size_flags_vertical = 0
|
||||
texture = SubResource( 12 )
|
||||
expand = true
|
||||
stretch_mode = 2
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 602.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
scroll_horizontal_enabled = false
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/ScrollContainer"]
|
||||
margin_right = 350.0
|
||||
margin_bottom = 602.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/margin_right = 10
|
||||
custom_constants/margin_left = 10
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/MarginContainer"]
|
||||
margin_left = 10.0
|
||||
margin_right = 340.0
|
||||
margin_bottom = 602.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Control" type="Control" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"]
|
||||
margin_right = 330.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 0, 20 )
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="alarm_items" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 602.0
|
||||
mouse_filter = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items"]
|
||||
margin_right = 330.0
|
||||
margin_bottom = 48.0
|
||||
rect_min_size = Vector2( 0, 48 )
|
||||
text = "weatherapi.com API key"
|
||||
align = 1
|
||||
valign = 2
|
||||
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items"]
|
||||
margin_top = 52.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 84.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="settings_api_key" type="LineEdit" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer3"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 294.0
|
||||
margin_bottom = 32.0
|
||||
hint_tooltip = "API key from weatherAPI.com.
|
||||
|
||||
This is required to make
|
||||
use of the weather features.
|
||||
To get started, go to
|
||||
https://weatherapi.com/signup.aspx"
|
||||
size_flags_horizontal = 3
|
||||
text = "fdsafdsagdsaf"
|
||||
secret = true
|
||||
secret_character = "·"
|
||||
|
||||
[node name="show_api_key" type="TextureButton" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer3"]
|
||||
margin_left = 298.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 32.0
|
||||
rect_min_size = Vector2( 32, 0 )
|
||||
hint_tooltip = "Reveal API key"
|
||||
mouse_default_cursor_shape = 2
|
||||
toggle_mode = true
|
||||
texture_normal = ExtResource( 10 )
|
||||
texture_pressed = ExtResource( 11 )
|
||||
expand = true
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Label2" type="Label" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items"]
|
||||
margin_top = 88.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 136.0
|
||||
rect_min_size = Vector2( 0, 48 )
|
||||
text = "Location"
|
||||
align = 1
|
||||
valign = 2
|
||||
|
||||
[node name="settings_location" type="LineEdit" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 140.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 172.0
|
||||
hint_tooltip = "Location to use for weather data"
|
||||
text = "Amsterdam"
|
||||
|
||||
[node name="Label3" type="Label" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items"]
|
||||
margin_top = 176.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 224.0
|
||||
rect_min_size = Vector2( 0, 48 )
|
||||
text = "Displayed temperatures"
|
||||
align = 1
|
||||
valign = 2
|
||||
|
||||
[node name="temperatures" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items"]
|
||||
margin_top = 228.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 288.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="settings_celsius" type="TextureButton" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/temperatures"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 163.0
|
||||
margin_bottom = 60.0
|
||||
rect_min_size = Vector2( 0, 60 )
|
||||
hint_tooltip = "Show temperature in celsius"
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
texture_normal = ExtResource( 5 )
|
||||
texture_pressed = ExtResource( 3 )
|
||||
expand = true
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="settings_fahrenheit" type="TextureButton" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/temperatures"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 167.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 60.0
|
||||
rect_min_size = Vector2( 0, 60 )
|
||||
hint_tooltip = "Show temperature in fahrenheit"
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 3
|
||||
toggle_mode = true
|
||||
texture_normal = ExtResource( 4 )
|
||||
texture_pressed = ExtResource( 2 )
|
||||
expand = true
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="Label4" type="Label" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items"]
|
||||
margin_top = 292.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 314.0
|
||||
rect_min_size = Vector2( 0, 16 )
|
||||
align = 1
|
||||
valign = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items"]
|
||||
margin_top = 318.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 375.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer"]
|
||||
margin_top = 17.0
|
||||
margin_right = 192.0
|
||||
margin_bottom = 39.0
|
||||
text = "Automatic dark mode"
|
||||
|
||||
[node name="settings_autodark" type="TextureButton" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 198.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 57.0
|
||||
rect_min_size = Vector2( 132, 57 )
|
||||
hint_tooltip = "Darken interface and
|
||||
backgrounds in the evening"
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 10
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
texture_normal = ExtResource( 7 )
|
||||
texture_pressed = ExtResource( 8 )
|
||||
expand = true
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items"]
|
||||
margin_top = 379.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 436.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer2"]
|
||||
margin_top = 17.0
|
||||
margin_right = 125.0
|
||||
margin_bottom = 39.0
|
||||
text = "12 hour clock"
|
||||
|
||||
[node name="settings_12_hour_clock" type="TextureButton" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 198.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 57.0
|
||||
rect_min_size = Vector2( 132, 57 )
|
||||
hint_tooltip = "Use a 12 hour AM/PM clock
|
||||
instead of 24 hours"
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 10
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
texture_normal = ExtResource( 7 )
|
||||
texture_pressed = ExtResource( 8 )
|
||||
expand = true
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items"]
|
||||
margin_top = 440.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 497.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer4"]
|
||||
margin_top = 17.0
|
||||
margin_right = 173.0
|
||||
margin_bottom = 39.0
|
||||
text = "Prevent sleep mode"
|
||||
|
||||
[node name="prevent_sleep_mode" type="TextureButton" parent="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer4"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 198.0
|
||||
margin_right = 330.0
|
||||
margin_bottom = 57.0
|
||||
rect_min_size = Vector2( 132, 57 )
|
||||
hint_tooltip = "Use a 12 hour AM/PM clock
|
||||
instead of 24 hours"
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 10
|
||||
size_flags_vertical = 3
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
texture_normal = ExtResource( 7 )
|
||||
texture_pressed = ExtResource( 8 )
|
||||
expand = true
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="api_debounce" type="Timer" parent="."]
|
||||
wait_time = 5.0
|
||||
one_shot = true
|
||||
|
||||
[connection signal="text_changed" from="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer3/settings_api_key" to="." method="_on_settings_api_key_text_changed"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer3/show_api_key" to="." method="_on_show_api_key_toggled"]
|
||||
[connection signal="text_changed" from="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/settings_location" to="." method="_on_settings_location_text_changed"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/temperatures/settings_celsius" to="." method="_on_settings_celsius_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/temperatures/settings_fahrenheit" to="." method="_on_settings_fahrenheit_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer/settings_autodark" to="." method="_on_settings_autodark_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer2/settings_12_hour_clock" to="." method="_on_settings_12_hour_clock_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/ScrollContainer/MarginContainer/VBoxContainer/alarm_items/HBoxContainer4/prevent_sleep_mode" to="." method="_on_prevent_sleep_mode_toggled"]
|
||||
[connection signal="timeout" from="api_debounce" to="." method="_on_location_debounce_timeout"]
|
||||
Reference in New Issue
Block a user