343
343
# fake a result, with same data than the first ('today') one, but
344
344
# with no title and the TWC logo, and put it at the left end
345
345
logo_result = results[0].copy()
346
logo_result['icon'] = '%s/weatherchannel/logo.svg' % \
346
logo_result['art'] = '%s/weatherchannel/logo.svg' % \
347
347
(self.base_image_url,)
348
348
logo_result['title'] = ''
349
349
logo_result['uri'] = logo_result['uri'] + "#logo"
362
362
(result['day'], result['conditions'], result['current_temp'])
364
364
subtitle = "%s %s" % (result['location'], result['date'])
365
max_temp = "%s: %s" % ("max: ", result['max_temp'])
366
min_temp = "%s: %s" % ("min: ", result['min_temp'])
366
# yield an 'image' widget
370
'source': result['art'],
367
373
# yield a 'header' widget
370
376
'type': 'header',
371
377
'uri': result['uri'],
373
'mascot': result['art'],
374
379
'subtitle': subtitle,
375
'attribute-1': max_temp,
376
'attribute-2': min_temp,
377
382
'attribute-3': None,
383
'emblem': result['preview_icon'],
381
# TODO: how to include these in the preview?
382
#info1 = ("max_temp", "Maximum temperature", result['max_temp'])
383
#info2 = ("min_temp", "Minimum temperature", result['min_temp'])
384
#info3 = ("rain", "Chances of rain", result['pop'])
385
#info4 = ("wind", "Wind", result['wind_sentence'])
386
#info5 = ("humidity", "Humidity", result['humidity'])
387
#info6 = ("uv", "UV index", result['uv'])
386
max_temp = ("Maximum temperature", result['max_temp'])
387
min_temp = ("Minimum temperature", result['min_temp'])
388
rain = ("Chances of rain", result['pop'])
389
wind = ("Wind", result['wind_sentence'])
390
humm = ("Humidity", result['humidity'])
391
uv = ("UV index", result['uv'])
392
# send it as a 'text' widget
393
infos = [min_temp, max_temp, rain, wind, humm, uv]
394
text = '\n'.join('%s: %s' % (desc, value) for (desc, value) in infos)
388
401
loc_key = result['loc_key']
389
402
locale = result['locale']
390
403
formfactor = result['formfactor']