Figure out where we're installed and load things from there.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@665 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2002-03-17 10:13:36 +00:00
parent c55d5cba95
commit 92a7a39328
+16 -6
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
# $Id: lookuplet,v 1.1 2002/03/17 09:32:23 mdb Exp $ # $Id: lookuplet,v 1.2 2002/03/17 10:13:36 mdb Exp $
# #
# lookuplet - a utility for quickly looking up information # lookuplet - a utility for quickly looking up information
# Copyright (C) 2001 Michael Bayne # Copyright (C) 2001 Michael Bayne
@@ -25,18 +25,28 @@ import libglade
import string import string
import sys import sys
import re import re
import os
import bindings
import lookuplet
import properties
# figure out where we were run from # figure out where we were run from
basedir = sys.argv[0]; basedir = sys.argv[0];
basedir = re.sub("/lookuplet$", "", basedir); basedir = re.sub("/lookuplet$", "", basedir);
basedir = re.sub("/bin$", "", basedir); basedir = re.sub("/bin$", "", basedir);
libdir = basedir + "/share/lookuplet";
# add our library directory to the system path
sys.path.append(libdir);
import bindings
import lookuplet
import properties
# load up our glade UI definition # load up our glade UI definition
xmlui = libglade.GladeXML("lookuplet.glade"); try:
os.stat(basedir + "/lookuplet.glade");
xmlui = libglade.GladeXML(basedir + "/lookuplet.glade");
except OSError:
os.stat(libdir + "/lookuplet.glade");
xmlui = libglade.GladeXML(libdir + "/lookuplet.glade");
# load up our bindings # load up our bindings
bindings = bindings.BindingSet(); bindings = bindings.BindingSet();