From: W. Trevor King Date: Thu, 17 Dec 2009 20:35:25 +0000 (-0500) Subject: Added config_dir to libhooke.HookeConfig to match new dir structure X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e213f9e8d2dacab6beffe97104fa70926e273704;p=hooke.git Added config_dir to libhooke.HookeConfig to match new dir structure --- diff --git a/hooke/libhooke.py b/hooke/libhooke.py index 247df8b..73534f2 100755 --- a/hooke/libhooke.py +++ b/hooke/libhooke.py @@ -13,12 +13,10 @@ This program is released under the GNU General Public License version 2. import libhookecurve as lhc import scipy -import scipy.signal -import scipy.optimize -import scipy.stats import numpy import xml.dom.minidom import os +import os.path import string import csv @@ -142,14 +140,20 @@ class HookeConfig(object): FIXME: starting to look a mess, should require refactoring ''' - def __init__(self): + def __init__(self, config_dir=None): self.config={} self.config['plugins']=[] self.config['drivers']=[] self.config['plotmanips']=[] + self.config_dir = config_dir + if self.config_dir == None: + self.config_dir = os.path.abspath( + os.path.join(os.path.dirname(os.path.dirname(__file__)), + 'conf')) def load_config(self, filename): - myconfig=file(filename) + print 'loading config file', os.path.join(self.config_dir, filename) + myconfig=file(os.path.join(self.config_dir, filename)) #the following 3 lines are needed to strip newlines. otherwise, since newlines #are XML elements too, the parser would read them (and re-save them, multiplying