Group imports by category (system, efl, others)
Sort imports alphabetically Remove duplicate imports (import os / import os.path) Remove comments where there was already code in the same line (comments on separate lines are better) Fix whitespace / tab indentation where necessary git-svn-id: http://www.neo1973-germany.de/svn@98 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
parent
3b5fd004fa
commit
1fc87d074d
1 changed files with 21 additions and 24 deletions
|
@ -13,31 +13,28 @@ WM_INFO = ("epydial", "epydial")
|
||||||
EDJE_GROUP_NAME = "pyneo/dialer/main"
|
EDJE_GROUP_NAME = "pyneo/dialer/main"
|
||||||
EDJE_FILE_NAME = "data/themes/dialer.edj"
|
EDJE_FILE_NAME = "data/themes/dialer.edj"
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
from dbus import SystemBus
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
import e_dbus
|
||||||
import ecore
|
import ecore
|
||||||
import ecore.evas
|
import ecore.evas
|
||||||
import evas.decorators
|
|
||||||
import edje.decorators
|
import edje.decorators
|
||||||
import edje
|
import edje
|
||||||
from dbus import SystemBus
|
import evas.decorators
|
||||||
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.dbus_support import *
|
||||||
from pyneo.sys_support import pr_set_name
|
from pyneo.sys_support import pr_set_name
|
||||||
|
|
||||||
from ConfigParser import SafeConfigParser
|
from ConfigParser import SafeConfigParser
|
||||||
from os.path import exists
|
|
||||||
import time
|
|
||||||
from time import sleep
|
|
||||||
|
|
||||||
#import sqlite3
|
|
||||||
|
|
||||||
class edje_group(edje.Edje):
|
class edje_group(edje.Edje):
|
||||||
def __init__(self, main, group):
|
def __init__(self, main, group):
|
||||||
self.main = main
|
self.main = main
|
||||||
|
self.size = self.main.evas_canvas.evas_obj.evas.size
|
||||||
|
|
||||||
if not os.path.exists(EDJE_FILE_NAME):
|
if not os.path.exists(EDJE_FILE_NAME):
|
||||||
raise IOError("Edje theme file not found: " + EDJE_FILE_NAME)
|
raise IOError("Edje theme file not found: " + EDJE_FILE_NAME)
|
||||||
|
@ -45,16 +42,16 @@ class edje_group(edje.Edje):
|
||||||
try:
|
try:
|
||||||
edje.Edje.__init__(self, self.main.evas_canvas.evas_obj.evas, file=EDJE_FILE_NAME, group=group)
|
edje.Edje.__init__(self, self.main.evas_canvas.evas_obj.evas, file=EDJE_FILE_NAME, group=group)
|
||||||
except edje.EdjeLoadError, e:
|
except edje.EdjeLoadError, e:
|
||||||
raise SystemExit("error loading %s: %s" % (f, e))
|
raise SystemExit("Error loading %s: %s" % (f, e))
|
||||||
self.size = self.main.evas_canvas.evas_obj.evas.size
|
|
||||||
|
|
||||||
class dialer_main(edje_group):
|
class dialer_main(edje_group):
|
||||||
def __init__(self, main):
|
def __init__(self, main):
|
||||||
edje_group.__init__(self, main, EDJE_GROUP_NAME)
|
edje_group.__init__(self, main, EDJE_GROUP_NAME)
|
||||||
self.text = []
|
self.text = []
|
||||||
|
|
||||||
dbus_ml = e_dbus.DBusEcoreMainLoop()
|
dbus_ml = e_dbus.DBusEcoreMainLoop()
|
||||||
self.system_bus = SystemBus(mainloop=dbus_ml)
|
self.system_bus = SystemBus(mainloop=dbus_ml)
|
||||||
|
|
||||||
ecore.timer_add(5, self.init_dbus)
|
ecore.timer_add(5, self.init_dbus)
|
||||||
|
|
||||||
def init_dbus(self):
|
def init_dbus(self):
|
||||||
|
@ -68,7 +65,7 @@ class dialer_main(edje_group):
|
||||||
# self.dbus_timer = ecore.timer_add(2, self.init_dbus)
|
# self.dbus_timer = ecore.timer_add(2, self.init_dbus)
|
||||||
# We had an error, keep the timer running
|
# We had an error, keep the timer running
|
||||||
#return True
|
#return True
|
||||||
|
|
||||||
# No error, all went well
|
# No error, all went well
|
||||||
#if self.dbus_timer: self.dbus_timer.stop()
|
#if self.dbus_timer: self.dbus_timer.stop()
|
||||||
# D-Bus is ready, let's init GSM
|
# D-Bus is ready, let's init GSM
|
||||||
|
@ -94,17 +91,17 @@ class dialer_main(edje_group):
|
||||||
|
|
||||||
def sim_pin(self):
|
def sim_pin(self):
|
||||||
self.res = dedbusmap(self.keyring.GetOpened(dbus_interface=DIN_KEYRING))
|
self.res = dedbusmap(self.keyring.GetOpened(dbus_interface=DIN_KEYRING))
|
||||||
if self.res['code'] != 'READY': # TODO unify!
|
if self.res['code'] != 'READY':
|
||||||
print '---', 'opening keyring'
|
print '---', 'opening keyring'
|
||||||
self.part_text_set("numberdisplay_text", "Enter " + self.res['code'])
|
self.part_text_set("numberdisplay_text", "Enter " + self.res['code'])
|
||||||
self.res = dedbusmap(self.keyring.GetOpened(dbus_interface=DIN_KEYRING))
|
self.res = dedbusmap(self.keyring.GetOpened(dbus_interface=DIN_KEYRING))
|
||||||
else:
|
else:
|
||||||
print '---', 'already authorized'
|
print '---', 'already authorized'
|
||||||
self.nw_register()
|
self.nw_register()
|
||||||
|
|
||||||
def nw_register(self):
|
def nw_register(self):
|
||||||
self.nw_res = dedbusmap(self.wireless.GetStatus(dbus_interface=DIN_WIRELESS))
|
self.nw_res = dedbusmap(self.wireless.GetStatus(dbus_interface=DIN_WIRELESS))
|
||||||
if not self.nw_res['stat'] in (1, 5, ): # TODO unify!
|
if not self.nw_res['stat'] in (1, 5, ):
|
||||||
print '---', 'registering to gsm network'
|
print '---', 'registering to gsm network'
|
||||||
self.wireless.Register(dbus_interface=DIN_WIRELESS)
|
self.wireless.Register(dbus_interface=DIN_WIRELESS)
|
||||||
self.nw_res = dedbusmap(self.wireless.GetStatus(dbus_interface=DIN_WIRELESS))
|
self.nw_res = dedbusmap(self.wireless.GetStatus(dbus_interface=DIN_WIRELESS))
|
||||||
|
@ -142,7 +139,7 @@ class dialer_main(edje_group):
|
||||||
self.part_text_set("numberdisplay_text", "calling ...")
|
self.part_text_set("numberdisplay_text", "calling ...")
|
||||||
system('alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore')
|
system('alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore')
|
||||||
name = self.wireless.Initiate(''.join(self.text), dbus_interface=DIN_VOICE_CALL_INITIATOR, timeout=200, )
|
name = self.wireless.Initiate(''.join(self.text), dbus_interface=DIN_VOICE_CALL_INITIATOR, timeout=200, )
|
||||||
sleep(20)
|
time.sleep(20)
|
||||||
call = object_by_url(name)
|
call = object_by_url(name)
|
||||||
call.Hangup(dbus_interface=DIN_CALL)
|
call.Hangup(dbus_interface=DIN_CALL)
|
||||||
|
|
||||||
|
@ -153,7 +150,7 @@ class TestView(object):
|
||||||
|
|
||||||
self.groups = {}
|
self.groups = {}
|
||||||
self.groups[EDJE_GROUP_NAME] = dialer_main(self)
|
self.groups[EDJE_GROUP_NAME] = dialer_main(self)
|
||||||
self.evas_canvas.evas_obj.data[EDJE_GROUP_NAME] = self.groups[EDJE_GROUP_NAME]
|
self.evas_canvas.evas_obj.data[EDJE_GROUP_NAME] = self.groups[EDJE_GROUP_NAME]
|
||||||
self.groups[EDJE_GROUP_NAME].show()
|
self.groups[EDJE_GROUP_NAME].show()
|
||||||
self.groups[EDJE_GROUP_NAME].part_text_set("numberdisplay_text", "wait ...")
|
self.groups[EDJE_GROUP_NAME].part_text_set("numberdisplay_text", "wait ...")
|
||||||
|
|
||||||
|
@ -167,11 +164,11 @@ class EvasCanvas(object):
|
||||||
else:
|
else:
|
||||||
print "warning: x11-16 is not supported, fallback to x11"
|
print "warning: x11-16 is not supported, fallback to x11"
|
||||||
f = ecore.evas.SoftwareX11
|
f = ecore.evas.SoftwareX11
|
||||||
|
|
||||||
self.evas_obj = f(w=480, h=640)
|
self.evas_obj = f(w=480, h=640)
|
||||||
self.evas_obj.callback_delete_request = self.on_delete_request
|
self.evas_obj.callback_delete_request = self.on_delete_request
|
||||||
self.evas_obj.callback_resize = self.on_resize
|
self.evas_obj.callback_resize = self.on_resize
|
||||||
|
|
||||||
self.evas_obj.title = TITLE
|
self.evas_obj.title = TITLE
|
||||||
self.evas_obj.name_class = WM_INFO
|
self.evas_obj.name_class = WM_INFO
|
||||||
self.evas_obj.fullscreen = fullscreen
|
self.evas_obj.fullscreen = fullscreen
|
||||||
|
@ -191,7 +188,7 @@ if __name__ == "__main__":
|
||||||
TestView()
|
TestView()
|
||||||
ecore.main_loop_begin()
|
ecore.main_loop_begin()
|
||||||
|
|
||||||
'''
|
'''
|
||||||
export LDFLAGS="$LDFLAGS -L/opt/e17/lib"
|
export LDFLAGS="$LDFLAGS -L/opt/e17/lib"
|
||||||
export PKG_CONFIG_PATH="/opt/e17/lib/pkgconfig:$PKG_CONFIG_PATH"
|
export PKG_CONFIG_PATH="/opt/e17/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||||
export PATH="$PATH:/opt/e17/bin"
|
export PATH="$PATH:/opt/e17/bin"
|
||||||
|
|
Loading…
Reference in a new issue