add some hotornot stuff
git-svn-id: http://www.neo1973-germany.de/svn@188 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
parent
b10503ddf1
commit
4a8b41faad
5 changed files with 236 additions and 3 deletions
174
epydial/data/themes/blackwhite/hon_screen.edc
Normal file
174
epydial/data/themes/blackwhite/hon_screen.edc
Normal file
|
@ -0,0 +1,174 @@
|
||||||
|
// incall.edc
|
||||||
|
// this is a theme for epydial, a pyneo dialer
|
||||||
|
//
|
||||||
|
// TODO: make the font colors shinier :)
|
||||||
|
//
|
||||||
|
// Signal1:
|
||||||
|
|
||||||
|
data {
|
||||||
|
item: "author" "thomasg [thomas (a) gstaedtner (.) net]";
|
||||||
|
item: "version" "prototype";
|
||||||
|
item: "name" "epydial_blackwhite";
|
||||||
|
}
|
||||||
|
|
||||||
|
images {
|
||||||
|
image: "bg.png" COMP;
|
||||||
|
}
|
||||||
|
|
||||||
|
color_classes {
|
||||||
|
color_class {
|
||||||
|
name: "black";
|
||||||
|
color: 0 0 0 255;
|
||||||
|
color2: 0 0 0 255;
|
||||||
|
color3: 0 0 0 255;
|
||||||
|
}
|
||||||
|
color_class {
|
||||||
|
name: "unvisible";
|
||||||
|
color: 0 0 0 0;
|
||||||
|
color2: 128 128 128 255;
|
||||||
|
color3: 128 128 128 255;
|
||||||
|
}
|
||||||
|
color_class {
|
||||||
|
name: "button_inactive";
|
||||||
|
color: 255 255 255 128;
|
||||||
|
color2: 128 128 128 255;
|
||||||
|
color3: 128 128 128 255;;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
styles {
|
||||||
|
style {
|
||||||
|
name: "textblock_style";
|
||||||
|
base: "font=sans.bold font_size=20 align=left valign=top color=#fff wrap=word";
|
||||||
|
tag: "h1" "+ font_size=28";
|
||||||
|
tag: "/h1" "- \n";
|
||||||
|
tag: "p" "+";
|
||||||
|
tag: "/p" "- \n";
|
||||||
|
tag: "em" "+ style=underline underline_color=#000A underline2_color=#0005";
|
||||||
|
tag: "/em" "-";
|
||||||
|
tag: "br" "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define BUTTON(button_number, rel1x, rel1y, rel2x, rel2y, button_caption) \
|
||||||
|
part { \
|
||||||
|
name: "button_"button_number; \
|
||||||
|
type: RECT; \
|
||||||
|
description { \
|
||||||
|
state: "default" 0; \
|
||||||
|
color_class: "unvisible"; \
|
||||||
|
rel1 { relative: rel1x rel1y; offset: 0 0; }; \
|
||||||
|
rel2 { relative: rel2x rel2y; offset: 0 0; }; \
|
||||||
|
} \
|
||||||
|
description { \
|
||||||
|
state: "default" 0.5; \
|
||||||
|
inherit: "default" 0; \
|
||||||
|
color_class: "unvisible"; \
|
||||||
|
rel1.offset: 0 -5; \
|
||||||
|
rel2.offset: 0 5; \
|
||||||
|
} \
|
||||||
|
description { \
|
||||||
|
state: "default" 1; \
|
||||||
|
inherit: "default" 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
part { \
|
||||||
|
name: "button_"button_number"_caption"; \
|
||||||
|
type: TEXT; \
|
||||||
|
mouse_events: 0; \
|
||||||
|
description { \
|
||||||
|
state: "default" 0; \
|
||||||
|
color_class: "button_inactive"; \
|
||||||
|
rel1 { \
|
||||||
|
to: "button_"button_number; \
|
||||||
|
relative: 0 0; \
|
||||||
|
} \
|
||||||
|
rel2 { \
|
||||||
|
to: "button_"button_number; \
|
||||||
|
relative: 1 1; \
|
||||||
|
} \
|
||||||
|
text { \
|
||||||
|
text: button_caption; \
|
||||||
|
size: 18; \
|
||||||
|
font: "Sans:style=Bold,Edje-Vera"; \
|
||||||
|
fit: 1 1; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
program { \
|
||||||
|
name: "button_"button_number"_signal_emit"; \
|
||||||
|
signal: "mouse,down,*"; \
|
||||||
|
source: "button_"button_number; \
|
||||||
|
action: SIGNAL_EMIT "hon_send" button_caption; \
|
||||||
|
} \
|
||||||
|
program { \
|
||||||
|
name: "button_"button_number"_animation"; \
|
||||||
|
signal: "mouse,down,*"; \
|
||||||
|
source: "button_"button_number; \
|
||||||
|
action: STATE_SET "default" 0.5; \
|
||||||
|
target: "button_"button_number; \
|
||||||
|
} \
|
||||||
|
program { \
|
||||||
|
name: "button_"button_number"_animation_end"; \
|
||||||
|
signal: "mouse,up,*"; \
|
||||||
|
source: "button_"button_number; \
|
||||||
|
action: STATE_SET "default" 1; \
|
||||||
|
target: "button_"button_number; \
|
||||||
|
transition: DECELERATE 0.1; \
|
||||||
|
}
|
||||||
|
|
||||||
|
collections {
|
||||||
|
group {
|
||||||
|
name: "pyneo/hon/screen";
|
||||||
|
min: 100 100;
|
||||||
|
max: 800 800;
|
||||||
|
parts {
|
||||||
|
part {
|
||||||
|
name: "background";
|
||||||
|
type: IMAGE;
|
||||||
|
description {
|
||||||
|
state: "default" 0;
|
||||||
|
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";
|
||||||
|
rel1 { relative: 0 0; }
|
||||||
|
rel2 { relative: 1 1/7; }
|
||||||
|
text {
|
||||||
|
text: "hot or not";
|
||||||
|
size: 18;
|
||||||
|
font: "Sans:style=Bold,Edje-Vera";
|
||||||
|
fit: 1 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
name: "hon_caption";
|
||||||
|
type: TEXTBLOCK;
|
||||||
|
mouse_events: 0;
|
||||||
|
description {
|
||||||
|
color_class: "button_inactive";
|
||||||
|
align: 0.5 0.5;
|
||||||
|
fixed: 1 1;
|
||||||
|
rel1 { relative: 0 3/20; }
|
||||||
|
rel2 { relative: 1 10/20; }
|
||||||
|
text {
|
||||||
|
text: "file:";
|
||||||
|
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, "<");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -114,6 +114,12 @@ class DialerScreen(EdjeGroup):
|
||||||
self.part_text_set("numberdisplay_text", "".join(self.text))
|
self.part_text_set("numberdisplay_text", "".join(self.text))
|
||||||
PyneoController.power_status_gps()
|
PyneoController.power_status_gps()
|
||||||
PyneoController.show_gps_status_screen()
|
PyneoController.show_gps_status_screen()
|
||||||
|
elif source == "dial" and ''.join(self.text) == "6":
|
||||||
|
print '--- Hon Screen'
|
||||||
|
self.text = []
|
||||||
|
self.part_text_set("numberdisplay_text", "".join(self.text))
|
||||||
|
PyneoController.get_hon()
|
||||||
|
PyneoController.show_hon_screen()
|
||||||
elif source == "dial":
|
elif source == "dial":
|
||||||
PyneoController.show_incall_screen('outgoing')
|
PyneoController.show_incall_screen('outgoing')
|
||||||
PyneoController.gsm_dial("".join(self.text))
|
PyneoController.gsm_dial("".join(self.text))
|
||||||
|
|
|
@ -22,6 +22,7 @@ DIALER_SCREEN_NAME = "pyneo/dialer/main"
|
||||||
INCALL_SCREEN_NAME = "pyneo/dialer/incall"
|
INCALL_SCREEN_NAME = "pyneo/dialer/incall"
|
||||||
GSM_STATUS_SCREEN_NAME = "pyneo/gsm/status"
|
GSM_STATUS_SCREEN_NAME = "pyneo/gsm/status"
|
||||||
GPS_STATUS_SCREEN_NAME = "pyneo/gps/status"
|
GPS_STATUS_SCREEN_NAME = "pyneo/gps/status"
|
||||||
|
HON_SCREEN_NAME = "pyneo/hon/screen"
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from dbus import SystemBus
|
from dbus import SystemBus
|
||||||
|
@ -73,8 +74,10 @@ class PyneoController(object):
|
||||||
gsm = None
|
gsm = None
|
||||||
pwr = None
|
pwr = None
|
||||||
gps = None
|
gps = None
|
||||||
|
hon = None
|
||||||
gsm_wireless = None
|
gsm_wireless = None
|
||||||
gsm_keyring = None
|
gsm_keyring = None
|
||||||
|
hon_hotornot = None
|
||||||
|
|
||||||
gsm_wireless_status = None
|
gsm_wireless_status = None
|
||||||
gsm_keyring_status = None
|
gsm_keyring_status = None
|
||||||
|
@ -107,6 +110,8 @@ class PyneoController(object):
|
||||||
class_.gsm_wireless = object_by_url(class_.gsm.GetDevice('wireless'))
|
class_.gsm_wireless = object_by_url(class_.gsm.GetDevice('wireless'))
|
||||||
class_.pwr = object_by_url('dbus:///org/pyneo/Power')
|
class_.pwr = object_by_url('dbus:///org/pyneo/Power')
|
||||||
class_.gps = object_by_url('dbus:///org/pyneo/GpsLocation')
|
class_.gps = object_by_url('dbus:///org/pyneo/GpsLocation')
|
||||||
|
class_.hon = object_by_url('dbus:///org/pyneo/HotOrNot')
|
||||||
|
class_.hon_hotornot = object_by_url(class_.hon.GetDevice('hotornot'))
|
||||||
class_.call_type = 'nix'
|
class_.call_type = 'nix'
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
@ -133,6 +138,13 @@ class PyneoController(object):
|
||||||
def power_status_gsm(class_):
|
def power_status_gsm(class_):
|
||||||
class_.notify_callbacks("power_status_gsm", class_.gsm.GetPower(APP_TITLE, dbus_interface=DIN_POWERED))
|
class_.notify_callbacks("power_status_gsm", class_.gsm.GetPower(APP_TITLE, dbus_interface=DIN_POWERED))
|
||||||
|
|
||||||
|
@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()
|
||||||
|
class_.notify_callbacks("get_hon", status)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def power_up_gsm(class_):
|
def power_up_gsm(class_):
|
||||||
try:
|
try:
|
||||||
|
@ -340,12 +352,16 @@ class PyneoController(object):
|
||||||
print "CALLING_TYPE: ", class_.call_type
|
print "CALLING_TYPE: ", class_.call_type
|
||||||
class_.notify_callbacks("gsm_phone_call_start")
|
class_.notify_callbacks("gsm_phone_call_start")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def show_hon_screen(class_):
|
||||||
|
class_.notify_callbacks("show_hon_screen")
|
||||||
|
|
||||||
|
|
||||||
from dialer_screen import *
|
from dialer_screen import *
|
||||||
from incall_screen import *
|
from incall_screen import *
|
||||||
from gsm_status_screen import *
|
from gsm_status_screen import *
|
||||||
from gps_status_screen import *
|
from gps_status_screen import *
|
||||||
|
from hon_screen import *
|
||||||
|
|
||||||
class Dialer(object):
|
class Dialer(object):
|
||||||
screens = None
|
screens = None
|
||||||
|
@ -366,6 +382,7 @@ class Dialer(object):
|
||||||
PyneoController.register_callback("show_gsm_status_screen", self.on_gsm_status_screen)
|
PyneoController.register_callback("show_gsm_status_screen", self.on_gsm_status_screen)
|
||||||
PyneoController.register_callback("show_gps_status_screen", self.on_gps_status_screen)
|
PyneoController.register_callback("show_gps_status_screen", self.on_gps_status_screen)
|
||||||
PyneoController.register_callback("show_dialer_screen", self.on_call_end)
|
PyneoController.register_callback("show_dialer_screen", self.on_call_end)
|
||||||
|
PyneoController.register_callback("show_hon_screen", self.on_hon_screen)
|
||||||
|
|
||||||
# Initialize the D-Bus interface to pyneo
|
# Initialize the D-Bus interface to pyneo
|
||||||
dbus_ml = e_dbus.DBusEcoreMainLoop()
|
dbus_ml = e_dbus.DBusEcoreMainLoop()
|
||||||
|
@ -378,6 +395,7 @@ class Dialer(object):
|
||||||
self.init_screen(INCALL_SCREEN_NAME, InCallScreen(self))
|
self.init_screen(INCALL_SCREEN_NAME, InCallScreen(self))
|
||||||
self.init_screen(GSM_STATUS_SCREEN_NAME, GsmStatusScreen(self))
|
self.init_screen(GSM_STATUS_SCREEN_NAME, GsmStatusScreen(self))
|
||||||
self.init_screen(GPS_STATUS_SCREEN_NAME, GpsStatusScreen(self))
|
self.init_screen(GPS_STATUS_SCREEN_NAME, GpsStatusScreen(self))
|
||||||
|
self.init_screen(HON_SCREEN_NAME, HonScreen(self))
|
||||||
|
|
||||||
PyneoController.power_up_gsm()
|
PyneoController.power_up_gsm()
|
||||||
PyneoController.get_gsm_keyring()
|
PyneoController.get_gsm_keyring()
|
||||||
|
@ -417,6 +435,9 @@ class Dialer(object):
|
||||||
def on_gps_status_screen(self):
|
def on_gps_status_screen(self):
|
||||||
self.show_screen(GPS_STATUS_SCREEN_NAME)
|
self.show_screen(GPS_STATUS_SCREEN_NAME)
|
||||||
|
|
||||||
|
def on_hon_screen(self):
|
||||||
|
self.show_screen(HON_SCREEN_NAME)
|
||||||
|
|
||||||
|
|
||||||
class EvasCanvas(object):
|
class EvasCanvas(object):
|
||||||
def __init__(self, fullscreen, engine_name):
|
def __init__(self, fullscreen, engine_name):
|
||||||
|
|
|
@ -23,8 +23,8 @@ class GpsStatusScreen(EdjeGroup):
|
||||||
self.part_text_set("gps_caption", "gps device is %s"%p_status)
|
self.part_text_set("gps_caption", "gps device is %s"%p_status)
|
||||||
|
|
||||||
def on_gps_position_change(self, status):
|
def on_gps_position_change(self, status):
|
||||||
if status['fix'] != 0:
|
if status['fix'] == 3:
|
||||||
self.part_text_set("gps_caption", "fix: %d<br>long/lat: %f/%f<br>altitude: %d<br>kph/course: %d/%d<br>satellites: %d"%(status['fix'], status['longitude'], status['latitude'], status['altitude'], status['kph'], status['course'], status['satellites']))
|
self.part_text_set("gps_caption", "fix: %s<br>long/lat: %s/%s<br>altitude: %s<br>kph/course: %s/%s<br>satellites: %s"%(status['fix'], status['longitude'], status['latitude'], status['altitude'], status['kph'], status['course'], status['satellites']))
|
||||||
else:
|
else:
|
||||||
self.part_text_set("gps_caption", "fix: NIX FIX")
|
self.part_text_set("gps_caption", "fix: NIX FIX")
|
||||||
|
|
||||||
|
|
32
epydial/hon_screen.py
Normal file
32
epydial/hon_screen.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env python2.5
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
__author__ = "Soeren Apel (abraxa@dar-clan.de), Frank Gau (fgau@gau-net.de), Thomas Gstaedner (thomas (a) gstaedtner (.) net)"
|
||||||
|
__version__ = "prototype"
|
||||||
|
__copyright__ = "Copyright (c) 2008"
|
||||||
|
__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)
|
||||||
|
|
||||||
|
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']))
|
||||||
|
|
||||||
|
@edje.decorators.signal_callback("hon_send", "*")
|
||||||
|
def on_edje_signal_dialer_status_triggered(self, emission, source):
|
||||||
|
status = self.part_text_get("button_11_caption")
|
||||||
|
if source == "<":
|
||||||
|
PyneoController.show_dialer_screen()
|
||||||
|
|
Loading…
Reference in a new issue