Changeset b963b20 in sasview for src/sas/sasview


Ignore:
Timestamp:
Sep 24, 2017 11:29:13 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:
b277220, fca1f50
Parents:
d3b0c77
Message:

pull config out of sas.sasgui so it can be used without reference to wx

Location:
src/sas/sasview
Files:
3 edited

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

    rd3b0c77 rb963b20  
    2020reload(sys) 
    2121sys.setdefaultencoding("iso-8859-1") 
     22 
     23import sas 
    2224 
    2325APP_NAME = 'SasView' 
     
    171173 
    172174 
    173 def setup_mpl(backend='WXAgg'): 
    174     import sas.sasgui 
     175def setup_mpl(backend=None): 
    175176    # Always use private .matplotlib setup to avoid conflicts with other 
    176     mplconfigdir = os.path.join(sas.sasgui.get_user_dir(), '.matplotlib') 
     177    mplconfigdir = os.path.join(sas.get_user_dir(), '.matplotlib') 
    177178    if not os.path.exists(mplconfigdir): 
    178179        os.mkdir(mplconfigdir) 
     
    192193    Prepare sasmodels for running within sasview. 
    193194    """ 
    194     import sas.sasgui 
    195195    # Set SAS_MODELPATH so sasmodels can find our custom models 
    196     plugin_dir = os.path.join(sas.sasgui.get_user_dir(), PLUGIN_MODEL_DIR) 
     196    plugin_dir = os.path.join(sas.get_user_dir(), PLUGIN_MODEL_DIR) 
    197197    os.environ['SAS_MODELPATH'] = plugin_dir 
    198     # TODO: SAS_OPENCL flag belongs in setup_sasmodels 
    199     # this will require restructuring of the config management so that it 
    200     # can occur outside of sasgui. 
     198    #Initiliaze enviromental variable with custom setting but only if variable not set 
     199    SAS_OPENCL = sas.get_custom_config().SAS_OPENCL 
     200    if SAS_OPENCL and "SAS_OPENCL" not in os.environ: 
     201        os.environ["SAS_OPENCL"] = SAS_OPENCL 
    201202 
    202203def run_gui(): 
     
    207208    freeze_support() 
    208209    setup_logging() 
    209     setup_mpl() 
     210    setup_mpl(backend='WXAgg') 
    210211    setup_sasmodels() 
    211212    setup_wx() 
     
    217218    freeze_support() 
    218219    setup_logging() 
    219     setup_mpl(backend='Agg') 
     220    # Use default matplotlib backend on mac/linux, but wx on windows. 
     221    # The problem on mac is that the wx backend requires pythonw.  On windows 
     222    # we are sure to wx since it is the shipped with the app. 
     223    setup_mpl(backend='WXAgg' if os.name == 'nt' else None) 
    220224    setup_sasmodels() 
    221225    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.