Added config_dir to libhooke.HookeConfig to match new dir structure
authorW. Trevor King <wking@drexel.edu>
Thu, 17 Dec 2009 20:35:25 +0000 (15:35 -0500)
committerW. Trevor King <wking@drexel.edu>
Thu, 17 Dec 2009 20:35:25 +0000 (15:35 -0500)
hooke/libhooke.py

index 247df8b11dcb49ff8e918e708ba412e31ccd304b..73534f2143e7331da5a077a608d0d05b54a848cb 100755 (executable)
@@ -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