2008-10-12 15:20:57 +00:00
|
|
|
#!/usr/bin/env python2.5
|
|
|
|
# -*- coding: utf-8 -*-
|
2008-11-07 15:51:51 +00:00
|
|
|
__author__ = "Soeren Apel (abraxa@dar-clan.de), Frank Gau (fgau@gau-net.de), Thomas Gstaedtner (thomas (a) gstaedtner (.) net)"
|
2008-10-12 15:20:57 +00:00
|
|
|
__version__ = "prototype"
|
|
|
|
__copyright__ = "Copyright (c) 2008"
|
|
|
|
__license__ = "GPL3"
|
|
|
|
|
|
|
|
from epydial import *
|
|
|
|
|
|
|
|
class HonScreen(EdjeGroup):
|
2008-11-07 15:51:51 +00:00
|
|
|
class PixGraph( evas.ClippedSmartObject ):
|
2008-11-03 18:34:09 +00:00
|
|
|
def __init__( self, *args, **kargs ):
|
|
|
|
evas.ClippedSmartObject.__init__( self, *args, **kargs )
|
|
|
|
|
2008-10-12 15:20:57 +00:00
|
|
|
def __init__(self, screen_manager):
|
|
|
|
EdjeGroup.__init__(self, screen_manager, HON_SCREEN_NAME)
|
2008-11-07 15:51:51 +00:00
|
|
|
self.pixgraph = self.PixGraph( self.evas )
|
|
|
|
print 'pixgraph', self.pixgraph
|
2008-10-12 15:20:57 +00:00
|
|
|
|
|
|
|
def register_pyneo_callbacks(self):
|
|
|
|
PyneoController.register_callback("get_hon", self.on_get_hon)
|
|
|
|
|
|
|
|
def on_get_hon(self, status):
|
2008-10-18 17:12:33 +00:00
|
|
|
img = object_by_url(status['img']).read()
|
|
|
|
pix = status['img']
|
|
|
|
assert pix.startswith('file://')
|
|
|
|
pix = pix[7:]
|
|
|
|
self.pix = pix
|
|
|
|
self.part_text_set("hon_caption", "nick: %s"%status['nick'])
|
|
|
|
self.hot = dict(url=status['hot'])
|
|
|
|
self.nothot = dict(url=status['nothot'])
|
|
|
|
|
|
|
|
self.image = self.evas.Image(file=self.pix)
|
|
|
|
x, y = self.image.image_size
|
|
|
|
dx, dy = self.part_size_get('icon')
|
|
|
|
if x * dy > y * dx:
|
|
|
|
y = y * dx / x
|
|
|
|
x = dx
|
|
|
|
else:
|
|
|
|
x = x * dy / y
|
|
|
|
y = dy
|
2008-12-28 19:41:38 +00:00
|
|
|
print 'x, y, dx, dy: ', x, y, dx, dy
|
2008-10-18 17:12:33 +00:00
|
|
|
self.image.fill = 0, 0, x, y
|
|
|
|
self.part_swallow('icon', self.image)
|
2008-12-28 19:41:38 +00:00
|
|
|
self.obj = self.part_object_get('clipper')
|
|
|
|
self.obj.size = x, y
|
|
|
|
self.obj.show()
|
|
|
|
print 'obj: ', self.obj
|
2008-10-18 17:12:33 +00:00
|
|
|
|
|
|
|
def delete(self):
|
|
|
|
EdjeGroup.hide(self)
|
2008-10-12 15:20:57 +00:00
|
|
|
|
2008-10-18 17:12:33 +00:00
|
|
|
@edje.decorators.signal_callback("mouse,up,1", "*")
|
2008-10-12 15:20:57 +00:00
|
|
|
def on_edje_signal_dialer_status_triggered(self, emission, source):
|
2008-10-18 17:12:33 +00:00
|
|
|
if source == "headline":
|
|
|
|
PyneoController.get_hon()
|
|
|
|
if source == "button_10":
|
|
|
|
self.delete()
|
2008-10-12 15:20:57 +00:00
|
|
|
PyneoController.show_dialer_screen()
|
2008-10-18 17:12:33 +00:00
|
|
|
if source == "button_11":
|
|
|
|
self.image.delete()
|
|
|
|
PyneoController.vote_hon(self.hot)
|
|
|
|
print '---vote hot'
|
|
|
|
if source == "button_12":
|
|
|
|
self.image.delete()
|
|
|
|
PyneoController.vote_hon(self.nothot)
|
|
|
|
print '---vote not'
|
|
|
|
print 'source: ', source
|
2008-10-12 15:20:57 +00:00
|
|
|
|