Files
2026-06-13 16:08:36 -04:00

37 lines
1.3 KiB
GDScript

extends HBoxContainer
@onready var time_display = $VBoxContainer/time_display
@onready var weather_display = $VBoxContainer/weather_display
@onready var location_display = $VBoxContainer/location_display
@onready var temperature_display = $VBoxContainer/temperature_display
@onready var audio = $VBoxContainer/audio
func _ready():
Config.changed.connect(_on_config_changed)
_on_config_changed()
func _on_config_changed():
$"%location_display".text = Config.flags.location.to_upper()
$"%time_display".use_12_hours = Config.flags.use_12_hour_clock
$"%temperature_display".show_celsius = Config.flags.show_celsius
$"%temperature_display".show_fahrenheit = Config.flags.show_fahrenheit
func hourly_weather_update(json):
var WC = Constants.WEATHER.UNKNOWN
var temp = 0.0
if json != null and json is Dictionary and !json.has('error'):
WC = json['current']['condition']['code']
temp = json['current']['temp_c']
var weather = Constants.code_to_weather(WC)
temperature_display.set_degrees_celsius(temp)
temperature_display.temperature_unknown = weather == Constants.WEATHER.UNKNOWN
weather_display.set_weather(weather)
func minute_timer_update(time):
time_display.set_moment(Moment.new(time['hour'], time['minute']))
time_display.use_12_hours = Config.flags.use_12_hour_clock