weather widget

This commit is contained in:
wt
2024-09-03 13:18:52 +07:00
parent 54278273cb
commit c45fc14451
13 changed files with 79 additions and 53 deletions
+20
View File
@@ -21,8 +21,28 @@
.label_temp {
font-size: 100;
color: white;
background-color: black;
padding: 10;
border-radius: 16;
}
.label_stat {
padding: 10;
border-radius: 16;
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`)
(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 "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 "iconweather" :halign "center" :text "${weatherdata.current_condition[0].weatherCode}")
(label :class "label_temp" :halign "center" :text "${weatherdata.current_condition[0].temp_C}")
)
(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}")
(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].region[0].value}")
)
@@ -20,7 +26,7 @@
)
; 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)
(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
WEATHER_CODES = {
'113': '☀️',
'116': '⛅️',
'119': '☁️',
'122': '☁️',
'143': '🌫',
'176': '🌦',
'179': '🌧',
'182': '🌧',
'185': '🌧',
'200': '⛈',
'227': '🌨',
'230': '❄️',
'248': '🌫',
'260': '🌫',
'263': '🌦',
'266': '🌦',
'281': '🌧',
'284': '🌧',
'293': '🌦',
'296': '🌦',
'299': '🌧',
'302': '🌧',
'305': '🌧',
'308': '🌧',
'311': '🌧',
'314': '🌧',
'317': '🌧',
'320': '🌨',
'323': '🌨',
'326': '🌨',
'329': '❄️',
'332': '❄️',
'335': '❄️',
'338': '❄️',
'350': '🌧',
'353': '🌦',
'356': '🌧',
'359': '🌧',
'362': '🌧',
'365': '🌧',
'368': '🌨',
'371': '❄️',
'374': '🌧',
'377': '🌧',
'386': '⛈',
'389': '🌩',
'392': '⛈',
'395': '❄️'
'113': 'images/113.jpg',
'116': 'images/116.jpeg',
'119': 'images/119.jpeg',
'122': 'images/119.jpeg',
'143': 'images/143.jpg',
'176': 'images/176.jpeg',
'179': 'images/rain.jpeg',
'182': 'images/rain.jpeg',
'185': 'images/rain.jpeg',
'200': 'images/storm.jpeg',
'227': 'images/snow.jpeg',
'230': 'images/cold.jpeg',
'248': 'images/143.jpg',
'260': 'images/143.jpg',
'263': 'images/176.jpeg',
'266': 'images/176.jpeg',
'281': 'images/rain.jpeg',
'284': 'images/rain.jpeg',
'293': 'images/176.jpeg',
'296': 'images/176.jpeg',
'299': 'images/rain.jpeg',
'302': 'images/rain.jpeg',
'305': 'images/rain.jpeg',
'308': 'images/rain.jpeg',
'311': 'images/rain.jpeg',
'314': 'images/rain.jpeg',
'317': 'images/rain.jpeg',
'320': 'images/snow.jpeg',
'323': 'images/snow.jpeg',
'326': 'images/snow.jpeg',
'329': 'images/cold.jpeg',
'332': 'images/cold.jpeg',
'335': 'images/cold.jpeg',
'338': 'images/cold.jpeg',
'350': 'images/rain.jpeg',
'353': 'images/176.jpeg',
'356': 'images/rain.jpeg',
'359': 'images/rain.jpeg',
'362': 'images/rain.jpeg',
'365': 'images/rain.jpeg',
'368': 'images/snow.jpeg',
'371': 'images/cold.jpeg',
'374': 'images/rain.jpeg',
'377': 'images/rain.jpeg',
'386': 'images/storm.jpeg',
'389': 'images/bigstorm.jpeg',
'392': 'images/storm.jpeg',
'395': 'images/cold.jpeg'
}
data = {}