initialisation
git-svn-id: http://www.neo1973-germany.de/svn@93 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
parent
d515d0a41c
commit
14791e602a
3 changed files with 586 additions and 0 deletions
387
epydial/data/themes/dialer.edc
Normal file
387
epydial/data/themes/dialer.edc
Normal file
|
@ -0,0 +1,387 @@
|
||||||
|
// dialer.edc
|
||||||
|
// this is a theme for epydial, a pyneo dialer
|
||||||
|
//
|
||||||
|
// TODO: make the font colors shinier :)
|
||||||
|
//
|
||||||
|
// Signal1: "dialer_send"
|
||||||
|
// Parameter1.1: $"keynumber"
|
||||||
|
// Parameter1.2: "backspace"
|
||||||
|
// Parameter1.2: "dial"
|
||||||
|
|
||||||
|
data {
|
||||||
|
item: "author" "thomasg [thomas (a) gstaedtner (.) net]";
|
||||||
|
item: "version" "prototype";
|
||||||
|
item: "name" "epydial_default";
|
||||||
|
}
|
||||||
|
|
||||||
|
color_classes {
|
||||||
|
color_class {
|
||||||
|
name: "button_inactive";
|
||||||
|
color: 255 255 255 255;
|
||||||
|
color2: 25 215 0 255;
|
||||||
|
color3: 25 215 0 255;
|
||||||
|
}
|
||||||
|
color_class {
|
||||||
|
name: "button_active";
|
||||||
|
color: 0 0 0 255;
|
||||||
|
color2: 0 0 0 255;
|
||||||
|
color3: 0 0 0 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spectra {
|
||||||
|
spectrum {
|
||||||
|
name: "background";
|
||||||
|
color: 80 80 80 255 1;
|
||||||
|
color: 210 210 210 255 1;
|
||||||
|
}
|
||||||
|
spectrum {
|
||||||
|
name: "button";
|
||||||
|
color: 5 5 5 255 1;
|
||||||
|
color: 110 110 110 255 1;
|
||||||
|
color: 10 10 10 255 1;
|
||||||
|
}
|
||||||
|
spectrum {
|
||||||
|
name: "button_active";
|
||||||
|
color: 15 170 0 255 1;
|
||||||
|
color: 130 255 0 255 1;
|
||||||
|
color: 20 200 0 255 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define BUTTON(button_number, rel1x, rel1y, rel2x, rel2y, button_caption) \
|
||||||
|
part { \
|
||||||
|
name: "button_"button_number; \
|
||||||
|
type: GRADIENT; \
|
||||||
|
description { \
|
||||||
|
state: "default" 0; \
|
||||||
|
gradient { \
|
||||||
|
spectrum: "button"; \
|
||||||
|
rel1 { relative: 0 0; offset: 0 0; }; \
|
||||||
|
rel2 { relative: 0 0.75; offset: 0 0; }; \
|
||||||
|
} \
|
||||||
|
fill { \
|
||||||
|
spread: 1; \
|
||||||
|
angle: 1; \
|
||||||
|
size { relative: 1 0; offset: 0 0; }; \
|
||||||
|
} \
|
||||||
|
rel1 { relative: rel1x rel1y; offset: 0 0; }; \
|
||||||
|
rel2 { relative: rel2x rel2y; offset: 0 0; }; \
|
||||||
|
} \
|
||||||
|
description { \
|
||||||
|
state: "default" 0.5; \
|
||||||
|
inherit: "default" 0; \
|
||||||
|
gradient.spectrum: "button_active"; \
|
||||||
|
rel1.offset: 0 -5; \
|
||||||
|
rel2.offset: 0 5; \
|
||||||
|
} \
|
||||||
|
description { \
|
||||||
|
state: "default" 1; \
|
||||||
|
inherit: "default" 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
part { \
|
||||||
|
name: "button_accent_"button_number; \
|
||||||
|
type: RECT; \
|
||||||
|
description { \
|
||||||
|
state: "default" 0; \
|
||||||
|
color: 25 215 0 255; \
|
||||||
|
rel1 { \
|
||||||
|
to: "button_"button_number; \
|
||||||
|
relative: 0 0.95; \
|
||||||
|
} \
|
||||||
|
rel2.to: "button_"button_number; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
part { \
|
||||||
|
name: "button_"button_number"_caption"; \
|
||||||
|
type: TEXT; \
|
||||||
|
mouse_events: 0; \
|
||||||
|
effect: GLOW; \
|
||||||
|
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 "dialer_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; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DESIGN_STRIPE(stripe_number, rel1x, rel1y, rel2x, rel2y) \
|
||||||
|
part { \
|
||||||
|
name: "design_stripe_"stripe_number; \
|
||||||
|
type: RECT; \
|
||||||
|
description { \
|
||||||
|
state: "default" 0; \
|
||||||
|
color: 0 0 0 255; \
|
||||||
|
rel1 { relative: rel1x rel1y; offset: 0 0; }; \
|
||||||
|
rel2 { relative: rel2x rel2y; offset: 0 0; }; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DESIGN_SEPERATOR(seperator_number, rel1x, rel1y, rel2x, rel2y) \
|
||||||
|
part { \
|
||||||
|
name: "design_seperator_"seperator_number; \
|
||||||
|
type: RECT; \
|
||||||
|
description { \
|
||||||
|
state: "defeault" 0; \
|
||||||
|
color: 255 255 255 100; \
|
||||||
|
rel1 { relative: rel1x rel1y; offset: -0.5 7; }; \
|
||||||
|
rel2 { relative: rel2x rel2y; offset: 0.5 -9; }; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
collections {
|
||||||
|
group {
|
||||||
|
name: "pyneo/dialer/main";
|
||||||
|
min: 100 100;
|
||||||
|
max: 800 800;
|
||||||
|
parts {
|
||||||
|
part {
|
||||||
|
name: "background";
|
||||||
|
type: GRADIENT;
|
||||||
|
description {
|
||||||
|
state: "default" 0;
|
||||||
|
gradient {
|
||||||
|
spectrum: "background";
|
||||||
|
rel1 { relative: 0 0; offset: 0 0; };
|
||||||
|
rel2 { relative: 0 1; offset: 0 0; };
|
||||||
|
}
|
||||||
|
fill {
|
||||||
|
spread: 1;
|
||||||
|
angle: 1;
|
||||||
|
size { relative: 1 0; offset: 0 0; };
|
||||||
|
}
|
||||||
|
rel1 { relative: 0 0; offset: 0 0; };
|
||||||
|
rel2 { relative: 1 1; offset: 0 0; };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* stripes - just for design :) */
|
||||||
|
DESIGN_STRIPE(1, 1/2, 0.18, 1, 0.18);
|
||||||
|
DESIGN_STRIPE(2, 1/2, 0.22, 1, 0.22);
|
||||||
|
DESIGN_STRIPE(3, 1/2, 0.26, 1, 0.26);
|
||||||
|
|
||||||
|
part {
|
||||||
|
name: "numberdisplay_background";
|
||||||
|
type: RECT;
|
||||||
|
description {
|
||||||
|
state: "default" 0;
|
||||||
|
color: 0 0 0 255;
|
||||||
|
rel1 { relative: 0.02 0.02; offset: 0 0; };
|
||||||
|
rel2 { relative: 0.9 0.3; offset: 0 0; };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
name: "numberdisplay_foreground";
|
||||||
|
type: RECT;
|
||||||
|
description {
|
||||||
|
state: "default" 0;
|
||||||
|
color: 255 255 255 255;
|
||||||
|
rel1 {
|
||||||
|
to: "numberdisplay_background";
|
||||||
|
offset: 2 2;
|
||||||
|
}
|
||||||
|
rel2 {
|
||||||
|
to: "numberdisplay_background";
|
||||||
|
offset: -7 -7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
description {
|
||||||
|
state: "default" 0.5;
|
||||||
|
inherit: "default" 0;
|
||||||
|
color: 150 255 60 255;
|
||||||
|
rel1.offset: -10 -10;
|
||||||
|
rel2.offset: 10 10;
|
||||||
|
}
|
||||||
|
description {
|
||||||
|
state: "default" 1;
|
||||||
|
inherit: "default" 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "numberdisplay_forground_signal_emit";
|
||||||
|
signal: "mouse,down,*";
|
||||||
|
source: "numberdisplay_foreground";
|
||||||
|
action: SIGNAL_EMIT "dialer_send" "dial";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "numberdisplay_foreground_animation";
|
||||||
|
signal: "mouse,down,*";
|
||||||
|
source: "numberdisplay_foreground";
|
||||||
|
action: STATE_SET "default" 0.5;
|
||||||
|
target: "numberdisplay_foreground";
|
||||||
|
transition: LINEAR 0.25;
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "numberdisplay_foreground_animation_end";
|
||||||
|
signal: "mouse,up,*";
|
||||||
|
source: "numberdisplay_foreground";
|
||||||
|
action: STATE_SET "default" 1;;
|
||||||
|
target: "numberdisplay_foreground";
|
||||||
|
transition: LINEAR 0.25;
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
name: "numberdisplay_text";
|
||||||
|
type: TEXT;
|
||||||
|
mouse_events: 0;
|
||||||
|
effect: OUTLINE_SOFT_SHADOW;
|
||||||
|
description {
|
||||||
|
state: "default" 0;
|
||||||
|
color_class: "button_inactive";
|
||||||
|
rel1 {
|
||||||
|
to: "numberdisplay_foreground";
|
||||||
|
relative: 0.02 0;
|
||||||
|
}
|
||||||
|
rel2 {
|
||||||
|
to: "numberdisplay_foreground";
|
||||||
|
relative: 0.75 1;
|
||||||
|
}
|
||||||
|
text {
|
||||||
|
text: "testmode";
|
||||||
|
size: 18;
|
||||||
|
font: "Sans:style=Bold,Edje-Vera";
|
||||||
|
fit: 1 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
name: "numberdisplay_backspace";
|
||||||
|
type: TEXT;
|
||||||
|
mouse_events: 0;
|
||||||
|
effect: GLOW;
|
||||||
|
description {
|
||||||
|
state: "default" 0;
|
||||||
|
color_class: "button_inactive";
|
||||||
|
rel1 {
|
||||||
|
to: "numberdisplay_foreground";
|
||||||
|
relative: 0.77 0;
|
||||||
|
}
|
||||||
|
rel2 {
|
||||||
|
to: "numberdisplay_foreground";
|
||||||
|
relative: 1 1;
|
||||||
|
}
|
||||||
|
text {
|
||||||
|
text: "<";
|
||||||
|
size: 18;
|
||||||
|
font: "Sans:style=Bold,Edje-Vera";
|
||||||
|
fit: 1 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
part {
|
||||||
|
name: "numberdisplay_backspace_area";
|
||||||
|
type: RECT;
|
||||||
|
description {
|
||||||
|
state: "default" 0;
|
||||||
|
color: 0 0 0 0;
|
||||||
|
rel1 { relative: 2/3 0; offset: 0 0; };
|
||||||
|
rel2 { relative: 3/3 22/70; offset: 0 0; };
|
||||||
|
}
|
||||||
|
description {
|
||||||
|
state: "default" 0.3;
|
||||||
|
rel1.to: "numberdisplay_foreground";
|
||||||
|
rel2.to: "numberdisplay_foreground";
|
||||||
|
}
|
||||||
|
description {
|
||||||
|
state: "default" 0.6;
|
||||||
|
inherit: "default" 0.3;
|
||||||
|
color: 255 0 0 100;
|
||||||
|
}
|
||||||
|
description {
|
||||||
|
state: "default" 1;
|
||||||
|
inherit: "default" 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "numberdisplay_backspace_area_signal_emit";
|
||||||
|
signal: "mouse,down,*";
|
||||||
|
source: "numberdisplay_backspace_area";
|
||||||
|
action: SIGNAL_EMIT "dialer_send" "backspace";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "numberdisplay_backspace_area_animation_start";
|
||||||
|
signal: "mouse,down,*";
|
||||||
|
source: "numberdisplay_backspace_area";
|
||||||
|
action: STATE_SET "default" 0.3;
|
||||||
|
target: "numberdisplay_backspace_area";
|
||||||
|
transition: LINEAR 0;
|
||||||
|
after: "numberdisplay_backspace_area_animation_continue";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "numberdisplay_backspace_area_animation_continue";
|
||||||
|
action: STATE_SET "default" 0.6;
|
||||||
|
target: "numberdisplay_backspace_area";
|
||||||
|
transition: LINEAR 0.3;
|
||||||
|
after: "numberdisplay_backspace_area_animation_stop";
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
name: "numberdisplay_backspace_area_animation_stop";
|
||||||
|
action: STATE_SET "default" 1;
|
||||||
|
target: "numberdisplay_backspace_area";
|
||||||
|
transition: LINEAR 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* row 1 */
|
||||||
|
BUTTON(1, 0, 25/70, 1/3, 35/70, 1);
|
||||||
|
BUTTON(2, 1/3, 25/70, 2/3, 35/70, 2);
|
||||||
|
BUTTON(3, 2/3, 25/70, 3/3, 35/70, 3);
|
||||||
|
DESIGN_SEPERATOR(1, 1/3, 25/70, 1/3, 35/70);
|
||||||
|
DESIGN_SEPERATOR(2, 2/3, 25/70, 2/3, 35/70);
|
||||||
|
|
||||||
|
/* row 2 */
|
||||||
|
BUTTON(4, 0, 36/70, 1/3, 46/70, 4);
|
||||||
|
BUTTON(5, 1/3, 36/70, 2/3, 46/70, 5);
|
||||||
|
BUTTON(6, 2/3, 36/70, 3/3, 46/70, 6);
|
||||||
|
DESIGN_SEPERATOR(4, 1/3, 36/70, 1/3, 46/70);
|
||||||
|
DESIGN_SEPERATOR(5, 2/3, 36/70, 2/3, 46/70);
|
||||||
|
|
||||||
|
/* row 3 */
|
||||||
|
BUTTON(7, 0, 47/70, 1/3, 57/70, 7);
|
||||||
|
BUTTON(8, 1/3, 47/70, 2/3, 57/70, 8);
|
||||||
|
BUTTON(9, 2/3, 47/70, 3/3, 57/70, 9);
|
||||||
|
DESIGN_SEPERATOR(7, 1/3, 47/70, 1/3, 57/70);
|
||||||
|
DESIGN_SEPERATOR(8, 2/3, 47/70, 2/3, 57/70);
|
||||||
|
|
||||||
|
/* row 4 */
|
||||||
|
BUTTON(10, 0, 58/70 , 1/3, 68/70, "*");
|
||||||
|
BUTTON(11, 1/3, 58/70, 2/3, 68/70, 0);
|
||||||
|
BUTTON(12, 2/3, 58/70, 3/3, 68/70, "#");
|
||||||
|
DESIGN_SEPERATOR(10, 1/3, 58/70, 1/3, 68/70);
|
||||||
|
DESIGN_SEPERATOR(11, 2/3, 58/70, 2/3, 68/70);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
epydial/data/themes/dialer.edj
Normal file
BIN
epydial/data/themes/dialer.edj
Normal file
Binary file not shown.
199
epydial/epydial.py
Executable file
199
epydial/epydial.py
Executable file
|
@ -0,0 +1,199 @@
|
||||||
|
#!/usr/bin/env python2.5
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
__author__ = ""
|
||||||
|
__version__ = "prototype"
|
||||||
|
__copyright__ = "Copyright (c) 2008"
|
||||||
|
__license__ = "GPL3"
|
||||||
|
|
||||||
|
WIDTH = 480
|
||||||
|
HEIGHT = 640
|
||||||
|
FS = True
|
||||||
|
TITLE = "epydial"
|
||||||
|
WM_INFO = ("epydial", "epydial")
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import ecore
|
||||||
|
import ecore.evas
|
||||||
|
import evas.decorators
|
||||||
|
import edje.decorators
|
||||||
|
import edje
|
||||||
|
from dbus import SystemBus
|
||||||
|
from e_dbus import DBusEcoreMainLoop
|
||||||
|
import e_dbus
|
||||||
|
from datetime import datetime
|
||||||
|
from os import system # alsactl is used with a sytem call
|
||||||
|
from pyneo.dbus_support import *
|
||||||
|
from pyneo.sys_support import pr_set_name
|
||||||
|
|
||||||
|
from ConfigParser import SafeConfigParser
|
||||||
|
from os.path import exists
|
||||||
|
import time
|
||||||
|
|
||||||
|
#import sqlite3
|
||||||
|
|
||||||
|
for i in "data/themes/dialer.edj".split():
|
||||||
|
if os.path.exists( i ):
|
||||||
|
global edjepath
|
||||||
|
edjepath = i
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise "Edje not found"
|
||||||
|
|
||||||
|
class edje_group(edje.Edje):
|
||||||
|
def __init__(self, main, group):
|
||||||
|
self.main = main
|
||||||
|
global edjepath
|
||||||
|
f = edjepath
|
||||||
|
try:
|
||||||
|
edje.Edje.__init__(self, self.main.evas_canvas.evas_obj.evas, file=f, group=group)
|
||||||
|
except edje.EdjeLoadError, e:
|
||||||
|
raise SystemExit("error loading %s: %s" % (f, e))
|
||||||
|
self.size = self.main.evas_canvas.evas_obj.evas.size
|
||||||
|
|
||||||
|
class dialer_main(edje_group):
|
||||||
|
def __init__(self, main):
|
||||||
|
edje_group.__init__(self, main, "pyneo/dialer/main")
|
||||||
|
self.text = []
|
||||||
|
|
||||||
|
dbus_ml = e_dbus.DBusEcoreMainLoop()
|
||||||
|
self.system_bus = SystemBus(mainloop=dbus_ml)
|
||||||
|
self.init_dbus()
|
||||||
|
|
||||||
|
def init_dbus(self):
|
||||||
|
try:
|
||||||
|
self.gsm = object_by_url('dbus:///org/pyneo/GsmDevice')
|
||||||
|
self.wireless = object_by_url('dbus:///org/pyneo/gsmdevice/Network')
|
||||||
|
self.keyring = object_by_url('dbus:///org/pyneo/GsmDevice')
|
||||||
|
except Exception, e:
|
||||||
|
print e
|
||||||
|
#if not self.dbus_timer:
|
||||||
|
# self.dbus_timer = ecore.timer_add(2, self.init_dbus)
|
||||||
|
# We had an error, keep the timer running
|
||||||
|
#return True
|
||||||
|
|
||||||
|
# No error, all went well
|
||||||
|
#if self.dbus_timer: self.dbus_timer.stop()
|
||||||
|
# D-Bus is ready, let's init GSM
|
||||||
|
self.gsm_on()
|
||||||
|
|
||||||
|
def gsm_on(self):
|
||||||
|
try:
|
||||||
|
if self.gsm.GetPower('sample', dbus_interface=DIN_POWERED, ):
|
||||||
|
print '---', 'gsm device is already on'
|
||||||
|
else:
|
||||||
|
self.gsm.SetPower('sample', True, dbus_interface=DIN_POWERED, )
|
||||||
|
print '---', 'switching device on'
|
||||||
|
except Exception, e:
|
||||||
|
print e
|
||||||
|
#if not self.gsm_timer:
|
||||||
|
# self.gsm_timer = ecore.timer_add(5, self.gsm_on)
|
||||||
|
# We had an error, keep the timer running
|
||||||
|
#return True
|
||||||
|
# No error
|
||||||
|
#if self.gsm_timer: self.gsm_timer.stop()
|
||||||
|
# GSM ready, let's ask SIM PIN
|
||||||
|
self.sim_pin()
|
||||||
|
|
||||||
|
def sim_pin(self):
|
||||||
|
self.res = dedbusmap(self.keyring.GetOpened(dbus_interface=DIN_KEYRING))
|
||||||
|
if self.res['code'] != 'READY': # TODO unify!
|
||||||
|
print '---', 'opening keyring'
|
||||||
|
self.part_text_set("numberdisplay_text", "Enter " + self.res['code'])
|
||||||
|
self.res = dedbusmap(self.keyring.GetOpened(dbus_interface=DIN_KEYRING))
|
||||||
|
else:
|
||||||
|
print '---', 'already authorized'
|
||||||
|
self.nw_register()
|
||||||
|
|
||||||
|
def nw_register(self):
|
||||||
|
self.nw_res = dedbusmap(self.wireless.GetStatus(dbus_interface=DIN_WIRELESS))
|
||||||
|
if not self.nw_res['stat'] in (1, 5, ): # TODO unify!
|
||||||
|
print '---', 'registering to gsm network'
|
||||||
|
self.wireless.Register(dbus_interface=DIN_WIRELESS)
|
||||||
|
self.nw_res = dedbusmap(self.wireless.GetStatus(dbus_interface=DIN_WIRELESS))
|
||||||
|
else:
|
||||||
|
print '---', 'already registered'
|
||||||
|
|
||||||
|
@edje.decorators.signal_callback("dialer_send", "*")
|
||||||
|
def on_edje_signal_numberkey_triggered(self, emission, source):
|
||||||
|
if self.res['code'] != 'READY':
|
||||||
|
if source in ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "#", "*", ):
|
||||||
|
self.text.append(source)
|
||||||
|
print ''.join(self.text)
|
||||||
|
self.part_text_set("numberdisplay_text", "".join(self.text))
|
||||||
|
elif source == "backspace":
|
||||||
|
self.text = self.text[:-1]
|
||||||
|
print ''.join(self.text)
|
||||||
|
self.part_text_set("numberdisplay_text", "".join(self.text))
|
||||||
|
elif source == "dial":
|
||||||
|
print '---', 'send pin'
|
||||||
|
self.keyring.Open(''.join(self.text), dbus_interface=DIN_KEYRING, )
|
||||||
|
self.part_text_set("numberdisplay_text", "register ...")
|
||||||
|
self.nw_register()
|
||||||
|
else:
|
||||||
|
if source in ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "#", "*", ):
|
||||||
|
self.text.append(source)
|
||||||
|
print ''.join(self.text)
|
||||||
|
self.part_text_set("numberdisplay_text", "".join(self.text))
|
||||||
|
elif source == "backspace":
|
||||||
|
self.text = self.text[:-1]
|
||||||
|
print ''.join(self.text)
|
||||||
|
self.part_text_set("numberdisplay_text", "".join(self.text))
|
||||||
|
elif source == "dial":
|
||||||
|
print '---', 'dial number'
|
||||||
|
self.part_text_set("numberdisplay_text", "register ...")
|
||||||
|
|
||||||
|
class TestView(object):
|
||||||
|
def __init__(self):
|
||||||
|
edje.frametime_set(1.0 / 20)
|
||||||
|
self.evas_canvas = EvasCanvas(fullscreen=FS, engine="x11-16", size="480x640")
|
||||||
|
|
||||||
|
self.groups = {}
|
||||||
|
self.groups["pyneo/dialer/main"] = dialer_main(self)
|
||||||
|
self.evas_canvas.evas_obj.data["pyneo/dialer/main"] = self.groups["pyneo/dialer/main"]
|
||||||
|
self.groups["pyneo/dialer/main"].show()
|
||||||
|
self.groups["pyneo/dialer/main"].part_text_set("numberdisplay_text", "wait ...")
|
||||||
|
|
||||||
|
class EvasCanvas(object):
|
||||||
|
def __init__(self, fullscreen, engine, size):
|
||||||
|
if engine == "x11":
|
||||||
|
f = ecore.evas.SoftwareX11
|
||||||
|
# elif engine == "x11-16":
|
||||||
|
# if ecore.evas.engine_type_supported_get("software_x11_16"):
|
||||||
|
# f = ecore.evas.SoftwareX11_16
|
||||||
|
else:
|
||||||
|
print "warning: x11-16 is not supported, fallback to x11"
|
||||||
|
f = ecore.evas.SoftwareX11
|
||||||
|
|
||||||
|
self.evas_obj = f(w=480, h=640)
|
||||||
|
self.evas_obj.callback_delete_request = self.on_delete_request
|
||||||
|
self.evas_obj.callback_resize = self.on_resize
|
||||||
|
|
||||||
|
self.evas_obj.title = TITLE
|
||||||
|
self.evas_obj.name_class = WM_INFO
|
||||||
|
self.evas_obj.fullscreen = FS
|
||||||
|
# self.evas_obj.size = size
|
||||||
|
self.evas_obj.show()
|
||||||
|
|
||||||
|
def on_resize(self, evas_obj):
|
||||||
|
x, y, w, h = evas_obj.evas.viewport
|
||||||
|
size = (w, h)
|
||||||
|
for key in evas_obj.data.keys():
|
||||||
|
evas_obj.data[key].size = size
|
||||||
|
|
||||||
|
def on_delete_request(self, evas_obj):
|
||||||
|
ecore.main_loop_quit()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
TestView()
|
||||||
|
ecore.main_loop_begin()
|
||||||
|
|
||||||
|
'''
|
||||||
|
export LDFLAGS="$LDFLAGS -L/opt/e17/lib"
|
||||||
|
export PKG_CONFIG_PATH="/opt/e17/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||||
|
export PATH="$PATH:/opt/e17/bin"
|
||||||
|
export PYTHONPATH="/home/fgau/usr/lib/python2.5/site-packages"
|
||||||
|
|
||||||
|
edje_cc -v -id ../images -fd ../fonts *edc
|
||||||
|
'''
|
||||||
|
|
Loading…
Reference in a new issue