Changeset 2df1bd1 in sasview for src/sas/sasgui/guiframe
- Timestamp:
- Apr 6, 2017 11:06:43 AM (8 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, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 982577b
- Parents:
- 54557b5 (diff), ec8886e (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. - Location:
- src/sas/sasgui/guiframe
- Files:
-
- 1 added
- 1 deleted
- 14 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/CategoryInstaller.py
rddbac66 r463e7ffc 16 16 17 17 USER_FILE = 'categories.json' 18 19 logger = logging.getLogger(__name__) 18 20 19 21 class CategoryInstaller: … … 114 116 @staticmethod 115 117 def get_default_file(): 116 logg ing.warning("CategoryInstaller.get_default_file is deprecated.")118 logger.warning("CategoryInstaller.get_default_file is deprecated.") 117 119 118 120 @staticmethod … … 153 155 model_enabled_dict.pop(model_name) 154 156 except: 155 logg ing.error("CategoryInstaller: %s", sys.exc_value)157 logger.error("CategoryInstaller: %s", sys.exc_value) 156 158 else: 157 159 add_list.remove(model_name) -
src/sas/sasgui/guiframe/CategoryManager.py
r212bfc2 r463e7ffc 20 20 from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 21 21 IS_MAC = (sys.platform == 'darwin') 22 23 logger = logging.getLogger(__name__) 22 24 23 25 """ Notes … … 373 375 self.master_category_dict = json.load(f) 374 376 except IOError: 375 logg ing.error('Problem reading in category file.')377 logger.error('Problem reading in category file.') 376 378 377 379 self._regenerate_model_dict() -
src/sas/sasgui/guiframe/config.py
r1779e72 r64ca561 7 7 import sas.sasview 8 8 import logging 9 10 11 logger = logging.getLogger(__name__) 9 12 10 13 # Version of the application … … 57 60 58 61 icon_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "images")) 59 logg ing.info("icon path: %s" % icon_path)62 logger.info("icon path: %s" % icon_path) 60 63 media_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "media")) 61 64 test_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "test")) -
src/sas/sasgui/guiframe/data_manager.py
r2ffe241 r463e7ffc 25 25 from sas.sasgui.guiframe.dataFitting import Data2D 26 26 import time 27 28 logger = logging.getLogger(__name__) 27 29 28 30 class DataManager(object): … … 136 138 msg = "Data manager already stores %s" % str(data.name) 137 139 msg += "" 138 logg ing.info(msg)140 logger.info(msg) 139 141 data_state = self.stored_data[id] 140 142 data_state.data = data -
src/sas/sasgui/guiframe/documentation_window.py
rd85c194 r463e7ffc 20 20 import urllib 21 21 import sys 22 23 logger = logging.getLogger(__name__) 22 24 23 25 SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" … … 71 73 72 74 if not os.path.exists(file_path): 73 logg ing.error("Could not find Sphinx documentation at %s \75 logger.error("Could not find Sphinx documentation at %s \ 74 76 -- has it been built?", file_path) 75 77 elif WX_SUPPORTS_HTML2: … … 79 81 self.Show() 80 82 else: 81 logg ing.error("No html2 support, popping up a web browser")83 logger.error("No html2 support, popping up a web browser") 82 84 #For cases that do not build against current version dependency 83 85 # Wx 3.0 we provide a webbrowser call - this is particularly for -
src/sas/sasgui/guiframe/gui_manager.py
r73cbeec r64ca561 48 48 from matplotlib import _pylab_helpers 49 49 50 logger = logging.getLogger(__name__) 51 50 52 warnings.simplefilter("ignore") 51 52 53 53 54 def get_app_dir(): … … 64 65 if os.path.isfile(os.path.join(app_path, "custom_config.py")): 65 66 app_path = os.path.abspath(app_path) 66 logg ing.info("Using application path: %s", app_path)67 logger.info("Using application path: %s", app_path) 67 68 return app_path 68 69 69 70 # Next, try the current working directory 70 71 if os.path.isfile(os.path.join(os.getcwd(), "custom_config.py")): 71 logg ing.info("Using application path: %s", os.getcwd())72 logger.info("Using application path: %s", os.getcwd()) 72 73 return os.path.abspath(os.getcwd()) 73 74 … … 76 77 # clean all these module variables and put them into a config class 77 78 # that can be passed by sasview.py. 78 logg ing.info(sys.executable)79 logg ing.info(str(sys.argv))79 logger.info(sys.executable) 80 logger.info(str(sys.argv)) 80 81 from sas import sasview as sasview 81 82 app_path = os.path.dirname(sasview.__file__) 82 logg ing.info("Using application path: %s", app_path)83 logger.info("Using application path: %s", app_path) 83 84 return app_path 84 85 … … 104 105 config_module = imp.load_module(file, fObj, path_config, descr) 105 106 except: 106 logg ing.error("Error loading %s/%s: %s" % (path, file, sys.exc_value))107 logger.error("Error loading %s/%s: %s" % (path, file, sys.exc_value)) 107 108 finally: 108 109 if fObj is not None: 109 110 fObj.close() 110 logg ing.info("GuiManager loaded %s/%s" % (path, file))111 logger.info("GuiManager loaded %s/%s" % (path, file)) 111 112 return config_module 112 113 … … 125 126 # Didn't find local config, load the default 126 127 import sas.sasgui.guiframe.config as config 127 logg ing.info("using default local_config")128 logger.info("using default local_config") 128 129 else: 129 logg ing.info("found local_config in %s" % os.getcwd())130 logger.info("found local_config in %s" % os.getcwd()) 130 131 else: 131 logg ing.info("found local_config in %s" % PATH_APP)132 logger.info("found local_config in %s" % PATH_APP) 132 133 133 134 from sas.sasgui.guiframe.customdir import SetupCustom … … 138 139 if custom_config is None: 139 140 msgConfig = "Custom_config file was not imported" 140 logg ing.info(msgConfig)141 logger.info(msgConfig) 141 142 else: 142 logg ing.info("using custom_config in %s" % os.getcwd())143 logger.info("using custom_config in %s" % os.getcwd()) 143 144 else: 144 logg ing.info("using custom_config from %s" % c_conf_dir)145 logger.info("using custom_config from %s" % c_conf_dir) 145 146 146 147 # read some constants from config … … 374 375 frame.SetIcon(icon) 375 376 except: 376 logg ing.error("ViewerFrame.put_icon: could not set icon")377 logger.error("ViewerFrame.put_icon: could not set icon") 377 378 378 379 def get_client_size(self): … … 803 804 str(self._input_file)) 804 805 msg += str(sys.exc_value) + '\n' 805 logg ing.error(msg)806 logger.error(msg) 806 807 if self._data_panel is not None and len(self.plugins) > 0: 807 808 self._data_panel.fill_cbox_analysis(self.plugins) … … 869 870 if plugin.__class__ == item.__class__: 870 871 msg = "Plugin %s already loaded" % plugin.sub_menu 871 logg ing.info(msg)872 logger.info(msg) 872 873 is_loaded = True 873 874 if not is_loaded: 874 875 self.plugins.append(plugin) 875 876 msg = "Plugin %s appended" % plugin.sub_menu 876 logg ing.info(msg)877 logger.info(msg) 877 878 878 879 def _get_local_plugins(self): … … 894 895 msg = "ViewerFrame._get_local_plugins:" 895 896 msg += "cannot import dataloader plugin.\n %s" % sys.exc_value 896 logg ing.error(msg)897 logger.error(msg) 897 898 if style2 == GUIFRAME.PLOTTING_ON: 898 899 try: … … 904 905 msg = "ViewerFrame._get_local_plugins:" 905 906 msg += "cannot import plotting plugin.\n %s" % sys.exc_value 906 logg ing.error(msg)907 logger.error(msg) 907 908 908 909 return plugins … … 949 950 plugins.append(module.Plugin()) 950 951 msg = "Found plug-in: %s" % module.PLUGIN_ID 951 logg ing.info(msg)952 logger.info(msg) 952 953 except: 953 954 msg = "Error accessing PluginPanel" … … 956 957 except: 957 958 msg = "ViewerFrame._find_plugins: %s" % sys.exc_value 958 logg ing.error(msg)959 logger.error(msg) 959 960 finally: 960 961 if file is not None: … … 963 964 # Should raise and catch at a higher level and 964 965 # display error on status bar 965 logg ing.error(sys.exc_value)966 logger.error(sys.exc_value) 966 967 967 968 return plugins … … 1385 1386 1386 1387 if config._do_aboutbox: 1387 logg ing.info("Doing help menu")1388 logger.info("Doing help menu") 1388 1389 wx_id = wx.NewId() 1389 1390 self._help_menu.Append(wx_id, '&About', 'Software information') … … 1746 1747 del self.panels[ID] 1747 1748 else: 1748 logg ing.error("delete_panel: No such plot id as %s" % ID)1749 logger.error("delete_panel: No such plot id as %s" % ID) 1749 1750 1750 1751 def create_gui_data(self, data, path=None): … … 1763 1764 log_msg += "load: %s\n" % str(basename) 1764 1765 log_msg += "Try Data opening...." 1765 logg ing.error(log_msg)1766 logger.error(log_msg) 1766 1767 return 1767 1768 … … 1843 1844 log_msg += "load: %s\n" % str(path) 1844 1845 log_msg += "Try File opening ...." 1845 logg ing.error(log_msg)1846 logger.error(log_msg) 1846 1847 return 1847 1848 log_msg = '' … … 1849 1850 error_message = "" 1850 1851 try: 1851 logg ing.info("Loading Data...:\n" + str(path) + "\n")1852 logger.info("Loading Data...:\n" + str(path) + "\n") 1852 1853 temp = self.loader.load(path) 1853 1854 if temp.__class__.__name__ == "list": … … 1864 1865 error_message += " Data from cmd:\n %s\n" % str(path) 1865 1866 error_message += str(sys.exc_value) + "\n" 1866 logg ing.error(error_message)1867 logger.error(error_message) 1867 1868 1868 1869 def load_folder(self, path): … … 1885 1886 error_message += " Data folder from cmd:\n %s\n" % str(path) 1886 1887 error_message += str(sys.exc_value) + "\n" 1887 logg ing.error(error_message)1888 logger.error(error_message) 1888 1889 1889 1890 def _on_open_state_application(self, event): … … 2044 2045 msg += "and model selected. " 2045 2046 msg += "No project was saved to %s" % (str(path)) 2046 logg ing.warning(msg)2047 logger.warning(msg) 2047 2048 wx.PostEvent(self, StatusEvent(status=msg, info="error")) 2048 2049 except Exception: … … 2111 2112 #IF SAS_OPENCL is set, settings are stored in the custom config file 2112 2113 self._write_opencl_config_file() 2113 logg ing.info(" --- SasView session was closed --- \n")2114 logger.info(" --- SasView session was closed --- \n") 2114 2115 wx.Exit() 2115 2116 sys.exit() … … 2140 2141 new_config_file.close() 2141 2142 else: 2142 logg ing.info("Failed to save OPENCL settings in custom config file")2143 logger.info("Failed to save OPENCL settings in custom config file") 2143 2144 2144 2145 … … 2157 2158 # 2158 2159 content = response.read().strip() 2159 logg ing.info("Connected to www.sasview.org. Latest version: %s"2160 logger.info("Connected to www.sasview.org. Latest version: %s" 2160 2161 % (content)) 2161 2162 version_info = json.loads(content) 2162 2163 except: 2163 logg ing.info("Failed to connect to www.sasview.org")2164 logger.info("Failed to connect to www.sasview.org") 2164 2165 self._process_version(version_info, standalone=event is None) 2165 2166 … … 2201 2202 msg = "guiframe: could not get latest application" 2202 2203 msg += " version number\n %s" % sys.exc_value 2203 logg ing.error(msg)2204 logger.error(msg) 2204 2205 if not standalone: 2205 2206 msg = "Could not connect to the application server." … … 2248 2249 dialog.Show(True) 2249 2250 except: 2250 logg ing.error("Error in _onTutorial: %s" % sys.exc_value)2251 logger.error("Error in _onTutorial: %s" % sys.exc_value) 2251 2252 try: 2252 2253 # Try an alternate method 2253 logg ing.error(2254 logger.error( 2254 2255 "Could not open the tutorial pdf, trying xhtml2pdf") 2255 2256 from xhtml2pdf import pisa 2256 2257 pisa.startViewer(path) 2257 2258 except: 2258 logg ing.error(2259 logger.error( 2259 2260 "Could not open the tutorial pdf with xhtml2pdf") 2260 2261 msg = "This feature requires 'PDF Viewer'\n" … … 2267 2268 try: 2268 2269 # Try an alternate method 2269 logg ing.error(2270 logger.error( 2270 2271 "Could not open the tutorial pdf, trying xhtml2pdf") 2271 2272 from xhtml2pdf import pisa 2272 2273 pisa.startViewer(path) 2273 2274 except: 2274 logg ing.error(2275 logger.error( 2275 2276 "Could not open the tutorial pdf with xhtml2pdf") 2276 2277 msg = "This feature requires the Preview application\n" … … 2411 2412 else: 2412 2413 msg = "Guiframe does not have a current perspective" 2413 logg ing.info(msg)2414 logger.info(msg) 2414 2415 2415 2416 def set_theory(self, state_id, theory_id=None): … … 2422 2423 except: 2423 2424 msg = "Guiframe set_theory: \n" + str(sys.exc_value) 2424 logg ing.info(msg)2425 logger.info(msg) 2425 2426 wx.PostEvent(self, StatusEvent(status=msg, info="error")) 2426 2427 else: 2427 2428 msg = "Guiframe does not have a current perspective" 2428 logg ing.info(msg)2429 logger.info(msg) 2429 2430 2430 2431 def plot_data(self, state_id, data_id=None, … … 2508 2509 action='remove')) 2509 2510 except: 2510 logg ing.error(sys.exc_value)2511 logger.error(sys.exc_value) 2511 2512 2512 2513 def save_data1d(self, data, fname): … … 3306 3307 msg = "%s Could not load " % str(APPLICATION_NAME) 3307 3308 msg += "input file from command line.\n" 3308 logg ing.error(msg)3309 logger.error(msg) 3309 3310 # Display a splash screen on top of the frame. 3310 3311 try: … … 3320 3321 msg = "Cannot display splash screen\n" 3321 3322 msg += str(sys.exc_value) 3322 logg ing.error(msg)3323 logger.error(msg) 3323 3324 self.frame.Show() 3324 3325 … … 3375 3376 os.remove(file_path) 3376 3377 except: 3377 logg ing.error("gui_manager.clean_plugin_models:\n %s"3378 logger.error("gui_manager.clean_plugin_models:\n %s" 3378 3379 % sys.exc_value) 3379 3380 -
src/sas/sasgui/guiframe/gui_statusbar.py
r3a22ce7 r463e7ffc 12 12 from sas.sasgui.guiframe.gui_style import GUIFRAME_ICON 13 13 14 logger = logging.getLogger(__name__) 15 14 16 # Number of fields on the status bar 15 17 NB_FIELDS = 4 … … 71 73 icon_type = event.info.lower() 72 74 if icon_type == "warning": 73 logg ing.warning(status)75 logger.warning(status) 74 76 color = (0, 0, 255) # blue 75 77 icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_WARNING, 76 78 wx.ART_TOOLBAR) 77 79 if icon_type == "error": 78 logg ing.error(status)80 logger.error(status) 79 81 color = (255, 0, 0) # red 80 82 icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_ERROR, -
src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py
ra674d0b r463e7ffc 7 7 import wx 8 8 import logging 9 10 logger = logging.getLogger(__name__) 9 11 10 12 from sas.sascalc.dataloader.loader import Loader … … 160 162 message += "\tError: {0}\n".format(error_data) 161 163 else: 162 logg ing.error("Loader returned an invalid object:\n %s" % str(item))164 logger.error("Loader returned an invalid object:\n %s" % str(item)) 163 165 data_error = True 164 166 … … 182 184 log_msg += "Please try to open that file from \"open project\"" 183 185 log_msg += "or \"open analysis\" menu." 184 logg ing.info(log_msg)186 logger.info(log_msg) 185 187 file_errors[basename] = [log_msg] 186 188 continue … … 212 214 213 215 except: 214 logg ing.error(sys.exc_value)216 logger.error(sys.exc_value) 215 217 216 218 error_message = "The Data file you selected could not be loaded.\n" -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
r9a5097c r9c0f3c17 24 24 from appearanceDialog import appearanceDialog 25 25 from graphAppearance import graphAppearance 26 27 logger = logging.getLogger(__name__) 26 28 27 29 DEFAULT_QMAX = 0.05 … … 242 244 wx.PostEvent(self.parent, StatusEvent(status=position)) 243 245 except: 244 logg ing.error(sys.exc_value)246 logger.error(sys.exc_value) 245 247 if not event.leftdown: 246 248 # text event … … 255 257 self.canvas.draw() 256 258 except: 257 logg ing.error(sys.exc_value)259 logger.error(sys.exc_value) 258 260 event.Skip() 259 261 return … … 409 411 self.q_ctrl[vl_ind].SetValue(str(pos_x)) 410 412 except: 411 logg ing.error(sys.exc_value)413 logger.error(sys.exc_value) 412 414 413 415 def set_resizing(self, resizing=False): -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py
r0d8ee36 r2df1bd1 30 30 from graphAppearance import graphAppearance 31 31 (InternalEvent, EVT_INTERNAL) = wx.lib.newevent.NewEvent() 32 33 logger = logging.getLogger(__name__) 32 34 33 35 DEFAULT_QMAX = 0.05 … … 433 435 except: 434 436 msg = "Add Text: Error. Check your property values..." 435 logg ing.error(msg)437 logger.error(msg) 436 438 if self.parent != None: 437 439 wx.PostEvent(self.parent, StatusEvent(status=msg)) -
src/sas/sasgui/guiframe/local_perspectives/plotting/binder.py
rd85c194 r463e7ffc 4 4 import logging 5 5 import sys 6 7 logger = logging.getLogger(__name__) 6 8 7 9 class Selection(object): … … 70 72 canvas.mpl_disconnect(canvas.scroll_pick_id) 71 73 except: 72 logg ing.error(sys.exc_value)74 logger.error(sys.exc_value) 73 75 self.canvas = canvas 74 76 self.figure = figure -
src/sas/sasgui/guiframe/media/data_formats_help.rst
r98c44f3 r76c4469 86 86 87 87 - Spin echo length (z, in Angstroms) 88 - depolarization (:math:`log(P/P_0)/(lambda^2 * thickness)`, in Angstrom ^-1 cm^-1)88 - depolarization (:math:`log(P/P_0)/(lambda^2 * thickness)`, in Angstrom :sup:`-1` cm :sup:`-1`\ ) 89 89 - depolarization error in the same unit) (measurement error) 90 90 - Spin echo length error (:math:`\Delta`\ z, in Angstroms) (experimental resolution) -
src/sas/sasgui/guiframe/proxy.py
rd85c194 r463e7ffc 6 6 import logging 7 7 import re 8 9 10 logger = logging.getLogger(__name__) 8 11 9 12 ''' … … 71 74 proxy_url_list = [] 72 75 for this_pac_url in pac_urls_list: 73 logg ing.debug('Trying pac file (%s)...' % this_pac_url)76 logger.debug('Trying pac file (%s)...' % this_pac_url) 74 77 try: 75 78 response = urllib2.urlopen( 76 79 this_pac_url, timeout=self.timeout) 77 logg ing.debug('Succeeded (%s)...' % this_pac_url)80 logger.debug('Succeeded (%s)...' % this_pac_url) 78 81 except Exception: 79 logg ing.debug('Failled (%s)...' % this_pac_url)82 logger.debug('Failled (%s)...' % this_pac_url) 80 83 continue 81 84 pacStr = response.read() … … 120 123 response = None 121 124 try: 122 logg ing.debug("Trying Direct connection to %s..."%self.url)125 logger.debug("Trying Direct connection to %s..."%self.url) 123 126 response = urllib2.urlopen(req, timeout=self.timeout) 124 127 except Exception, e: 125 logg ing.debug("Failed!")126 logg ing.debug(e)128 logger.debug("Failed!") 129 logger.debug(e) 127 130 try: 128 logg ing.debug("Trying to use system proxy if it exists...")131 logger.debug("Trying to use system proxy if it exists...") 129 132 self._set_proxy() 130 133 response = urllib2.urlopen(req, timeout=self.timeout) 131 134 except Exception, e: 132 logg ing.debug("Failed!")133 logg ing.debug(e)135 logger.debug("Failed!") 136 logger.debug(e) 134 137 pac_urls = self._get_addresses_of_proxy_pac() 135 138 proxy_urls = self._parse_proxy_pac(pac_urls) 136 139 for proxy in proxy_urls: 137 140 try: 138 logg ing.debug("Trying to use the proxy %s found in proxy.pac configuration"%proxy)141 logger.debug("Trying to use the proxy %s found in proxy.pac configuration"%proxy) 139 142 self._set_proxy(proxy) 140 143 response = urllib2.urlopen(req, timeout=self.timeout) 141 144 except Exception, e: 142 logg ing.debug("Failed!")143 logg ing.debug(e)145 logger.debug("Failed!") 146 logger.debug(e) 144 147 if response is not None: 145 logg ing.debug("The connection to %s was successful."%self.url)148 logger.debug("The connection to %s was successful."%self.url) 146 149 else: 147 logg ing.warning("Connection to %s failed..."%self.url)150 logger.warning("Connection to %s failed..."%self.url) 148 151 return response 149 152 -
src/sas/sasgui/guiframe/report_dialog.py
r6dd6e32 r463e7ffc 7 7 import sys 8 8 import wx.html as html 9 10 logger = logging.getLogger(__name__) 9 11 10 12 ISPDF = False … … 135 137 return pisaStatus.err 136 138 except: 137 logg ing.error("Error creating pdf: %s" % sys.exc_value)139 logger.error("Error creating pdf: %s" % sys.exc_value) 138 140 return False 139 141
Note: See TracChangeset
for help on using the changeset viewer.