def update_wpcfg(new_position, config_dir=r'D:\measuring\user\config'): if not (os.path.isfile(os.path.join(config_dir, 'wp_position.cfg'))): wpcfg = config.create_config( os.path.join(config_dir, 'wp_position.cfg')) print 'wp_position.cfg created in ' + config_dir else: wpcfg = config.Config(os.path.join(config_dir, 'wp_position.cfg')) print 'wp_position.cfg opened from ' + config_dir try: cur_pos = wpcfg.get_all()['current_position'] except KeyError: cur_pos = wpcfg.set('current_position', 'out') print '\tcurrent_position not a key, set to default value...' if new_position == 'in' or new_position == 'out': wpcfg.set("current_position", new_position) new_pos = wpcfg.get_all()['current_position'] if cur_pos != new_pos: print '\tPosition changed to ' + new_pos else: print '\tPosition not changed' else: print 'new_position input not understood, try in or out' #log the time wpcfg.set("Last update", time.ctime()) return wpcfg
def update_wpcfg(new_position, config_dir = r'D:\measuring\user\config'): if not(os.path.isfile(os.path.join(config_dir,'wp_position.cfg'))): wpcfg = config.create_config( os.path.join(config_dir, 'wp_position.cfg')) print 'wp_position.cfg created in '+config_dir else: wpcfg = config.Config(os.path.join(config_dir, 'wp_position.cfg')) print 'wp_position.cfg opened from '+config_dir try: cur_pos = wpcfg.get_all()['current_position'] except KeyError: cur_pos = wpcfg.set('current_position', 'out') print '\tcurrent_position not a key, set to default value...' if new_position == 'in' or new_position == 'out': wpcfg.set("current_position", new_position) new_pos = wpcfg.get_all()['current_position'] if cur_pos != new_pos: print '\tPosition changed to '+new_pos else: print '\tPosition not changed' else: print 'new_position input not understood, try in or out' #log the time wpcfg.set("Last update", time.ctime()) return wpcfg
def process_args(): args, pargs = parser.parse_args() if args.config is None: args.config = os.path.split(sys.argv[0])[-1] if args.config.endswith('.py'): args.config = args.config[:-3] if args.module: args.config += '_' + args.module + '.cfg' if args.config: import lib.config as cfg global config config = cfg.create_config(args.config) if args.name: config['instance_name'] = args.name if args.debug: logging.getLogger().setLevel(logging.DEBUG) return args, pargs
def process_args(): args, pargs = parser.parse_args() if args.config is None: args.config = os.path.split(sys.argv[0])[-1] if args.config.endswith(".py"): args.config = args.config[:-3] if args.module: args.config += "_" + args.module + ".cfg" if args.config: import lib.config as cfg global config config = cfg.create_config(args.config) if args.name: config["instance_name"] = args.name if args.debug: logging.getLogger().setLevel(logging.DEBUG) return args, pargs
# QTLab gui client import logging l = logging.getLogger() l.setLevel(logging.WARNING) import os import sys import time import optparse adddir = os.path.join(os.getcwd(), 'source') sys.path.insert(0,adddir) from lib import config config = config.create_config('qtlabgui.cfg') from lib.network import object_sharer as objsh from lib.misc import get_traceback TB = get_traceback()() def setup_windows(): from windows import main_window main_window.Window() winpath = os.path.join(config['execdir'], 'source/gui/windows') for fn in os.listdir(winpath): if not fn.endswith('_window.py') or fn == 'main_window.py': continue dir, fn = os.path.split(fn)
# QTLab gui client import logging l = logging.getLogger() l.setLevel(logging.WARNING) import os import sys import time import optparse adddir = os.path.join(os.getcwd(), 'source') sys.path.insert(0, adddir) from lib import config config = config.create_config('qtlabgui.cfg') from lib.network import object_sharer as objsh from lib.misc import get_traceback TB = get_traceback()() def setup_windows(): from windows import main_window main_window.Window() winpath = os.path.join(config['execdir'], 'source/gui/windows') for fn in os.listdir(winpath): if not fn.endswith('_window.py') or fn == 'main_window.py': continue
import logging l = logging.getLogger() l.setLevel(logging.WARNING) # make sure the userconfig is loaded import os, sys adddir = os.path.join(os.getcwd(), 'source') sys.path.append(adddir) sys.path.append(os.path.join(os.getcwd(), '..\\qtlab\\source\\')) sys.path.append(os.path.join(os.getcwd(), '..\\qtlab\\source\\lib')) sys.path.append(os.path.join(os.getcwd(), '..\\qtlab\\source\\lib\\gui')) sys.path.append(os.getcwd() + '\\modules') sys.path.insert(1,'c:\qtlab\source') from lib.config import create_config config = create_config('qtlabanalysis.cfg') ### some useful things that might get imported by other scripts CONFIG_FILE = os.path.join(os.getcwd(), 'userconfig.py') # load user config if os.path.exists(CONFIG_FILE): execfile(CONFIG_FILE) # we need this for ETS to work properly with pyqt import sip sip.setapi('QString', 2) sip.setapi('QVariant', 2) from PyQt4 import QtGui, QtCore import time
l.setLevel(logging.WARNING) # make sure the userconfig is loaded import os, sys adddir = os.path.join(os.getcwd(), 'source') sys.path.append(adddir) sys.path.append(os.path.join(os.getcwd(), '..\\qtlab\\source\\')) sys.path.append(os.path.join(os.getcwd(), '..\\qtlab\\source\\lib')) sys.path.append(os.path.join(os.getcwd(), '..\\qtlab\\source\\lib\\gui')) sys.path.append(os.getcwd() + '\\modules') sys.path.insert(1, 'c:\qtlab\source') from lib.config import create_config config = create_config('qtlabanalysis.cfg') ### some useful things that might get imported by other scripts CONFIG_FILE = os.path.join(os.getcwd(), 'userconfig.py') # load user config if os.path.exists(CONFIG_FILE): execfile(CONFIG_FILE) # we need this for ETS to work properly with pyqt import sip sip.setapi('QString', 2) sip.setapi('QVariant', 2) from PyQt4 import QtGui, QtCore