diff options
author | jstebbins <[email protected]> | 2009-03-27 15:58:11 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-03-27 15:58:11 +0000 |
commit | 64dfe58a8f49c8de188fed1dddc76ebabdfeb4b4 (patch) | |
tree | 29eda34a85d74e98f26b46f3e14337543e6ca63c /gtk/src/create_resources.py | |
parent | a5eab51e9af0ba1cba513ecd323744958e701c65 (diff) |
LinGui:
- add some error handling to resource parser
- modify how icons are deserialized in ghb since the python resource
parser can't easily serialize the old way
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2278 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/create_resources.py')
-rw-r--r-- | gtk/src/create_resources.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/gtk/src/create_resources.py b/gtk/src/create_resources.py index 1e346fb9b..4fdf20b1d 100644 --- a/gtk/src/create_resources.py +++ b/gtk/src/create_resources.py @@ -36,8 +36,8 @@ def start_element_handler(tag, attr): val = dict() stack.append(val) elif tag == "icon": - fname = attr["file"] - fname = find_file(fname) + fbase = attr["file"] + fname = find_file(fbase) key = attr["name"] if fname != None and key != None: val = dict() @@ -49,15 +49,21 @@ def start_element_handler(tag, attr): val["height"] = pb.get_height() val["rowstride"] = pb.get_rowstride() val["data"] = plistlib.Data(pb.get_pixels()) + elif fname == None: + print >> sys.stderr, ( "Error: No such icon file %s" % fbase ) + sys.exit(1) elif tag == "plist": - fname = attr["file"] - fname = find_file(fname) + fbase = attr["file"] + fname = find_file(fbase) key = attr["name"] if fname != None and key != None: val = plistlib.readPlist(fname) + elif fname == None: + print >> sys.stderr, ( "Error: No such plist file %s" % fbase ) + sys.exit(1) elif tag == "string": - fname = attr["file"] - fname = find_file(fname) + fbase = attr["file"] + fname = find_file(fbase) key = attr["name"] if fname != None and key != None: try: @@ -65,6 +71,10 @@ def start_element_handler(tag, attr): val = ff.read() except Exception, err: print >> sys.stderr, ( "Error: %s" % str(err) ) + sys.exit(1) + elif fname == None: + print >> sys.stderr, ( "Error: No such string file %s" % fbase ) + sys.exit(1) if val != None: if type(current) == types.DictType: @@ -101,7 +111,7 @@ def find_file(name): global inc_list for inc_dir in inc_list: - inc = "%s/%s" % inc_dir, name + inc = "%s/%s" % (inc_dir, name) if os.path.isfile(inc): return inc |