weather widget

This commit is contained in:
wt committed 2024-09-03 13:18:52 +07:00
1 parent 54278273cb
commit c45fc14451
13 files changed
+79 -53

No files matched your search

+20
View File
@@ -21,8 +21,28 @@
.label_temp { .label_temp {
font-size: 100; font-size: 100;
color: white;
background-color: black;
padding: 10;
border-radius: 16;
} }
.label_stat { .label_stat {
padding: 10;
border-radius: 16;
font-size: 50; font-size: 50;
color: white;
background-color: black;
}
.areabox {
background-color: black;
border-radius: 16;
}
.label_quote {
color: white;
background-color: black;
padding: 10;
border-radius: 16;
} }
+11 -5
View File
@@ -2,15 +2,21 @@
(defpoll weatherdata :interval "15m" `wttr/wttr.py`) (defpoll weatherdata :interval "15m" `wttr/wttr.py`)
(defwidget weather [] (defwidget weather []
(box :class "genwin" :style "background-image: url('images/bg.png');background-size: cover;" (box :class "genwin" :style "background-image: url('${weatherdata.current_condition[0].weatherCode}');background-size: cover;"
(box :orientation "v" :spacing 10 :space-evenly false :vexpand false :hexpand false (box :orientation "v" :spacing 10 :space-evenly false :vexpand false :hexpand false
(box :orientation "h" :spacing 0 :vexpand false :hexpand false (box :orientation "h" :spacing 0 :vexpand false :hexpand false
(label :class "label_temp" :halign "center" :style "color: white;" :text "${weatherdata.current_condition[0].temp_C}") (label :class "label_temp" :halign "center" :text "${weatherdata.current_condition[0].temp_C}")
; (label :class "iconweather" :halign "center" :text "${weatherdata.current_condition[0].weatherCode}")
) )
(box :orientation "v" :spacing 10 :halign "center" :space-evenly false :vexpand false :hexpand false (box :orientation "v" :spacing 10 :halign "center" :space-evenly false :vexpand false :hexpand false
(label :class "label_stat" :text "${weatherdata.current_condition[0].weatherDesc[0].value}") (label :class "label_stat" :text "${weatherdata.current_condition[0].weatherDesc[0].value}")
(box :orientation "h" :spacing 10 :space-evenly false :vexpand false :hexpand false (box
:class "areabox"
:orientation "h"
:spacing 10
:space-evenly false
:vexpand false
:hexpand false
:halign "center"
(label :class "label_quote" :text "${weatherdata.nearest_area[0].country[0].value}") (label :class "label_quote" :text "${weatherdata.nearest_area[0].country[0].value}")
(label :class "label_quote" :text "${weatherdata.nearest_area[0].region[0].value}") (label :class "label_quote" :text "${weatherdata.nearest_area[0].region[0].value}")
) )
@@ -20,7 +26,7 @@
) )
; Weather window ; Weather window
(defwindow weather :stacking "fg" :focusable true :exclusive true :screen 1 :windowtype "dock" (defwindow weather :stacking "bg" :focusable true :exclusive true :screen 1 :windowtype "dock"
:geometry (geometry :x 100 :y 100 :width 610 :height 280) :geometry (geometry :x 100 :y 100 :width 610 :height 280)
(weather) (weather)
) )
Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

+48 -48
View File
@@ -5,54 +5,54 @@ import requests
from datetime import datetime from datetime import datetime
WEATHER_CODES = { WEATHER_CODES = {
'113': '☀️', '113': 'images/113.jpg',
'116': '⛅️', '116': 'images/116.jpeg',
'119': '☁️', '119': 'images/119.jpeg',
'122': '☁️', '122': 'images/119.jpeg',
'143': '🌫', '143': 'images/143.jpg',
'176': '🌦', '176': 'images/176.jpeg',
'179': '🌧', '179': 'images/rain.jpeg',
'182': '🌧', '182': 'images/rain.jpeg',
'185': '🌧', '185': 'images/rain.jpeg',
'200': '⛈', '200': 'images/storm.jpeg',
'227': '🌨', '227': 'images/snow.jpeg',
'230': '❄️', '230': 'images/cold.jpeg',
'248': '🌫', '248': 'images/143.jpg',
'260': '🌫', '260': 'images/143.jpg',
'263': '🌦', '263': 'images/176.jpeg',
'266': '🌦', '266': 'images/176.jpeg',
'281': '🌧', '281': 'images/rain.jpeg',
'284': '🌧', '284': 'images/rain.jpeg',
'293': '🌦', '293': 'images/176.jpeg',
'296': '🌦', '296': 'images/176.jpeg',
'299': '🌧', '299': 'images/rain.jpeg',
'302': '🌧', '302': 'images/rain.jpeg',
'305': '🌧', '305': 'images/rain.jpeg',
'308': '🌧', '308': 'images/rain.jpeg',
'311': '🌧', '311': 'images/rain.jpeg',
'314': '🌧', '314': 'images/rain.jpeg',
'317': '🌧', '317': 'images/rain.jpeg',
'320': '🌨', '320': 'images/snow.jpeg',
'323': '🌨', '323': 'images/snow.jpeg',
'326': '🌨', '326': 'images/snow.jpeg',
'329': '❄️', '329': 'images/cold.jpeg',
'332': '❄️', '332': 'images/cold.jpeg',
'335': '❄️', '335': 'images/cold.jpeg',
'338': '❄️', '338': 'images/cold.jpeg',
'350': '🌧', '350': 'images/rain.jpeg',
'353': '🌦', '353': 'images/176.jpeg',
'356': '🌧', '356': 'images/rain.jpeg',
'359': '🌧', '359': 'images/rain.jpeg',
'362': '🌧', '362': 'images/rain.jpeg',
'365': '🌧', '365': 'images/rain.jpeg',
'368': '🌨', '368': 'images/snow.jpeg',
'371': '❄️', '371': 'images/cold.jpeg',
'374': '🌧', '374': 'images/rain.jpeg',
'377': '🌧', '377': 'images/rain.jpeg',
'386': '⛈', '386': 'images/storm.jpeg',
'389': '🌩', '389': 'images/bigstorm.jpeg',
'392': '⛈', '392': 'images/storm.jpeg',
'395': '❄️' '395': 'images/cold.jpeg'
} }
data = {} data = {}