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:
Abraxa 2008-08-28 21:45:58 +00:00
parent 3b5fd004fa
commit 1fc87d074d

View file

@ -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,8 +42,7 @@ 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):
@ -55,6 +51,7 @@ class dialer_main(edje_group):
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):
@ -94,7 +91,7 @@ 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))
@ -104,7 +101,7 @@ class dialer_main(edje_group):
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 ...")