Changes in / [cb9640f:33d3a74] in sasview
- Location:
- src/sas
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/_config.py
r93b34cc rb963b20 86 86 def setup_custom_config(app_dir, user_dir): 87 87 path = make_custom_config_path(user_dir) 88 #logger.info("custom config path %s", path)89 88 if not os.path.isfile(path): 90 89 try: … … 95 94 logger.error("Could not copy default custom config.") 96 95 97 custom_config = load_custom_config(path)98 99 96 #Adding SAS_OPENCL if it doesn't exist in the config file 100 97 # - to support backcompability 101 if not hasattr(custom_config, "SAS_OPENCL"): 102 custom_config.SAS_OPENCL = None 98 if not "SAS_OPENCL" in open(path).read(): 103 99 try: 104 open( path, "a+").write("SAS_OPENCL = \"None\"\n")100 open(config_file, "a+").write("SAS_OPENCL = \"None\"\n") 105 101 except Exception: 106 102 logger.error("Could not update custom config with SAS_OPENCL.") 107 103 104 custom_config = load_custom_config(path) 108 105 return custom_config 106 109 107 110 108 def load_custom_config(path): -
src/sas/sasgui/guiframe/gui_manager.py
r47be5a1 r8ac05a5 62 62 SPLASH_SCREEN_HEIGHT = config.SPLASH_SCREEN_HEIGHT 63 63 SS_MAX_DISPLAY_TIME = config.SS_MAX_DISPLAY_TIME 64 65 def custom_value(name, default=None): 66 """ 67 Fetch a config value from custom_config. Fallback to config, and then 68 to default if it doesn't exist in config. 69 """ 70 default = getattr(config, name, default) 71 return getattr(custom_config, name, default) 72 73 # Custom config values in the order they appear. 74 DATAPANEL_WIDTH = custom_value('DATAPANEL_WIDTH', -1) 75 CLEANUP_PLOT = custom_value('CLEANUP_PLOT', False) 76 FIXED_PANEL = custom_value('FIXED_PANEL', True) 77 PLOPANEL_WIDTH = custom_value('PLOPANEL_WIDTH', -1) 78 DATALOADER_SHOW = custom_value('DATALOADER_SHOW', True) 79 GUIFRAME_HEIGHT = custom_value('GUIFRAME_HEIGHT', -1) 80 GUIFRAME_WIDTH = custom_value('GUIFRAME_WIDTH', -1) 81 CONTROL_WIDTH = custom_value('CONTROL_WIDTH', -1) 82 CONTROL_HEIGHT = custom_value('CONTROL_HEIGHT', -1) 83 open_folder = custom_value('DEFAULT_OPEN_FOLDER', None) 84 if open_folder is not None and os.path.isdir(open_folder): 85 DEFAULT_OPEN_FOLDER = os.path.abspath(open_folder) 64 if not WELCOME_PANEL_ON: 65 WELCOME_PANEL_SHOW = False 86 66 else: 67 WELCOME_PANEL_SHOW = True 68 try: 69 DATALOADER_SHOW = custom_config.DATALOADER_SHOW 70 TOOLBAR_SHOW = custom_config.TOOLBAR_SHOW 71 FIXED_PANEL = custom_config.FIXED_PANEL 72 if WELCOME_PANEL_ON: 73 WELCOME_PANEL_SHOW = custom_config.WELCOME_PANEL_SHOW 74 PLOPANEL_WIDTH = custom_config.PLOPANEL_WIDTH 75 DATAPANEL_WIDTH = custom_config.DATAPANEL_WIDTH 76 GUIFRAME_WIDTH = custom_config.GUIFRAME_WIDTH 77 GUIFRAME_HEIGHT = custom_config.GUIFRAME_HEIGHT 78 CONTROL_WIDTH = custom_config.CONTROL_WIDTH 79 CONTROL_HEIGHT = custom_config.CONTROL_HEIGHT 80 DEFAULT_PERSPECTIVE = custom_config.DEFAULT_PERSPECTIVE 81 CLEANUP_PLOT = custom_config.CLEANUP_PLOT 82 # custom open_path 83 open_folder = custom_config.DEFAULT_OPEN_FOLDER 84 if open_folder is not None and os.path.isdir(open_folder): 85 DEFAULT_OPEN_FOLDER = os.path.abspath(open_folder) 86 else: 87 DEFAULT_OPEN_FOLDER = get_app_dir() 88 SAS_OPENCL = custom_config.SAS_OPENCL 89 except: 90 DATALOADER_SHOW = True 91 TOOLBAR_SHOW = True 92 FIXED_PANEL = True 93 WELCOME_PANEL_SHOW = False 94 PLOPANEL_WIDTH = config.PLOPANEL_WIDTH 95 DATAPANEL_WIDTH = config.DATAPANEL_WIDTH 96 GUIFRAME_WIDTH = config.GUIFRAME_WIDTH 97 GUIFRAME_HEIGHT = config.GUIFRAME_HEIGHT 98 CONTROL_WIDTH = -1 99 CONTROL_HEIGHT = -1 100 DEFAULT_PERSPECTIVE = None 101 CLEANUP_PLOT = False 87 102 DEFAULT_OPEN_FOLDER = get_app_dir() 88 WELCOME_PANEL_SHOW = (custom_value('WELCOME_PANEL_SHOW', False) 89 if WELCOME_PANEL_ON else False) 90 TOOLBAR_SHOW = custom_value('TOOLBAR_SHOW', True) 91 DEFAULT_PERSPECTIVE = custom_value('DEFAULT_PERSPECTIVE', 'Fitting') 92 SAS_OPENCL = custom_value('SAS_OPENCL', 'None') 93 103 DEFAULT_OPEN_FOLDER = PATH_APP 104 SAS_OPENCL = None 94 105 DEFAULT_STYLE = config.DEFAULT_STYLE 106 95 107 PLUGIN_STATE_EXTENSIONS = config.PLUGIN_STATE_EXTENSIONS 96 108 OPEN_SAVE_MENU = config.OPEN_SAVE_PROJECT_MENU … … 2158 2170 # original 2.x tutorial. 2159 2171 # Code below, implemented from 4.2.0, redirects 2160 # action to the Tutorials page of the help 2172 # action to the Tutorials page of the help 2161 2173 # documentation to give access to all available 2162 2174 # tutorials
Note: See TracChangeset
for help on using the changeset viewer.