Changeset 0315b63 in sasview for src/sas/sasview
- Timestamp:
- Sep 25, 2017 3:24:46 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:
- 24d9e84, fca1f50
- Parents:
- b277220 (diff), 66000ae (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. - Location:
- src/sas/sasview
- Files:
-
- 3 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasview/local_config.py
r724af06 rb963b20 145 145 UPDATE_TIMEOUT = 2 146 146 147 #OpenCL option148 SAS_OPENCL = None149 150 147 # Time out for updating sasview 151 148 UPDATE_TIMEOUT = 2 -
src/sas/sasview/sasview.py
r1693141 rb277220 21 21 sys.setdefaultencoding("iso-8859-1") 22 22 23 import sas 24 23 25 APP_NAME = 'SasView' 24 26 PLUGIN_MODEL_DIR = 'plugin_models' … … 43 45 # modules. We load the fitting module here 44 46 # to ensure a complete Windows executable build. 47 48 # Rebuild .sasview/categories.json. This triggers a load of sasmodels 49 # and all the plugins. 50 try: 51 from sas.sascalc.fit.models import ModelManager 52 from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 53 model_list = ModelManager().cat_model_list() 54 CategoryInstaller.check_install(model_list=model_list) 55 except Exception: 56 logger.error("%s: could not load SasView models") 57 logger.error(traceback.format_exc()) 45 58 46 59 # Fitting perspective … … 160 173 161 174 162 def setup_mpl(backend='WXAgg'): 163 import sas.sasgui 175 def setup_mpl(backend=None): 164 176 # Always use private .matplotlib setup to avoid conflicts with other 165 mplconfigdir = os.path.join(sas. sasgui.get_user_dir(), '.matplotlib')177 mplconfigdir = os.path.join(sas.get_user_dir(), '.matplotlib') 166 178 if not os.path.exists(mplconfigdir): 167 179 os.mkdir(mplconfigdir) … … 171 183 # we are running may not actually need it; also, putting as little on the 172 184 # path as we can 173 os.environ['MPLBACKEND'] = backend 185 if backend: 186 os.environ['MPLBACKEND'] = backend 174 187 175 188 # TODO: ... so much for not importing matplotlib unless we need it... … … 181 194 Prepare sasmodels for running within sasview. 182 195 """ 183 import sas.sasgui184 196 # Set SAS_MODELPATH so sasmodels can find our custom models 185 plugin_dir = os.path.join(sas. sasgui.get_user_dir(), PLUGIN_MODEL_DIR)197 plugin_dir = os.path.join(sas.get_user_dir(), PLUGIN_MODEL_DIR) 186 198 os.environ['SAS_MODELPATH'] = plugin_dir 187 # TODO: SAS_OPENCL flag belongs in setup_sasmodels 188 # this will require restructuring of the config management so that it 189 # can occur outside of sasgui. 199 #Initiliaze enviromental variable with custom setting but only if variable not set 200 SAS_OPENCL = sas.get_custom_config().SAS_OPENCL 201 if SAS_OPENCL and "SAS_OPENCL" not in os.environ: 202 os.environ["SAS_OPENCL"] = SAS_OPENCL 190 203 191 204 def run_gui(): … … 196 209 freeze_support() 197 210 setup_logging() 198 setup_mpl( )211 setup_mpl(backend='WXAgg') 199 212 setup_sasmodels() 200 213 setup_wx() … … 206 219 freeze_support() 207 220 setup_logging() 208 setup_mpl(backend='Agg') 221 # Use default matplotlib backend on mac/linux, but wx on windows. 222 # The problem on mac is that the wx backend requires pythonw. On windows 223 # we are sure to wx since it is the shipped with the app. 224 setup_mpl(backend='WXAgg' if os.name == 'nt' else None) 209 225 setup_sasmodels() 210 226 if len(sys.argv) == 1: -
src/sas/sasview/welcome_panel.py
rd66dbcc rb963b20 10 10 from wx.lib.scrolledpanel import ScrolledPanel 11 11 12 from sas .sasguiimport get_local_config12 from sas import get_local_config 13 13 from sas.sasgui.guiframe.panel_base import PanelBase 14 14 config = get_local_config()
Note: See TracChangeset
for help on using the changeset viewer.