Remove code that checks for the edje theme file since the execution order is non-linear
Introduce the EDJE_FILE_NAME global constant to avoid having magic strings all over the place Add a check for the edje theme file in edje_group.__init__() On error, raise an IOError with message string, not a raw string exception as in the initial code git-svn-id: http://www.neo1973-germany.de/svn@97 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
parent
8a22c63d1e
commit
3b5fd004fa
1 changed files with 6 additions and 11 deletions
|
@ -11,6 +11,7 @@ FULLSCREEN = True
|
||||||
TITLE = "epydial"
|
TITLE = "epydial"
|
||||||
WM_INFO = ("epydial", "epydial")
|
WM_INFO = ("epydial", "epydial")
|
||||||
EDJE_GROUP_NAME = "pyneo/dialer/main"
|
EDJE_GROUP_NAME = "pyneo/dialer/main"
|
||||||
|
EDJE_FILE_NAME = "data/themes/dialer.edj"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -34,21 +35,15 @@ from time import sleep
|
||||||
|
|
||||||
#import sqlite3
|
#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):
|
class edje_group(edje.Edje):
|
||||||
def __init__(self, main, group):
|
def __init__(self, main, group):
|
||||||
self.main = main
|
self.main = main
|
||||||
global edjepath
|
|
||||||
f = edjepath
|
if not os.path.exists(EDJE_FILE_NAME):
|
||||||
|
raise IOError("Edje theme file not found: " + EDJE_FILE_NAME)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
edje.Edje.__init__(self, self.main.evas_canvas.evas_obj.evas, file=f, 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
|
self.size = self.main.evas_canvas.evas_obj.evas.size
|
||||||
|
|
Loading…
Reference in a new issue