Changeset 914ba0a in sasview for src/sas/sasgui/__init__.py
- Timestamp:
- May 2, 2017 3:58:01 PM (7 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/__init__.py
r3aa2f3c r914ba0a 2 2 import os 3 3 from os.path import exists, expanduser, dirname, realpath, join as joinpath 4 4 5 5 6 def dirn(path, n): … … 45 46 46 47 47 48 48 def get_app_dir(): 49 49 if APP_FOLDER is None: … … 55 55 raise RuntimeError("Need to initialize sas.sasgui.USER_FOLDER") 56 56 return USER_FOLDER 57 58 def 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 57 65 58 66 _config_cache = None … … 69 77 import logging 70 78 79 logger = logging.getLogger(__name__) 71 80 dirname = get_app_dir() 72 81 filename = 'local_config.py' … … 77 86 fObj, config_path, descr = imp.find_module('local_config', [APP_FOLDER]) 78 87 config = imp.load_module('local_config', fObj, config_path, descr) 79 logg ing.info("GuiManager loaded %s" % config_path)88 logger.info("GuiManager loaded %s" % config_path) 80 89 return config 81 90 except Exception: 82 import traceback; logg ing.error(traceback.format_exc())83 logg ing.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)) 84 93 finally: 85 94 if fObj is not None: 86 95 fObj.close() 87 96 from sas.sasgui.guiframe import config 88 logg ing.info("GuiManager config defaults to sas.sasgui.guiframe")97 logger.info("GuiManager config defaults to sas.sasgui.guiframe") 89 98 return config 99
Note: See TracChangeset
for help on using the changeset viewer.