Changeset 1511 for branch


Ignore:
Timestamp:
Oct 1, 2014 7:12:29 PM (7 years ago)
Author:
toby
Message:

add config file support

Location:
branch/logging
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branch/logging/GSASIIlog.py

    r1510 r1511  
    1313import wx
    1414import GSASIIgrid as G2gd
     15import GSASIIpath
     16# Global variables
    1517MenuBindingLookup = {}
    1618'Lookup table for Menu buttons'
     
    2022'Contains a list of logged actions; first item is ignored'
    2123LogInfo = {'Logging':False, 'Tree':None, 'LastPaintAction':None}
    22 'Contains a dict with values that are needed in the module'
     24'Contains values that are needed in the module for past actions & object location'
    2325
    2426# TODO:
     
    3436#   and then a LogCall('unique-string',pargs,kwargs) call inside the routine
    3537
    36 debug = True
     38debug = GSASIIpath.GetConfigValue('logging_debug')
    3739#===========================================================================
    3840# objects for logging variables
     
    541543    return
    542544
    543 LogOn() # for debug
     545if debug: LogOn() # for debug, start with logging enabled
  • branch/logging/GSASIIpath.py

    r1413 r1511  
    6060if newpath not in sys.path: sys.path.append(newpath)
    6161
     62# setup read of config.py, if present
     63try:
     64    import config
     65    configDict = config.__dict__
     66    import inspect
     67    vals = [True for i in inspect.getmembers(config) if '__' not in i[0]]
     68    print str(len(vals))+' values read from config file '+os.path.abspath(config.__file__)
     69except ImportError:
     70    configDict = {}
     71   
     72def GetConfigValue(key):
     73    'Return the configuration file value for key or None if not present'
     74    return configDict.get(key)
     75
    6276# routines for looking a version numbers in files
    6377version = -1
Note: See TracChangeset for help on using the changeset viewer.