Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 51 additions & 5 deletions Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,60 @@ func PrintHourlyResults():
$GUI/Forecasts/Window/NowCast/NowWind/Direction.text = String(HourlyForecastResult[0].windDirection)
$GUI/Forecasts/Window/NowCast/ShortCast.text = String(HourlyForecastResult[0].shortForecast)
#Hourly Forecast for Next 24 Hours
$GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0/DateTime.text = String(HourlyForecastResult[1].startTime)
$GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0/T0Temp/Temp.text = String(HourlyForecastResult[1].temperature)
$GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0/T0Temp/Unit.text = String(HourlyForecastResult[1].temperatureUnit)
$GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0/T0Wind/WindSpeed.text = String(HourlyForecastResult[1].windSpeed)
$GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0/T0Wind/Direction.text = String(HourlyForecastResult[1].windDirection)
var Counter = 1
var HourlyCount = HourlyForecastResult.size()
var scene = ResourceLoader.load("res://T0.tscn")
var path = get_tree().get_root().get_node("Main/GUI/Forecasts/Window/HourlyScroll/HourlyCast")
var SepScene = ResourceLoader.load("res://VSeparator.tscn")
print(path)
print(scene)
print(HourlyCount)
print(Counter)

for number in range(23):
print("Loop:", Counter)
var NewInstance = scene.instance()
var vInst = SepScene.instance()
NewInstance.name = "T" + String(Counter)
path.add_child(NewInstance)
print("New Instance Name:")
print(NewInstance.name)
#Handle Time
var DateTime = HourlyForecastResult[Counter].startTime
var Date = DateTime.split("T")[0].split("-")
var Time = DateTime.split("T")[1].trim_suffix("Z").split(":")
var Year = Date[0]
var Month = Date[1]
var Day = Date[2]
var Hour = Time[0]
var Min = Time[1]
var Sec = Time[2]
Hour = int(Hour)

#Convert from 24hr to 12hr.
if Hour > 12:
Hour = Hour - 12
NewInstance.get_node("DateTime").text = str(Month, "/", Day, " ", Hour, ":", Min, "PM")
elif Hour == 0:
Hour = 12
NewInstance.get_node("DateTime").text = str(Month, "/", Day, " ", Hour, ":", Min, "AM")
elif Hour == 12:
NewInstance.get_node("DateTime").text = str(Month, "/", Day, " ", Hour, ":", Min, "PM")
else:
NewInstance.get_node("DateTime").text = str(Month, "/", Day, " ", Hour, ":", Min, "AM")

#Continue
NewInstance.get_node("T0Temp/Temp").text = String(HourlyForecastResult[Counter].temperature)
NewInstance.get_node("T0Temp/Unit").text = String(HourlyForecastResult[Counter].temperatureUnit)
NewInstance.get_node("T0Wind/WindSpeed").text = String(HourlyForecastResult[Counter].windSpeed)
NewInstance.get_node("T0Wind/Direction").text = String(HourlyForecastResult[Counter].windDirection)
path.add_child(vInst)
Counter = Counter + 1


func PrintWeeklyResults():
$GUI/Forecasts/Window/WeeklyScroll.get_v_scrollbar().modulate = Color(0, 0, 0, 0) #Hide Scroll Bar
$GUI/Forecasts/Window/HourlyScroll.get_h_scrollbar().modulate = Color(0, 0, 0, 0)
$GUI/AlertDisplay/Body/AlertScroll.get_v_scrollbar().modulate = Color(0, 0, 0, 0) #Hide Scroll Bar
$GUI/Forecasts/Window/WeeklyScroll/WeekCast/W0/Date.text = String(WeeklyForecastResult[0].name)
$GUI/Forecasts/Window/WeeklyScroll/WeekCast/W0/W0Temp/Temp.text = String(WeeklyForecastResult[0].temperature)
Expand Down
81 changes: 12 additions & 69 deletions Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ script = ExtResource( 1 )
[node name="GUI" type="CanvasLayer" parent="."]
follow_viewport_enable = true

[node name="Panel" type="Panel" parent="GUI"]
anchor_right = 1.0
anchor_bottom = 1.0

[node name="Forecasts" type="MarginContainer" parent="GUI"]
anchor_right = 1.0
anchor_bottom = 1.0
Expand All @@ -35,7 +39,7 @@ custom_constants/margin_bottom = 10
margin_left = 10.0
margin_top = 60.0
margin_right = 722.0
margin_bottom = 1088.0
margin_bottom = 1130.0

[node name="Header" type="VBoxContainer" parent="GUI/Forecasts/Window"]
margin_right = 712.0
Expand Down Expand Up @@ -143,85 +147,24 @@ margin_right = 712.0
margin_bottom = 204.0

[node name="HourlyScroll" type="ScrollContainer" parent="GUI/Forecasts/Window"]
visible = false
margin_top = 117.0
margin_top = 208.0
margin_right = 712.0
margin_bottom = 177.0
rect_min_size = Vector2( 75, 60 )
size_flags_horizontal = 3
size_flags_vertical = 3
margin_bottom = 238.0
rect_min_size = Vector2( 0, 30 )
scroll_vertical_enabled = false

