- Timestamp:
- Sep 20, 2017 7:26:56 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:
- 92df9cbd
- Parents:
- 5a405bd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasview/sasview.py
r60a7820 r1693141 21 21 sys.setdefaultencoding("iso-8859-1") 22 22 23 APP_NAME = 'SasView' 23 24 PLUGIN_MODEL_DIR = 'plugin_models' 24 APP_NAME = 'SasView' 25 26 # Set SAS_MODELPATH so sasmodels can find our custom models 27 os.environ['SAS_MODELPATH'] = os.path.join(sasdir, PLUGIN_MODEL_DIR) 28 29 class SasView(): 25 26 class SasView(object): 30 27 """ 31 28 Main class for running the SasView application … … 163 160 164 161 165 def setup_mpl( ):162 def setup_mpl(backend='WXAgg'): 166 163 import sas.sasgui 167 164 # Always use private .matplotlib setup to avoid conflicts with other … … 174 171 # we are running may not actually need it; also, putting as little on the 175 172 # path as we can 176 os.environ['MPLBACKEND'] = 'WXAgg' 177 173 os.environ['MPLBACKEND'] = backend 174 175 # TODO: ... so much for not importing matplotlib unless we need it... 178 176 from matplotlib import backend_bases 179 177 backend_bases.FigureCanvasBase.filetypes.pop('pgf', None) 180 178 179 def setup_sasmodels(): 180 """ 181 Prepare sasmodels for running within sasview. 182 """ 183 import sas.sasgui 184 # Set SAS_MODELPATH so sasmodels can find our custom models 185 plugin_dir = os.path.join(sas.sasgui.get_user_dir(), PLUGIN_MODEL_DIR) 186 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. 181 190 182 191 def run_gui(): … … 187 196 freeze_support() 188 197 setup_logging() 198 setup_mpl() 199 setup_sasmodels() 189 200 setup_wx() 190 setup_mpl()191 201 SasView() 192 202 193 203 194 204 def run_cli(): 205 from multiprocessing import freeze_support 206 freeze_support() 195 207 setup_logging() 196 setup_mpl() 208 setup_mpl(backend='Agg') 209 setup_sasmodels() 197 210 if len(sys.argv) == 1: 198 211 # Run sasview as an interactive python interpreter
Note: See TracChangeset
for help on using the changeset viewer.