Fixed some issues with loading the glade file.

Fixed an issue where the glade UI wouldn't load when prefix isn't /usr/
Elegantly closes when the glade file cannot be read
This commit is contained in:
punkrockguy318 2008-06-17 13:59:54 +00:00
parent 3d98cd56a6
commit bb4030d361
1 changed files with 8 additions and 4 deletions

8
gfceu
View File

@ -543,16 +543,20 @@ class WidgetsWrapper:
if os.path.isfile('gfceu.glade'): if os.path.isfile('gfceu.glade'):
glade_file = 'gfceu.glade' glade_file = 'gfceu.glade'
# Then check to see if its installed on a *nix system # Then check to see if its installed on a *nix system
elif os.path.isfile(os.path.join(os.path.dirname(sys.executable), '../share/gfceu/gfceu.glade')): elif os.path.isfile(os.path.join(os.path.dirname(sys.argv[0]), '../share/gfceu/gfceu.glade')):
glade_file = os.path.join(os.path.dirname(sys.executable), '../share/gfceu/gfceu.glade') glade_file = os.path.join(os.path.dirname(sys.argv[0]), '../share/gfceu/gfceu.glade')
else: else:
print 'ERROR.' print 'ERROR.'
print 'Could not find the glade interface file.' print 'Could not find the glade interface file.'
print 'Try reinstalling the application.' print 'Try reinstalling the application.'
sys.exit(1) sys.exit(1)
try:
print "Using: " + glade_file
self.widgets = gtk.glade.XML(glade_file) self.widgets = gtk.glade.XML(glade_file)
self.widgets.signal_autoconnect(GladeHandlers.__dict__) self.widgets.signal_autoconnect(GladeHandlers.__dict__)
except:
gfceu_error("Couldn't load the glade UI file", 24)
def __getitem__(self, key): def __getitem__(self, key):
return self.widgets.get_widget(key) return self.widgets.get_widget(key)