Changeset fef38e8 in sasview for src/sas/qtgui/Utilities/GuiUtils.py
- Timestamp:
- Sep 13, 2017 6:24:34 AM (7 years ago)
- Branches:
- 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
- Children:
- 3c8242c
- Parents:
- 9909967
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Utilities/GuiUtils.py
r38eb433 rfef38e8 18 18 19 19 from periodictable import formula as Formula 20 21 20 from sas.qtgui.Plotting import DataTransform 22 21 from sas.qtgui.Plotting.ConvertUnits import convertUnit 23 24 22 from sas.qtgui.Plotting.PlotterData import Data1D 25 23 from sas.qtgui.Plotting.PlotterData import Data2D 26 27 24 from sas.sascalc.dataloader.loader import Loader 28 25 from sas.qtgui.Utilities import CustomDir 29 26 27 ## TODO: CHANGE FOR SHIPPED PATH IN RELEASE 28 if os.path.splitext(sys.argv[0])[1].lower() != ".py": 29 HELP_DIRECTORY_LOCATION = "doc" 30 else: 31 HELP_DIRECTORY_LOCATION = "docs/sphinx-docs/build/html" 32 IMAGES_DIRECTORY_LOCATION = HELP_DIRECTORY_LOCATION + "/_images" 30 33 31 34 def get_app_dir(): … … 91 94 return config_module 92 95 93 # Get APP folder 94 PATH_APP = get_app_dir() 95 DATAPATH = PATH_APP 96 97 ## TODO: CHANGE FOR SHIPPED PATH IN RELEASE 98 if os.path.splitext(sys.argv[0])[1].lower() != ".py": 99 HELP_DIRECTORY_LOCATION = "doc" 100 else: 101 HELP_DIRECTORY_LOCATION = "docs/sphinx-docs/build/html" 102 IMAGES_DIRECTORY_LOCATION = HELP_DIRECTORY_LOCATION + "/_images" 103 104 # GUI always starts from the App folder 105 #os.chdir(PATH_APP) 106 # Read in the local config, which can either be with the main 107 # application or in the installation directory 108 config = _find_local_config('local_config', PATH_APP) 109 110 if config is None: 111 config = _find_local_config('local_config', os.getcwd()) 112 #if config is None: 113 # # Didn't find local config, load the default 114 # import sas.sasgui.guiframe.config as config 115 # #logging.info("using default local_config") 116 #else: 117 # pass 118 # #logging.info("found local_config in %s", os.getcwd()) 119 else: 120 pass 121 #logging.info("found local_config in %s", PATH_APP) 122 123 c_conf_dir = CustomDir.setup_conf_dir(PATH_APP) 124 125 custom_config = _find_local_config('custom_config', c_conf_dir) 126 if custom_config is None: 127 custom_config = _find_local_config('custom_config', os.getcwd()) 128 if custom_config is None: 129 msgConfig = "Custom_config file was not imported" 130 #logging.info(msgConfig) 96 def _init(): 97 # Get APP folder 98 PATH_APP = get_app_dir() 99 DATAPATH = PATH_APP 100 101 # Read in the local config, which can either be with the main 102 # application or in the installation directory 103 config = _find_local_config('local_config', PATH_APP) 104 105 if config is None: 106 config = _find_local_config('local_config', os.getcwd()) 131 107 else: 132 108 pass 133 #logging.info("using custom_config in %s", os.getcwd()) 134 else: 135 pass 136 #logging.info("using custom_config from %s", c_conf_dir) 137 138 #read some constants from config 139 APPLICATION_STATE_EXTENSION = config.APPLICATION_STATE_EXTENSION 140 APPLICATION_NAME = config.__appname__ 141 SPLASH_SCREEN_PATH = config.SPLASH_SCREEN_PATH 142 WELCOME_PANEL_ON = config.WELCOME_PANEL_ON 143 SPLASH_SCREEN_WIDTH = config.SPLASH_SCREEN_WIDTH 144 SPLASH_SCREEN_HEIGHT = config.SPLASH_SCREEN_HEIGHT 145 SS_MAX_DISPLAY_TIME = config.SS_MAX_DISPLAY_TIME 146 if not WELCOME_PANEL_ON: 147 WELCOME_PANEL_SHOW = False 148 else: 149 WELCOME_PANEL_SHOW = True 150 try: 151 DATALOADER_SHOW = custom_config.DATALOADER_SHOW 152 TOOLBAR_SHOW = custom_config.TOOLBAR_SHOW 153 FIXED_PANEL = custom_config.FIXED_PANEL 154 if WELCOME_PANEL_ON: 155 WELCOME_PANEL_SHOW = custom_config.WELCOME_PANEL_SHOW 156 PLOPANEL_WIDTH = custom_config.PLOPANEL_WIDTH 157 DATAPANEL_WIDTH = custom_config.DATAPANEL_WIDTH 158 GUIFRAME_WIDTH = custom_config.GUIFRAME_WIDTH 159 GUIFRAME_HEIGHT = custom_config.GUIFRAME_HEIGHT 160 CONTROL_WIDTH = custom_config.CONTROL_WIDTH 161 CONTROL_HEIGHT = custom_config.CONTROL_HEIGHT 162 DEFAULT_PERSPECTIVE = custom_config.DEFAULT_PERSPECTIVE 163 CLEANUP_PLOT = custom_config.CLEANUP_PLOT 164 # custom open_path 165 open_folder = custom_config.DEFAULT_OPEN_FOLDER 166 if open_folder != None and os.path.isdir(open_folder): 167 DEFAULT_OPEN_FOLDER = os.path.abspath(open_folder) 109 110 c_conf_dir = CustomDir.setup_conf_dir(PATH_APP) 111 112 custom_config = _find_local_config('custom_config', c_conf_dir) 113 if custom_config is None: 114 custom_config = _find_local_config('custom_config', os.getcwd()) 115 if custom_config is None: 116 msgConfig = "Custom_config file was not imported" 117 118 #read some constants from config 119 APPLICATION_STATE_EXTENSION = config.APPLICATION_STATE_EXTENSION 120 APPLICATION_NAME = config.__appname__ 121 SPLASH_SCREEN_PATH = config.SPLASH_SCREEN_PATH 122 WELCOME_PANEL_ON = config.WELCOME_PANEL_ON 123 SPLASH_SCREEN_WIDTH = config.SPLASH_SCREEN_WIDTH 124 SPLASH_SCREEN_HEIGHT = config.SPLASH_SCREEN_HEIGHT 125 SS_MAX_DISPLAY_TIME = config.SS_MAX_DISPLAY_TIME 126 if not WELCOME_PANEL_ON: 127 WELCOME_PANEL_SHOW = False 168 128 else: 129 WELCOME_PANEL_SHOW = True 130 try: 131 DATALOADER_SHOW = custom_config.DATALOADER_SHOW 132 TOOLBAR_SHOW = custom_config.TOOLBAR_SHOW 133 FIXED_PANEL = custom_config.FIXED_PANEL 134 if WELCOME_PANEL_ON: 135 WELCOME_PANEL_SHOW = custom_config.WELCOME_PANEL_SHOW 136 PLOPANEL_WIDTH = custom_config.PLOPANEL_WIDTH 137 DATAPANEL_WIDTH = custom_config.DATAPANEL_WIDTH 138 GUIFRAME_WIDTH = custom_config.GUIFRAME_WIDTH 139 GUIFRAME_HEIGHT = custom_config.GUIFRAME_HEIGHT 140 CONTROL_WIDTH = custom_config.CONTROL_WIDTH 141 CONTROL_HEIGHT = custom_config.CONTROL_HEIGHT 142 DEFAULT_PERSPECTIVE = custom_config.DEFAULT_PERSPECTIVE 143 CLEANUP_PLOT = custom_config.CLEANUP_PLOT 144 # custom open_path 145 open_folder = custom_config.DEFAULT_OPEN_FOLDER 146 if open_folder != None and os.path.isdir(open_folder): 147 DEFAULT_OPEN_FOLDER = os.path.abspath(open_folder) 148 else: 149 DEFAULT_OPEN_FOLDER = PATH_APP 150 except AttributeError: 151 DATALOADER_SHOW = True 152 TOOLBAR_SHOW = True 153 FIXED_PANEL = True 154 WELCOME_PANEL_SHOW = False 155 PLOPANEL_WIDTH = config.PLOPANEL_WIDTH 156 DATAPANEL_WIDTH = config.DATAPANEL_WIDTH 157 GUIFRAME_WIDTH = config.GUIFRAME_WIDTH 158 GUIFRAME_HEIGHT = config.GUIFRAME_HEIGHT 159 CONTROL_WIDTH = -1 160 CONTROL_HEIGHT = -1 161 DEFAULT_PERSPECTIVE = None 162 CLEANUP_PLOT = False 169 163 DEFAULT_OPEN_FOLDER = PATH_APP 170 except AttributeError: 171 DATALOADER_SHOW = True 172 TOOLBAR_SHOW = True 173 FIXED_PANEL = True 174 WELCOME_PANEL_SHOW = False 175 PLOPANEL_WIDTH = config.PLOPANEL_WIDTH 176 DATAPANEL_WIDTH = config.DATAPANEL_WIDTH 177 GUIFRAME_WIDTH = config.GUIFRAME_WIDTH 178 GUIFRAME_HEIGHT = config.GUIFRAME_HEIGHT 179 CONTROL_WIDTH = -1 180 CONTROL_HEIGHT = -1 181 DEFAULT_PERSPECTIVE = None 182 CLEANUP_PLOT = False 183 DEFAULT_OPEN_FOLDER = PATH_APP 184 185 #DEFAULT_STYLE = config.DEFAULT_STYLE 186 187 PLUGIN_STATE_EXTENSIONS = config.PLUGIN_STATE_EXTENSIONS 188 OPEN_SAVE_MENU = config.OPEN_SAVE_PROJECT_MENU 189 VIEW_MENU = config.VIEW_MENU 190 EDIT_MENU = config.EDIT_MENU 191 extension_list = [] 192 if APPLICATION_STATE_EXTENSION is not None: 193 extension_list.append(APPLICATION_STATE_EXTENSION) 194 EXTENSIONS = PLUGIN_STATE_EXTENSIONS + extension_list 195 try: 196 PLUGINS_WLIST = '|'.join(config.PLUGINS_WLIST) 197 except AttributeError: 198 PLUGINS_WLIST = '' 199 APPLICATION_WLIST = config.APPLICATION_WLIST 200 IS_WIN = True 201 IS_LINUX = False 202 CLOSE_SHOW = True 203 TIME_FACTOR = 2 204 NOT_SO_GRAPH_LIST = ["BoxSum"] 164 165 #DEFAULT_STYLE = config.DEFAULT_STYLE 166 167 PLUGIN_STATE_EXTENSIONS = config.PLUGIN_STATE_EXTENSIONS 168 OPEN_SAVE_MENU = config.OPEN_SAVE_PROJECT_MENU 169 VIEW_MENU = config.VIEW_MENU 170 EDIT_MENU = config.EDIT_MENU 171 extension_list = [] 172 if APPLICATION_STATE_EXTENSION is not None: 173 extension_list.append(APPLICATION_STATE_EXTENSION) 174 EXTENSIONS = PLUGIN_STATE_EXTENSIONS + extension_list 175 try: 176 PLUGINS_WLIST = '|'.join(config.PLUGINS_WLIST) 177 except AttributeError: 178 PLUGINS_WLIST = '' 179 APPLICATION_WLIST = config.APPLICATION_WLIST 180 IS_WIN = True 181 IS_LINUX = False 182 CLOSE_SHOW = True 183 TIME_FACTOR = 2 184 NOT_SO_GRAPH_LIST = ["BoxSum"] 205 185 206 186 class Communicate(QtCore.QObject):
Note: See TracChangeset
for help on using the changeset viewer.