From e213f9e8d2dacab6beffe97104fa70926e273704 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 17 Dec 2009 15:35:25 -0500 Subject: [PATCH] Added config_dir to libhooke.HookeConfig to match new dir structure --- hooke/libhooke.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 -- 2.26.2