add yahoo weather feed
git-svn-id: http://www.neo1973-germany.de/svn@227 46df4e5c-bc4e-4628-a0fc-830ba316316d
|
@ -166,6 +166,25 @@ collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
part {
|
||||||
|
name: "clipper";
|
||||||
|
type: RECT;
|
||||||
|
description {
|
||||||
|
rel1 { relative: 17/20 5/20; offset: -48 -48; }
|
||||||
|
rel2 { relative: 17/20 5/20; offset: 48 48; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
name: "icon";
|
||||||
|
type: SWALLOW;
|
||||||
|
mouse_events: 0;
|
||||||
|
clip_to: "clipper";
|
||||||
|
description {
|
||||||
|
/*fixed: 1 1;*/
|
||||||
|
rel1 { relative: 17/20 5/20; offset: -48 -48; }
|
||||||
|
rel2 { relative: 17/20 5/20; offset: 48 48; }
|
||||||
|
}
|
||||||
|
} /*end icon swallow */
|
||||||
part {
|
part {
|
||||||
name: "current";
|
name: "current";
|
||||||
type: TEXTBLOCK;
|
type: TEXTBLOCK;
|
||||||
|
|
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 10 KiB |
|
@ -0,0 +1,14 @@
|
||||||
|
These weather images are (c) 2003 by Stardock Corporation. All rights reserved.
|
||||||
|
|
||||||
|
Permission:
|
||||||
|
Stardock gives you permission to distribute these images and or icons freely as long as this permission document is included.
|
||||||
|
|
||||||
|
Allowed Uses:
|
||||||
|
You may use these images with any Stardock related product (such as creating DesktopX objects or ObjectDock or plugins).
|
||||||
|
|
||||||
|
In addition, Stardock licenses this for use with content that is provided free of charge and is not connected to a commercial software product. You may use these images for skins, themes, and other content for freeware software even if it is competitive in nature with Stardock's offerings as long as the copyright notices are included. You may not, however, bundle these images in any way with any software product without Stardock's express permission.
|
||||||
|
|
||||||
|
You may use these images in your website or product as long as this permission.txt is linked somewhere along with Stardock's copyright notice with a link to Stardock's homepage: http://www.stardock.com.
|
||||||
|
|
||||||
|
Designed Use:
|
||||||
|
These weather images are designed to provide the various weather conditions reported by weather services. It was created for use with Stardock DesktopX (http://www.desktopx.net) and Stardock ObjectDock (http://www.objectdock.com) both of which allow users to monitor the weather conditions from their desktop.
|
|
@ -20,6 +20,7 @@ EDJE_FILE_PATH = "data/themes/blackwhite/"
|
||||||
PIX_FILE_PATH = "/media/card/hon/"
|
PIX_FILE_PATH = "/media/card/hon/"
|
||||||
TRACK_FILE_PATH = "/media/card/track/"
|
TRACK_FILE_PATH = "/media/card/track/"
|
||||||
DB_FILE_PATH = "data/db/my.sqlite"
|
DB_FILE_PATH = "data/db/my.sqlite"
|
||||||
|
PIX_WEATHER_FILE_PATH = "data/themes_data/blackwhite/images/stardock_weather/"
|
||||||
|
|
||||||
DIALER_SCREEN_NAME = "pyneo/dialer/main"
|
DIALER_SCREEN_NAME = "pyneo/dialer/main"
|
||||||
INCALL_SCREEN_NAME = "pyneo/dialer/incall"
|
INCALL_SCREEN_NAME = "pyneo/dialer/incall"
|
||||||
|
@ -245,7 +246,6 @@ class PyneoController(object):
|
||||||
@classmethod
|
@classmethod
|
||||||
def gsm_accept(class_):
|
def gsm_accept(class_):
|
||||||
os.system('alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore')
|
os.system('alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore')
|
||||||
# class_.call = object_by_url('dbus:///org/pyneo/gsmdevice/Call/1')
|
|
||||||
class_.call.Accept(dbus_interface=DIN_CALL)
|
class_.call.Accept(dbus_interface=DIN_CALL)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -272,18 +272,6 @@ class PyneoController(object):
|
||||||
elif nw_status == 4:
|
elif nw_status == 4:
|
||||||
raise NotImplementedError("GSM registration has unknown state")
|
raise NotImplementedError("GSM registration has unknown state")
|
||||||
|
|
||||||
# if status.has_key('phone_activity_status'):
|
|
||||||
# ph_status = status['phone_activity_status']
|
|
||||||
#
|
|
||||||
# if class_.call_type != 'outgoing':
|
|
||||||
# if ph_status == 0:
|
|
||||||
# class_.notify_callbacks("gsm_phone_call_end")
|
|
||||||
# os.system('alsactl -f /usr/share/openmoko/scenarios/stereoout.state restore')
|
|
||||||
# if ph_status == 3:
|
|
||||||
# class_.notify_callbacks("gsm_phone_ringing")
|
|
||||||
# if ph_status == 4:
|
|
||||||
# class_.notify_callbacks("gsm_phone_call_start")
|
|
||||||
|
|
||||||
if status.has_key('rssi'):
|
if status.has_key('rssi'):
|
||||||
class_.notify_callbacks("gsm_signal_strength_change", status['rssi'])
|
class_.notify_callbacks("gsm_signal_strength_change", status['rssi'])
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,25 @@ class WeatherScreen(EdjeGroup):
|
||||||
EdjeGroup.__init__(self, screen_manager, WEATHER_SCREEN_NAME)
|
EdjeGroup.__init__(self, screen_manager, WEATHER_SCREEN_NAME)
|
||||||
self.weather_for_zip(ZIP_CODE, TEMP_UNIT)
|
self.weather_for_zip(ZIP_CODE, TEMP_UNIT)
|
||||||
|
|
||||||
|
def on_get_pix(self, icon):
|
||||||
|
self.image = self.evas.Image(file=PIX_WEATHER_FILE_PATH + icon + '.png')
|
||||||
|
x, y = self.image.image_size
|
||||||
|
dx, dy = self.part_size_get('clipper')
|
||||||
|
print 'x, y, dx, dy: ', x, y, dx, dy
|
||||||
|
if x * dy > y * dx:
|
||||||
|
y = y * dx / x
|
||||||
|
x = dx
|
||||||
|
else:
|
||||||
|
x = x * dy / y
|
||||||
|
y = dy
|
||||||
|
print 'x, y, dx, dy: ', x, y, dx, dy
|
||||||
|
self.image.fill = 0, 0, x, y
|
||||||
|
self.part_swallow('icon', self.image)
|
||||||
|
self.obj = self.part_object_get('clipper')
|
||||||
|
self.obj.size = x, y
|
||||||
|
self.obj.show()
|
||||||
|
print 'obj: ', self.obj
|
||||||
|
|
||||||
def weather_for_zip(self, zip_code, unit):
|
def weather_for_zip(self, zip_code, unit):
|
||||||
url = WEATHER_URL % (zip_code, unit)
|
url = WEATHER_URL % (zip_code, unit)
|
||||||
dom = minidom.parse(urllib.urlopen(url))
|
dom = minidom.parse(urllib.urlopen(url))
|
||||||
|
@ -29,26 +48,22 @@ class WeatherScreen(EdjeGroup):
|
||||||
'date': node.getAttribute('date'),
|
'date': node.getAttribute('date'),
|
||||||
'low': node.getAttribute('low'),
|
'low': node.getAttribute('low'),
|
||||||
'high': node.getAttribute('high'),
|
'high': node.getAttribute('high'),
|
||||||
'condition': node.getAttribute('text')
|
'condition': node.getAttribute('text'),
|
||||||
|
'code': node.getAttribute('code'),
|
||||||
})
|
})
|
||||||
ycondition = dom.getElementsByTagNameNS(WEATHER_NS, 'condition')[0]
|
ycondition = dom.getElementsByTagNameNS(WEATHER_NS, 'condition')[0]
|
||||||
|
|
||||||
self.part_text_set("location", "dom.getElementsByTagName('title')[0].firstChild.data[17:]")
|
self.on_get_pix(ycondition.getAttribute('code'))
|
||||||
|
self.part_text_set("location", dom.getElementsByTagName('title')[0].firstChild.data[17:])
|
||||||
self.part_text_set("current", "current condition: %s<br>current temp: %s" % (ycondition.getAttribute('text'), ycondition.getAttribute('temp')))
|
self.part_text_set("current", "current condition: %s<br>current temp: %s" % (ycondition.getAttribute('text'), ycondition.getAttribute('temp')))
|
||||||
#print forecasts.pop(1)['date']
|
|
||||||
|
|
||||||
self.part_text_set("forecasts", "forecasts:<br>date: %s<br>low: %s<br>high: %s<br>condition: %s" % (forecasts[1]['date'], forecasts[1]['low'], forecasts[1]['high'], forecasts[1]['condition']))
|
self.part_text_set("forecasts", "forecasts:<br>date: %s<br>low: %s<br>high: %s<br>condition: %s" % (forecasts[1]['date'], forecasts[1]['low'], forecasts[1]['high'], forecasts[1]['condition']))
|
||||||
|
|
||||||
# return {
|
|
||||||
# 'current_condition': ycondition.getAttribute('text'),
|
|
||||||
# 'current_temp': ycondition.getAttribute('temp'),
|
|
||||||
# 'forecasts': forecasts,
|
|
||||||
# 'title': dom.getElementsByTagName('title')[0].firstChild.data
|
|
||||||
# }
|
|
||||||
|
|
||||||
@edje.decorators.signal_callback("mouse,up,1", "*")
|
@edje.decorators.signal_callback("mouse,up,1", "*")
|
||||||
def on_edje_signal_dialer_status_triggered(self, emission, source):
|
def on_edje_signal_dialer_status_triggered(self, emission, source):
|
||||||
if source == "button_12":
|
if source == "button_12":
|
||||||
|
self.image.delete()
|
||||||
PyneoController.show_dialer_screen()
|
PyneoController.show_dialer_screen()
|
||||||
|
if source == "headline":
|
||||||
|
self.image.delete()
|
||||||
|
self.weather_for_zip(ZIP_CODE, TEMP_UNIT)
|
||||||
print 'source: ', source
|
print 'source: ', source
|
||||||
|
|