From 3b5fd004fa1dfef8c47ac94b981c0785af742cd3 Mon Sep 17 00:00:00 2001 From: Abraxa Date: Thu, 28 Aug 2008 21:29:33 +0000 Subject: [PATCH] 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 --- epydial/epydial.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/epydial/epydial.py b/epydial/epydial.py index 0d4048b..a272693 100755 --- a/epydial/epydial.py +++ b/epydial/epydial.py @@ -11,6 +11,7 @@ FULLSCREEN = True TITLE = "epydial" WM_INFO = ("epydial", "epydial") EDJE_GROUP_NAME = "pyneo/dialer/main" +EDJE_FILE_NAME = "data/themes/dialer.edj" import os import sys @@ -34,21 +35,15 @@ from time import sleep #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 + + if not os.path.exists(EDJE_FILE_NAME): + raise IOError("Edje theme file not found: " + EDJE_FILE_NAME) + 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: raise SystemExit("error loading %s: %s" % (f, e)) self.size = self.main.evas_canvas.evas_obj.evas.size