Changeset c6bdb3b in sasview
- 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
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
run.py
r7c105e8 rc6bdb3b 1 1 # -*- coding: utf-8 -*- 2 2 #!/usr/bin/env python 3 4 3 """ 5 4 Run sasview in place. This allows sasview to use the python … … 15 14 the given module or script. 16 15 """ 16 from __future__ import print_function 17 17 18 18 import imp -
src/sas/sasgui/__init__.py
r914ba0a rc6bdb3b 47 47 48 48 def get_app_dir(): 49 if APP_FOLDER is None:50 raise RuntimeError("Need to initialize sas.sasgui.USER_FOLDER")51 49 return APP_FOLDER 52 50 53 51 def get_user_dir(): 54 if USER_FOLDER is None:55 raise RuntimeError("Need to initialize sas.sasgui.USER_FOLDER")56 52 return USER_FOLDER 57 53 … … 74 70 import os 75 71 import sys 76 import imp77 72 import logging 73 from sasmodels.custom import load_module_from_path 78 74 79 75 logger = logging.getLogger(__name__) … … 81 77 filename = 'local_config.py' 82 78 path = os.path.join(dirname, filename) 83 if os.path.exists(path): 84 try: 85 fObj = None 86 fObj, config_path, descr = imp.find_module('local_config', [APP_FOLDER]) 87 config = imp.load_module('local_config', fObj, config_path, descr) 88 logger.info("GuiManager loaded %s" % config_path) 89 return config 90 except Exception: 91 import traceback; logger.error(traceback.format_exc()) 92 logger.error("Error loading %s: %s" % (path, sys.exc_value)) 93 finally: 94 if fObj is not None: 95 fObj.close() 96 from sas.sasgui.guiframe import config 97 logger.info("GuiManager config defaults to sas.sasgui.guiframe") 98 return config 99 79 try: 80 module = load_module_from_path('sas.sasgui.local_config', path) 81 logger.info("GuiManager loaded %s", path) 82 return module 83 except Exception as exc: 84 logger.critical("Error loading %s: %s", path, exc) 85 sys.exit() -
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 -
src/sas/sasview/local_config.py
r914ba0a rc6bdb3b 94 94 _corner_image = os.path.join(icon_path, "angles_flat.png") 95 95 _welcome_image = os.path.join(icon_path, "SVwelcome.png") 96 _copyright = "(c) 2009 - 2017, UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft and DLS"96 _copyright = "(c) 2009 - 2017, UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, and DLS" 97 97 marketplace_url = "http://marketplace.sasview.org/" 98 98 … … 148 148 SAS_OPENCL = None 149 149 150 # Time out for updating sasview 151 UPDATE_TIMEOUT = 2 152 150 153 def printEVT(message): 151 154 if __EVT_DEBUG__:
Note: See TracChangeset
for help on using the changeset viewer.