Skip to content

Commit 92d4a61

Browse files
committed
Switch to bmp
1 parent 837f3f1 commit 92d4a61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+42
-43
lines changed

README.md

Lines changed: 4 additions & 5 deletions

modules/birthday.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def move_down(self):
5757

5858
def show_header(self):
5959
surface = self.font('regular', 0.008).render('Birthdays:', True, self.color)
60-
position = surface.get_rect(left=self.width / 100, top=self.height * self.position_top)
60+
position = surface.get_rect(left=self.width * 0.045, top=self.height * self.position_top)
6161
self.new_data.append((surface, position))
6262

6363
def show_date(self, event):
@@ -70,12 +70,12 @@ def show_date(self, event):
7070
else:
7171
msg = start.strftime("%d %b")
7272
surface = self.font('regular', 0.01).render(msg, True, self.color)
73-
position = surface.get_rect(left=self.width / 100, top=self.height * self.position_top)
73+
position = surface.get_rect(left=self.width * 0.045, top=self.height * self.position_top)
7474
self.new_data.append((surface, position))
7575

7676
def show_summary(self, event):
7777
surface = self.font('regular', 0.01).render(event['summary'], True, self.color)
78-
position = surface.get_rect(left=self.width / 10, top=self.height * self.position_top)
78+
position = surface.get_rect(left=self.width * 0.13, top=self.height * self.position_top)
7979
self.new_data.append((surface, position))
8080

8181
def fetch_upcoming_event(self):

modules/weather.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ def update(self):
4141
else:
4242
self.show_temp()
4343
self.show_temp_day()
44-
self.show_humidity()
45-
self.show_pressure()
44+
# self.show_humidity()
45+
# self.show_pressure()
4646
self.show_condition()
4747
self.show_description()
48-
self.show_city()
49-
self.show_sunrise()
50-
self.show_sunset()
48+
# self.show_city()
49+
# self.show_sunrise()
50+
# self.show_sunset()
5151
self.show_forecast()
5252
self.data.clear()
5353
self.data = self.new_data[:]
@@ -109,8 +109,8 @@ def show_empty_forecast(self):
109109

110110
def show_temp(self):
111111
temp = '%d\u00b0' % self.find_temp(self.smhi_forecast['timeSeries'][0])
112-
surface = self.font('light', 0.035).render(temp, True, self.color)
113-
position = surface.get_rect(left=self.width * 0.01, top=0)
112+
surface = self.font('light', 0.055).render(temp, True, self.color)
113+
position = surface.get_rect(left=self.width * 0.045, top=0.15)
114114
self.new_data.append((surface, position))
115115

116116
def find_condition(self, forecast):
@@ -131,26 +131,26 @@ def find_temp(self, forecast):
131131
return temp
132132

133133
def show_humidity(self):
134-
hum_pos_top = self.height * 0.04
135-
hum_pos_left = self.width * 0.185
134+
hum_pos_top = self.height * 0.07
135+
hum_pos_left = self.width * 0.215
136136

137137
humidity = '%d' % (self.weather_data['main']['humidity'])
138138
surface = self.font('light', 0.015).render(humidity, True, self.color)
139139
position = surface.get_rect(left=hum_pos_left, top=hum_pos_top)
140140
self.new_data.append((surface, position))
141141

142-
hum_icon_pos_top = self.height * 0.0425
143-
hum_icon_pos_left = self.width * 0.24
142+
hum_icon_pos_top = self.height * 0.0455
143+
hum_icon_pos_left = self.width * 0.27
144144

145-
surface = pygame.image.load(os.path.join('resources', 'icons', 'humidity.png'))
145+
surface = pygame.image.load(os.path.join('resources', 'icons', 'humidity.bmp'))
146146
surface = pygame.transform.scale(surface,
147147
(int(self.width * 0.025), int(self.width * 0.025)))
148148
position = surface.get_rect(left=hum_icon_pos_left, top=hum_icon_pos_top)
149149
self.new_data.append((surface, position))
150150

