Changeset 914ba0a in sasview for src/sas/sasgui/__init__.py


Ignore:
Timestamp:
May 2, 2017 3:58:01 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
d66dbcc
Parents:
74d9780 (diff), 658dd57 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge with master

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/__init__.py

    r3aa2f3c r914ba0a  
    22import os 
    33from os.path import exists, expanduser, dirname, realpath, join as joinpath 
     4 
    45 
    56def dirn(path, n): 
     
    4546 
    4647 
    47  
    4848def get_app_dir(): 
    4949    if APP_FOLDER is None: 
     
    5555        raise RuntimeError("Need to initialize sas.sasgui.USER_FOLDER") 
    5656    return USER_FOLDER 
     57 
     58def get_custom_config_path(): 
     59    dirname = os.path.join(get_user_dir(), 'config') 
     60    # If the directory doesn't exist, create it 
     61    if not os.path.exists(dirname): 
     62        os.makedirs(dirname) 
     63    path = os.path.join(dirname, "custom_config.py") 
     64    return path 
    5765 
    5866_config_cache = None 
     
    6977    import logging 
    7078 
     79    logger = logging.getLogger(__name__) 
    7180    dirname = get_app_dir() 
    7281    filename = 'local_config.py' 
     
    7786            fObj, config_path, descr = imp.find_module('local_config', [APP_FOLDER]) 
    7887            config = imp.load_module('local_config', fObj, config_path, descr) 
    79             logging.info("GuiManager loaded %s" % config_path) 
     88            logger.info("GuiManager loaded %s" % config_path) 
    8089            return config 
    8190        except Exception: 
    82             import traceback; logging.error(traceback.format_exc()) 
    83             logging.error("Error loading %s: %s" % (path, sys.exc_value)) 
     91            import traceback; logger.error(traceback.format_exc()) 
     92            logger.error("Error loading %s: %s" % (path, sys.exc_value)) 
    8493        finally: 
    8594            if fObj is not None: 
    8695                fObj.close() 
    8796    from sas.sasgui.guiframe import config 
    88     logging.info("GuiManager config defaults to sas.sasgui.guiframe") 
     97    logger.info("GuiManager config defaults to sas.sasgui.guiframe") 
    8998    return config 
     99 
Note: See TracChangeset for help on using the changeset viewer.