Skip to content

Commit a3facdc

Browse files
committed
Code cleanup
1 parent c5c3cf0 commit a3facdc

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/util/openweathermap.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def GetWeather(self, loc: LocationData):
6060
# actual object structure: https://github.com/linuxmint/cinnamon-spices-applets/weather@mockturtl/src/3_8/providers/openweathermap/payload/weather.ts
6161
data = json.loads(
6262
response.text, object_hook=lambda d: SimpleNamespace(**d))
63-
print(data.name)
6463
return self.owm_data_to_weather_data(data)
6564

6665
@staticmethod

src/util/weather.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
def k_to_f(k: float) -> int:
1+
def k_to_c(k: float) -> int:
22
return round(k - 273.15)
33

44

5-
def k_to_c(k: float) -> float:
5+
def k_to_f(k: float) -> float:
66
return round((9 / 5 * (k - 273.15) + 32), 1)

src/weather.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
from baseWindow import BaseWindow
88
from floating import Floating
99

10-
MAX_WIDTH = 320
11-
MAX_WIDTH_LOW_RES = 200
10+
ICON_SIZE = 128 # probably works OK on most screens
1211

1312

1413
class WeatherWidget(Floating, BaseWindow):
@@ -37,16 +36,19 @@ def __init__(self, away_message=None, initial_monitor=0, low_res=False):
3736

3837
self.away_message = away_message
3938

39+
# overall container
4040
big_box = Gtk.Box(Gtk.Orientation.HORIZONTAL)
4141
self.add(big_box)
4242
big_box.show()
43-
self.icon_size = 128
43+
self.icon_size = ICON_SIZE
4444

45+
# icon
4546
self.condition_icon = Gtk.Image()
4647
self.condition_icon.set_size_request(self.icon_size, self.icon_size)
4748
big_box.pack_start(self.condition_icon, False, False, 6)
4849
self.condition_icon.show()
4950

51+
# temp + condition
5052
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
5153
big_box.pack_start(box, True, False, 6)
5254
box.show()

0 commit comments

Comments
 (0)