151151
def show_pressure(self):
152-
pos_top = self.height * 0.06
153-
pos_left = self.width * 0.17
152+
pos_top = self.height * 0.09
153+
pos_left = self.width * 0.20
154154

155155
pressure = '%d' % (self.weather_data['main']['pressure'])
156156
surface = self.font('light', 0.015).render(pressure, True, self.color)
@@ -160,7 +160,7 @@ def show_pressure(self):
160160
icon_pos_top = self.height * 0.0625
161161
icon_pos_left = self.width * 0.24
162162

163-
surface = pygame.image.load(os.path.join('resources', 'icons', 'barometer.png'))
163+
surface = pygame.image.load(os.path.join('resources', 'icons', 'barometer.bmp'))
164164
surface = pygame.transform.scale(surface,
165165
(int(self.width * 0.025), int(self.width * 0.025)))
166166
position = surface.get_rect(left=icon_pos_left, top=icon_pos_top)
@@ -169,11 +169,11 @@ def show_pressure(self):
169169
def show_condition(self):
170170
icon_name = self.icon_mapping.get(self.find_condition(self.smhi_forecast['timeSeries'][0]))[
171171
'icon']
172-
if not os.path.isfile(os.path.join('resources', 'icons', '%s.png' % icon_name)):
172+
if not os.path.isfile(os.path.join('resources', 'icons', '%s.bmp' % icon_name)):
173173
icon_name = 'default'
174-
surface = pygame.image.load(os.path.join('resources', 'icons', '%s.png' % icon_name))
175-
surface = pygame.transform.scale(surface, (int(self.width * 0.08), int(self.width * 0.06)))
176-
position = surface.get_rect(left=self.width * 0.09, top=self.height * 0.007)
174+
surface = pygame.image.load(os.path.join('resources', 'icons', '%s.bmp' % icon_name))
175+
surface = pygame.transform.scale(surface, (int(self.width * 0.12), int(self.width * 0.10)))
176+
position = surface.get_rect(left=self.width * 0.17, top=self.height * 0.010)
177177
self.new_data.append((surface, position))
178178

179179
def show_description(self):
@@ -183,54 +183,54 @@ def show_description(self):
183183
condition = param['values'][0]
184184
break
185185
desc = self.icon_mapping.get(condition)['label']
186-
surface = self.font('light', 0.01).render(desc, True, self.color)
187-
position = surface.get_rect(left=self.width * 0.01, top=self.height * 0.04)
186+
surface = self.font('light', 0.015).render(desc, True, self.color)
187+
position = surface.get_rect(left=self.width * 0.045, top=self.height * 0.055)
188188
self.new_data.append((surface, position))
189189

190190
def show_city(self):
191191
city_name = self.weather_data['name']
192192
surface = self.font('light', 0.01).render(city_name, True, self.color)
193-
position = surface.get_rect(left=self.width * 0.01, top=self.height * 0.055)
193+
position = surface.get_rect(left=self.width * 0.03, top=self.height * 0.055)
194194
self.new_data.append((surface, position))
195195

196196
def show_sunset(self):
197197
sunset = datetime.fromtimestamp(self.weather_data['sys']['sunset']).strftime("%H:%M")
198198
surface = self.font('regular', 0.015).render(sunset, True, self.color)
199-
position = surface.get_rect(left=self.width * 0.17, top=self.height * 0.02)
199+
position = surface.get_rect(left=self.width * 0.20, top=self.height * 0.02)
200200
self.new_data.append((surface, position))
201201

202-
surface = pygame.image.load(os.path.join('resources', 'icons', 'sunset.png'))
202+
surface = pygame.image.load(os.path.join('resources', 'icons', 'sunset.bmp'))
203203
surface = pygame.transform.scale(surface,
204204
(int(self.width * 0.025), int(self.width * 0.025)))
205-
position = surface.get_rect(left=self.width * 0.24, top=self.height * 0.0225)
205+
position = surface.get_rect(left=self.width * 0.27, top=self.height * 0.0225)
206206
self.new_data.append((surface, position))
207207