[node name="HourlyCast" type="HBoxContainer" parent="GUI/Forecasts/Window/HourlyScroll"]
margin_right = 74.0
margin_bottom = 50.0
alignment = 1

[node name="T0" type="VBoxContainer" parent="GUI/Forecasts/Window/HourlyScroll/HourlyCast"]
margin_right = 66.0
margin_bottom = 50.0
size_flags_horizontal = 4
size_flags_vertical = 0
alignment = 1

[node name="DateTime" type="Label" parent="GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0"]
margin_right = 66.0
margin_bottom = 14.0
text = "DateTime"
align = 1

[node name="T0Temp" type="HBoxContainer" parent="GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0"]
margin_top = 18.0
margin_right = 66.0
margin_bottom = 32.0
alignment = 1

[node name="Temp" type="Label" parent="GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0/T0Temp"]
margin_left = 19.0
margin_right = 35.0
margin_bottom = 14.0
text = "80"
align = 1

[node name="Unit" type="Label" parent="GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0/T0Temp"]
margin_left = 39.0
margin_right = 46.0
margin_bottom = 14.0
text = "F"
align = 1

[node name="T0Wind" type="HBoxContainer" parent="GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0"]
margin_top = 36.0
margin_right = 66.0
margin_bottom = 50.0
alignment = 1

[node name="WindSpeed" type="Label" parent="GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0/T0Wind"]
margin_right = 49.0
margin_bottom = 14.0
text = "10 mph"

[node name="Direction" type="Label" parent="GUI/Forecasts/Window/HourlyScroll/HourlyCast/T0/T0Wind"]
margin_left = 53.0
margin_right = 66.0
margin_bottom = 14.0
text = "W"

[node name="VSeparator" type="VSeparator" parent="GUI/Forecasts/Window/HourlyScroll/HourlyCast"]
margin_left = 70.0
margin_right = 74.0
margin_bottom = 50.0

[node name="HSeparator3" type="HSeparator" parent="GUI/Forecasts/Window"]
visible = false
margin_top = 117.0
margin_top = 242.0
margin_right = 712.0
margin_bottom = 121.0
margin_bottom = 246.0

[node name="WeeklyScroll" type="ScrollContainer" parent="GUI/Forecasts/Window"]
margin_top = 208.0
margin_top = 250.0
margin_right = 712.0
margin_bottom = 1028.0
margin_bottom = 1070.0
rect_min_size = Vector2( 0, 820 )
size_flags_horizontal = 3
size_flags_vertical = 3
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# MiniWeather
MiniMAL Weather App

A minimal weather app that uses https://ip-api.com/ for location data and the National Weather Service API for forecast data.
A minimal weather app that uses https://ip-api.com/ for location data and the <a href="https://www.weather.gov/documentation/services-web-api" title= "National Weather Service API">National Weather Service API</a> for forecast data.

*Ad Free

*No Trackers

*Android APK

Built in Godot with GDScript

<a href="https://www.flaticon.com/free-icons/weather" title="weather icons">Weather icons created by Eucalyp - Flaticon</a>
Expand Down
59 changes: 59 additions & 0 deletions T0.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://new_dynamicfont.tres" type="DynamicFont" id=1]

[node name="T0" type="VBoxContainer"]
margin_right = 66.0
margin_bottom = 50.0
size_flags_horizontal = 4
size_flags_vertical = 0
alignment = 1

[node name="DateTime" type="Label" parent="."]
margin_right = 104.0
margin_bottom = 28.0
custom_fonts/font = ExtResource( 1 )
text = "DateTime"
align = 1

[node name="T0Temp" type="HBoxContainer" parent="."]
margin_top = 32.0
margin_right = 104.0
margin_bottom = 60.0
alignment = 1

[node name="Temp" type="Label" parent="T0Temp"]
margin_left = 29.0
margin_right = 57.0
margin_bottom = 28.0
custom_fonts/font = ExtResource( 1 )
text = "80"
align = 1

[node name="Unit" type="Label" parent="T0Temp"]
margin_left = 61.0
margin_right = 74.0
margin_bottom = 28.0
custom_fonts/font = ExtResource( 1 )
text = "F"
align = 1

[node name="T0Wind" type="HBoxContainer" parent="."]
margin_top = 64.0
margin_right = 104.0
margin_bottom = 92.0
alignment = 1

[node name="WindSpeed" type="Label" parent="T0Wind"]
margin_left = 1.0
margin_right = 78.0
margin_bottom = 28.0
custom_fonts/font = ExtResource( 1 )
text = "10 mph"

[node name="Direction" type="Label" parent="T0Wind"]
margin_left = 82.0
margin_right = 103.0
margin_bottom = 28.0
custom_fonts/font = ExtResource( 1 )
text = "W"
5 changes: 5 additions & 0 deletions VSeparator.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[gd_scene format=2]

[node name="VSeparator" type="VSeparator"]
margin_right = 4.0
margin_bottom = 3.0
2 changes: 1 addition & 1 deletion export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../../DevTools/Exports/Android/MiniWeather/MiniWeatherV0.1.6.apk"
export_path="../../DevTools/Exports/Android/MiniWeather/MiniWeatherV0.2.apk"
script_export_mode=1
script_encryption_key=""

Expand Down