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

12
gfceu
View File

@ -543,16 +543,20 @@ class WidgetsWrapper:
if os.path.isfile('gfceu.glade'):
glade_file = 'gfceu.glade'
# 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')):
glade_file = 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.argv[0]), '../share/gfceu/gfceu.glade')
else:
print 'ERROR.'
print 'Could not find the glade interface file.'
print 'Try reinstalling the application.'
sys.exit(1)
self.widgets = gtk.glade.XML(glade_file)
self.widgets.signal_autoconnect(GladeHandlers.__dict__)
try:
print "Using: " + glade_file
self.widgets = gtk.glade.XML(glade_file)
self.widgets.signal_autoconnect(GladeHandlers.__dict__)
except:
gfceu_error("Couldn't load the glade UI file", 24)
def __getitem__(self, key):
return self.widgets.get_widget(key)