208208
def show_sunrise(self):
209209
sunrise = datetime.fromtimestamp(self.weather_data['sys']['sunrise']).strftime("%H:%M")
210210
surface = self.font('regular', 0.015).render(sunrise, True, self.color)
211-
position = surface.get_rect(left=self.width * 0.17, top=self.height * 0)
211+
position = surface.get_rect(left=self.width * 0.20, top=self.height * 0)
212212
self.new_data.append((surface, position))
213213

214-
surface = pygame.image.load(os.path.join('resources', 'icons', 'sunrise.png'))
214+
surface = pygame.image.load(os.path.join('resources', 'icons', 'sunrise.bmp'))
215215
surface = pygame.transform.scale(surface,
216216
(int(self.width * 0.025), int(self.width * 0.025)))
217-
position = surface.get_rect(left=self.width * 0.24, top=self.height * 0.0025)
217+
position = surface.get_rect(left=self.width * 0.27, top=self.height * 0.0025)
218218
self.new_data.append((surface, position))
219219

220220
def show_temp_day(self):
221221
step = 3
222222
counter = 0
223-
init_left_pos = 0.01
223+
init_left_pos = 0.04
224224

225225
for weather in self.smhi_forecast['timeSeries']:
226226
forecast_time = parser.parse(weather['validTime'])
227227
if forecast_time.hour == (datetime.now() + timedelta(hours=step)).time().hour:
228228
condition = self.find_condition(weather)
229229
icon_name = self.icon_mapping.get(condition)['icon']
230-
if not os.path.isfile(os.path.join('resources', 'icons', '%s.png' % icon_name)):
230+
if not os.path.isfile(os.path.join('resources', 'icons', '%s.bmp' % icon_name)):
231231
icon_name = 'default'
232232
surface = pygame.image.load(
233-
os.path.join('resources', 'icons', '%s.png' % icon_name))
233+
os.path.join('resources', 'icons', '%s.bmp' % icon_name))
234234
surface = pygame.transform.scale(surface,
235235
(int(self.width * 0.07),
236236
int(self.width * 0.05)))
@@ -258,7 +258,7 @@ def show_temp_day(self):
258258
def show_forecast(self):
259259
tmp = []
260260
today = datetime.today().replace(hour=12, minute=0, second=0, microsecond=0)
261-
init_left_pos = 0.01
261+
init_left_pos = 0.04
262262

263263
for forecast in self.smhi_forecast['timeSeries']:
264264
dt = parser.parse(forecast['validTime'])
@@ -268,10 +268,10 @@ def show_forecast(self):
268268
for weather in tmp[:5]:
269269
condition = self.find_condition(weather)
270270
icon_name = self.icon_mapping.get(condition)['icon']
271-
if not os.path.isfile(os.path.join('resources', 'icons', '%s.png' % icon_name)):
271+
if not os.path.isfile(os.path.join('resources', 'icons', '%s.bmp' % icon_name)):
272272
icon_name = 'default'
273273
surface = pygame.image.load(
274-
os.path.join('resources', 'icons', '%s.png' % icon_name))
274+
os.path.join('resources', 'icons', '%s.bmp' % icon_name))
275275
surface = pygame.transform.scale(surface,
276276
(int(self.width * 0.07),
277277
int(self.width * 0.05)))

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pygame==2.0.0.dev4
1+
pygame==2.1.2
22
click==7.1.2
33
vtjp==0.1.14
44
python-dotenv==0.14.0

resources/convert.py

Whitespace-only changes.

resources/icons/1.bmp

182 KB
Binary file not shown.

resources/icons/1.png

-26.2 KB
Binary file not shown.

resources/icons/10.bmp

182 KB
Binary file not shown.

resources/icons/10.png

-42.2 KB
Binary file not shown.

resources/icons/11.bmp

182 KB
Binary file not shown.

0 commit comments

Comments
 (0)