fixes for hotornot

git-svn-id: http://www.neo1973-germany.de/svn@190 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
fgau 2008-10-18 17:12:33 +00:00
parent dcdec41a4c
commit 0d98807c4f
4 changed files with 67 additions and 24 deletions

View file

@ -128,15 +128,14 @@ collections {
type: IMAGE;
description {
state: "default" 0;
rel1 { relative: 0 0; offset: 0 0; };
rel2 { relative: 1 1; offset: 0 0; };
image { normal: "bg.png"; };
rel1 { relative: 0 0; offset: 0 0; }
rel2 { relative: 1 1; offset: 0 0; }
image { normal: "bg.png"; }
}
}
part {
name: "headline";
type: TEXT;
mouse_events: 0;
description {
state: "default" 0;
color_class: "button_inactive";
@ -165,10 +164,20 @@ collections {
style: "textblock_style";
}
}
} /* end fix_caption */
BUTTON(7, 0, 47/70, 1/3, 57/70, "hot");
BUTTON(9, 2/3, 47/70, 3/3, 57/70, "not");
BUTTON(12, 0, 58/70 , 1/3, 68/70, "<");
} /* end hon_caption */
part {
name: "icon";
mouse_events: 0;
type: SWALLOW;
description {
/*fixed: 1 1;*/
rel1 { relative: 1/2 1/2; offset: -180 -180; }
rel2 { relative: 1/2 1/2; offset: 180 180; }
}
} /*end icon swallow */
BUTTON(10, 0, 58/70 , 1/3, 68/70, "<");
BUTTON(11, 1/3, 58/70, 2/3, 68/70, "hot");
BUTTON(12, 2/3, 58/70, 3/3, 68/70, "not");
}
}
}

View file

@ -118,8 +118,8 @@ class DialerScreen(EdjeGroup):
print '--- Hon Screen'
self.text = []
self.part_text_set("numberdisplay_text", "".join(self.text))
PyneoController.get_hon()
PyneoController.show_hon_screen()
# PyneoController.get_hon()
elif source == "dial":
PyneoController.show_incall_screen('outgoing')
PyneoController.gsm_dial("".join(self.text))

View file

@ -141,10 +141,13 @@ class PyneoController(object):
@classmethod
def get_hon(class_):
status = class_.hon_hotornot.GetHotOrNot(dbus_interface=DIN_HOTORNOT)
print '---hon status', status
img = object_by_url(status['img']).read()
print '---get hon', status
class_.notify_callbacks("get_hon", status)
@classmethod
def vote_hon(class_, vote):
class_.hon_hotornot.HotOrNot(vote, dbus_interface=DIN_HOTORNOT)
@classmethod
def power_up_gsm(class_):
try:
@ -391,11 +394,9 @@ class Dialer(object):
self.init_screen(DIALER_SCREEN_NAME, DialerScreen(self))
PyneoController.show_dialer_screen()
# self.show_screen(DIALER_SCREEN_NAME)
self.init_screen(INCALL_SCREEN_NAME, InCallScreen(self))
self.init_screen(GSM_STATUS_SCREEN_NAME, GsmStatusScreen(self))
self.init_screen(GPS_STATUS_SCREEN_NAME, GpsStatusScreen(self))
self.init_screen(HON_SCREEN_NAME, HonScreen(self))
PyneoController.power_up_gsm()
PyneoController.get_gsm_keyring()
@ -436,6 +437,7 @@ class Dialer(object):
self.show_screen(GPS_STATUS_SCREEN_NAME)
def on_hon_screen(self):
self.init_screen(HON_SCREEN_NAME, HonScreen(self))
self.show_screen(HON_SCREEN_NAME)

View file

@ -8,25 +8,57 @@ __license__ = "GPL3"
from epydial import *
class HonScreen(EdjeGroup):
class Tile(evas.Image):
def __init__(self, canvas):
evas.Image.__init__(self, canvas)
self.show()
def __init__(self, screen_manager):
EdjeGroup.__init__(self, screen_manager, HON_SCREEN_NAME)
def register_pyneo_callbacks(self):
PyneoController.register_callback("get_hon", self.on_get_hon)
PyneoController.register_callback("vote_hon", self.on_vote_hon)
def on_get_hon(self, status):
print '--- get hotornot pix'
print '--- pix', status['img']
self.part_text_set("hon_caption", "nick: %s<br>%s"%(status['nick'], status['img']))
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'])
@edje.decorators.signal_callback("hon_send", "*")
self.image = self.evas.Image(file=self.pix)
x, y = self.image.image_size
dx, dy = self.part_size_get('icon')
# self.image.geometry = 0, 0 , 100, 100
# self.image.show()
if x * dy > y * dx:
y = y * dx / x
x = dx
else:
x = x * dy / y
y = dy
print 'x,y: ', x, y, dx, dy
# self.obj.show()
self.image.fill = 0, 0, x, y
self.part_swallow('icon', self.image)
def delete(self):
self.image.hide()
EdjeGroup.hide(self)
@edje.decorators.signal_callback("mouse,up,1", "*")
def on_edje_signal_dialer_status_triggered(self, emission, source):
status = self.part_text_get("button_11_caption")
if source == "<":
if source == "headline":
PyneoController.get_hon()
if source == "button_10":
self.delete()
PyneoController.show_dialer_screen()
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