Changeset c6bdb3b in sasview for src/sas/sasgui/guiframe
- Timestamp:
- May 2, 2017 10:03:50 PM (8 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:
- a67ec83
- Parents:
- 7c105e8
- Location:
- src/sas/sasgui/guiframe
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/config.py
r914ba0a rc6bdb3b 1 1 """ 2 2 Application settings 3 3 """ 4 4 from __future__ import print_function … … 6 6 import time 7 7 import os 8 import logging 9 8 10 from sas.sasgui.guiframe.gui_style import GUIFRAME 9 11 import sas.sasview 10 import logging11 12 12 13 13 logger = logging.getLogger(__name__) … … 75 75 _ansto_logo = os.path.join(icon_path, "ansto_logo.png") 76 76 _tudelft_logo = os.path.join(icon_path, "tudelft_logo.png") 77 _dls_logo = os.path.join(icon_path, "dls_logo.png") 77 78 _nsf_logo = os.path.join(icon_path, "nsf_logo.png") 78 79 _danse_logo = os.path.join(icon_path, "danse_logo.png") -
src/sas/sasgui/guiframe/customdir.py
r914ba0a rc6bdb3b 1 1 # Setup and find Custom config dir 2 from __future__ import print_function 3 2 4 import os.path 3 5 import logging 4 6 import shutil 5 import imp6 7 7 from sas.sasgui import get_custom_config_path 8 from sasmodels.custom import load_module_from_path 9 10 from sas.sasgui import get_custom_config_path, get_app_dir 8 11 9 12 logger = logging.getLogger(__name__) … … 22 25 def _setup_custom_config(): 23 26 path = get_custom_config_path() 24 try:25 if not os.path.isfile(path):27 if not os.path.isfile(path): 28 try: 26 29 # if the custom config file does not exist, copy the default from 27 30 # the app dir 28 31 shutil.copyfile(os.path.join(get_app_dir(), "custom_config.py"), 29 32 path) 30 #Adding SAS_OPENCL if it doesn't exist in the config file 31 # - to support backcompability 32 if not "SAS_OPENCL" in open(path).read(): 33 except Exception: 34 logger.error("Could not copy default custom config.") 35 36 #Adding SAS_OPENCL if it doesn't exist in the config file 37 # - to support backcompability 38 if not "SAS_OPENCL" in open(path).read(): 39 try: 33 40 open(config_file, "a+").write("SAS_OPENCL = \"None\"\n") 34 except Exception: 35 #import traceback; logging.error(traceback.format_exc()) 36 logger.error("Could not copy default custom config.") 41 except Exception: 42 logger.error("Could not update custom config with SAS_OPENCL.") 37 43 38 44 custom_config = _load_config(path) 39 45 return custom_config 40 46 47 41 48 def _load_config(path): 42 49 if os.path.exists(path): 43 50 try: 44 fObj = None 45 fObj, config_path, descr = imp.find_module('custom_config', [os.path.dirname(path)]) 46 custom_config = imp.load_module('custom_config', fObj, config_path, descr) 47 logger.info("GuiManager loaded %s" % config_path) 48 return custom_config 49 except Exception: 50 logger.error("Error loading %s: %s" % (path, sys.exc_value)) 51 finally: 52 if fObj is not None: 53 fObj.close() 51 module = load_module_from_path('sas.sasview.custom_config', path) 52 logger.info("GuiManager loaded %s", path) 53 return module 54 except Exception as exc: 55 logger.error("Error loading %s: %s", path, exc) 56 54 57 from sas.sasview import custom_config 55 logg ing.info("GuiManager custom_config defaults to sas.sasview.custom_config")58 logger.info("GuiManager custom_config defaults to sas.sasview.custom_config") 56 59 return custom_config -
src/sas/sasgui/guiframe/data_panel.py
ra1b8fee rc6bdb3b 33 33 from sas.sasgui.guiframe.local_perspectives.plotting.SimplePlot \ 34 34 import PlotFrame as QucikPlotDialog 35 import sas.sasgui.guiframe.config as config 35 from sas.sasgui import get_local_config 36 37 config = get_local_config() 36 38 37 39 # Check version
Note: See TracChangeset
for help on using the changeset viewer.