Changeset 0315b63 in sasview for src/sas/sasview


Ignore:
Timestamp:
Sep 25, 2017 3:24:46 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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.
Message:

Merge branch 'ticket-887-reorg' into ticket-853-fit-gui-to-calc

Location:
src/sas/sasview
Files:
3 edited
2 moved

Legend:

Unmodified
Added
Removed
  • src/sas/sasview/local_config.py

    r724af06 rb963b20  
    145145UPDATE_TIMEOUT = 2 
    146146 
    147 #OpenCL option 
    148 SAS_OPENCL = None 
    149  
    150147# Time out for updating sasview 
    151148UPDATE_TIMEOUT = 2 
  • src/sas/sasview/sasview.py

    r1693141 rb277220  
    2121sys.setdefaultencoding("iso-8859-1") 
    2222 
     23import sas 
     24 
    2325APP_NAME = 'SasView' 
    2426PLUGIN_MODEL_DIR = 'plugin_models' 
     
    4345        # modules. We load the fitting module here 
    4446        # 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()) 
    4558 
    4659        # Fitting perspective 
     
    160173 
    161174 
    162 def setup_mpl(backend='WXAgg'): 
    163     import sas.sasgui 
     175def setup_mpl(backend=None): 
    164176    # 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') 
    166178    if not os.path.exists(mplconfigdir): 
    167179        os.mkdir(mplconfigdir) 
     
    171183    # we are running may not actually need it; also, putting as little on the 
    172184    # path as we can 
    173     os.environ['MPLBACKEND'] = backend 
     185    if backend: 
     186        os.environ['MPLBACKEND'] = backend 
    174187 
    175188    # TODO: ... so much for not importing matplotlib unless we need it... 
     
    181194    Prepare sasmodels for running within sasview. 
    182195    """ 
    183     import sas.sasgui 
    184196    # 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) 
    186198    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 
    190203 
    191204def run_gui(): 
     
    196209    freeze_support() 
    197210    setup_logging() 
    198     setup_mpl() 
     211    setup_mpl(backend='WXAgg') 
    199212    setup_sasmodels() 
    200213    setup_wx() 
     
    206219    freeze_support() 
    207220    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) 
    209225    setup_sasmodels() 
    210226    if len(sys.argv) == 1: 
  • src/sas/sasview/welcome_panel.py

    rd66dbcc rb963b20  
    1010from wx.lib.scrolledpanel import ScrolledPanel 
    1111 
    12 from sas.sasgui import get_local_config 
     12from sas import get_local_config 
    1313from sas.sasgui.guiframe.panel_base import PanelBase 
    1414config = get_local_config() 
Note: See TracChangeset for help on using the changeset viewer.