Changeset 278ddee in sasview for src/sas/sasgui/guiframe
- Timestamp:
- Apr 11, 2017 9:51:05 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:
- beba407
- Parents:
- 7f75a3f (diff), 97c60f8 (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. - git-author:
- Jeff Krzywon <krzywon@…> (04/11/17 09:51:05)
- git-committer:
- krzywon <krzywon@…> (04/11/17 09:51:05)
- Location:
- src/sas/sasgui/guiframe
- Files:
-
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/CategoryInstaller.py
rddbac66 r235f514 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 … … 130 132 131 133 serialized_file = None 132 if homedir ==None:134 if homedir is None: 133 135 serialized_file = CategoryInstaller.get_user_file() 134 136 else: … … 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 rea45bfe 7 7 import sas.sasview 8 8 import logging 9 10 11 logger = logging.getLogger(__name__) 9 12 10 13 # Version of the application … … 46 49 47 50 _acknowledgement = \ 48 '''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547,\n but is currently maintained by a collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, DLS, and the scattering community.\n\n SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project (Grant No 654000).\nA list of individual contributors can be found at: http s://github.com/orgs/SasView/people51 '''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547,\n but is currently maintained by a collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, DLS, and the scattering community.\n\n SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project (Grant No 654000).\nA list of individual contributors can be found at: http://www.sasview.org/contact.html 49 52 ''' 50 53 … … 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/dataFitting.py
r9a5097c r7432acb 78 78 result.clone_without_data(length=len(self.x), clone=self) 79 79 result.copy_from_datainfo(data1d=self) 80 if self.dxw ==None:80 if self.dxw is None: 81 81 result.dxw = None 82 82 else: 83 83 result.dxw = np.zeros(len(self.x)) 84 if self.dxl ==None:84 if self.dxl is None: 85 85 result.dxl = None 86 86 else: … … 125 125 tot_length = len(self.x) + len(other.x) 126 126 result = self.clone_without_data(length=tot_length, clone=result) 127 if self.dlam ==None or other.dlam is None:127 if self.dlam is None or other.dlam is None: 128 128 result.dlam = None 129 129 else: 130 130 result.dlam = np.zeros(tot_length) 131 if self.dy ==None or other.dy is None:131 if self.dy is None or other.dy is None: 132 132 result.dy = None 133 133 else: 134 134 result.dy = np.zeros(tot_length) 135 if self.dx ==None or other.dx is None:135 if self.dx is None or other.dx is None: 136 136 result.dx = None 137 137 else: 138 138 result.dx = np.zeros(tot_length) 139 if self.dxw ==None or other.dxw is None:139 if self.dxw is None or other.dxw is None: 140 140 result.dxw = None 141 141 else: 142 142 result.dxw = np.zeros(tot_length) 143 if self.dxl ==None or other.dxl is None:143 if self.dxl is None or other.dxl is None: 144 144 result.dxl = None 145 145 else: … … 154 154 result.lam = np.append(self.lam, other.lam) 155 155 result.lam = result.lam[ind] 156 if result.dlam !=None:156 if result.dlam is not None: 157 157 result.dlam = np.append(self.dlam, other.dlam) 158 158 result.dlam = result.dlam[ind] 159 if result.dy !=None:159 if result.dy is not None: 160 160 result.dy = np.append(self.dy, other.dy) 161 161 result.dy = result.dy[ind] … … 227 227 result = self.clone_without_data(len(self.x)) 228 228 result.copy_from_datainfo(data1d=self) 229 if self.dxw ==None:229 if self.dxw is None: 230 230 result.dxw = None 231 231 else: 232 232 result.dxw = np.zeros(len(self.x)) 233 if self.dxl ==None:233 if self.dxl is None: 234 234 result.dxl = None 235 235 else: … … 279 279 tot_length = len(self.x)+len(other.x) 280 280 result.clone_without_data(length=tot_length, clone=self) 281 if self.dlam ==None or other.dlam is None:281 if self.dlam is None or other.dlam is None: 282 282 result.dlam = None 283 283 else: 284 284 result.dlam = np.zeros(tot_length) 285 if self.dy ==None or other.dy is None:285 if self.dy is None or other.dy is None: 286 286 result.dy = None 287 287 else: 288 288 result.dy = np.zeros(tot_length) 289 if self.dx ==None or other.dx is None:289 if self.dx is None or other.dx is None: 290 290 result.dx = None 291 291 else: 292 292 result.dx = np.zeros(tot_length) 293 if self.dxw ==None or other.dxw is None:293 if self.dxw is None or other.dxw is None: 294 294 result.dxw = None 295 295 else: 296 296 result.dxw = np.zeros(tot_length) 297 if self.dxl ==None or other.dxl is None:297 if self.dxl is None or other.dxl is None: 298 298 result.dxl = None 299 299 else: … … 307 307 result.lam = np.append(self.lam, other.lam) 308 308 result.lam = result.lam[ind] 309 if result.dy !=None:309 if result.dy is not None: 310 310 result.dy = np.append(self.dy, other.dy) 311 311 result.dy = result.dy[ind] … … 405 405 result.ymin = self.ymin 406 406 result.ymax = self.ymax 407 if self.dqx_data == None or self.dqy_data ==None:407 if self.dqx_data is None or self.dqy_data is None: 408 408 result.dqx_data = None 409 409 result.dqy_data = None … … 468 468 result.ymin = self.ymin 469 469 result.ymax = self.ymax 470 if self.dqx_data == None or self.dqy_data ==None or \471 other.dqx_data == None or other.dqy_data ==None :470 if self.dqx_data is None or self.dqy_data is None or \ 471 other.dqx_data is None or other.dqy_data is None : 472 472 result.dqx_data = None 473 473 result.dqy_data = None -
src/sas/sasgui/guiframe/data_manager.py
r2ffe241 r959eb01 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/data_processor.py
r9a5097c r7432acb 18 18 19 19 """ 20 import wx21 import numpy22 import math23 import re24 20 import os 25 21 import sys 26 22 import copy 27 from wx.lib.scrolledpanel import ScrolledPanel 23 import math 24 import re 25 import wx 26 import numpy as np 27 28 28 import wx.aui 29 29 from wx.aui import AuiNotebook as nb 30 30 import wx.lib.sheet as sheet 31 from wx.lib.scrolledpanel import ScrolledPanel 32 31 33 from sas.sasgui.guiframe.panel_base import PanelBase 32 34 from sas.sasgui.guiframe.events import NewPlotEvent … … 313 315 if row > self.max_row_touse: 314 316 self.max_row_touse = row 315 if self.data ==None:317 if self.data is None: 316 318 self.data = {} 317 319 event.Skip() … … 812 814 """ 813 815 814 if self.data ==None:816 if self.data is None: 815 817 self.data = {} 816 if self.file_name ==None:818 if self.file_name is None: 817 819 self.file_name = 'copied_data' 818 820 self.Paste() … … 1015 1017 if index - 1 >= 0: 1016 1018 new_row, _ = temp_list[index - 1] 1017 if n ot new_row ==None and new_row != ' ':1019 if new_row is not None and new_row != ' ': 1018 1020 label += create_label(col_name, None, 1019 1021 int(new_row) + 1) … … 1023 1025 if index + 1 < len(temp_list): 1024 1026 new_row, _ = temp_list[index + 1] 1025 if n ot new_row ==None:1027 if new_row is not None: 1026 1028 label += create_label(col_name, 1027 1029 int(new_row) + 1, None) 1028 if row_min != None and row_max !=None:1030 if row_min is not None and row_max is not None: 1029 1031 if index == 0: 1030 1032 label += create_label(col_name, … … 1083 1085 1084 1086 # Let's re-order the data from the keys in 'Data' name. 1085 if outputs ==None:1087 if outputs is None: 1086 1088 return 1087 1089 try: … … 1372 1374 wx.PostEvent(self.parent.parent, StatusEvent(status=msg, info="error")) 1373 1375 return 1374 if dy !=None and (len(y) != len(dy)):1376 if dy is not None and (len(y) != len(dy)): 1375 1377 msg = "Need same length for Y and dY axis and both greater than 0" 1376 1378 msg += " to plot.\n" … … 1378 1380 wx.PostEvent(self.parent.parent, StatusEvent(status=msg, info="error")) 1379 1381 return 1380 if dy ==None:1382 if dy is None: 1381 1383 dy = np.zeros(len(y)) 1382 1384 #plotting … … 1439 1441 col = column_names[col_name] 1440 1442 axis = self.get_plot_axis(col, list) 1441 if axis ==None:1443 if axis is None: 1442 1444 return None 1443 1445 sentence = sentence.replace(tok, "numpy.array(%s)" % str(axis)) … … 1570 1572 """ 1571 1573 1572 if label !=None:1574 if label is not None: 1573 1575 tcrtl_label.SetValue(str(label)) 1574 if title !=None:1576 if title is not None: 1575 1577 tcrtl_title.SetValue(str(title)) 1576 1578 … … 1683 1685 # I Believe this is no longer used now that we have removed the 1684 1686 # edit menu from the menubar - PDB July 12, 2015 1685 if event !=None:1687 if event is not None: 1686 1688 event.Skip() 1687 1689 pos = self.panel.notebook.GetSelection() … … 1695 1697 # I Believe this is no longer used now that we have removed the 1696 1698 # edit menu from the menubar - PDB July 12, 2015 1697 if event !=None:1699 if event is not None: 1698 1700 event.Skip() 1699 1701 pos = self.panel.notebook.GetSelection() … … 1737 1739 pos = self.panel.notebook.GetSelection() 1738 1740 grid = self.panel.notebook.GetPage(pos) 1739 has_data = (grid.data !=None and grid.data != {})1741 has_data = (grid.data is not None and grid.data != {}) 1740 1742 self.open_excel_menu.Enable(has_data) 1741 1743 self.save_menu.Enable(has_data) … … 1820 1822 path = dlg.GetPath() 1821 1823 dlg.Destroy() 1822 if path !=None:1824 if path is not None: 1823 1825 if self.parent is not None: 1824 1826 data = grid.get_grid_view() … … 2005 2007 path = dlg.GetPath() 2006 2008 dlg.Destroy() 2007 if path !=None:2009 if path is not None: 2008 2010 if self.parent is not None and self.data is not None: 2009 2011 self.parent.write_batch_tofile(data=self.data, -
src/sas/sasgui/guiframe/documentation_window.py
rd85c194 r959eb01 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 r38beeab 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.debug(sys.executable) 80 logger.debug(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.debug("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.debug("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.debug("using default local_config") 128 129 else: 129 logg ing.info("found local_config in %s" % os.getcwd())130 logger.debug("found local_config in %s" % os.getcwd()) 130 131 else: 131 logg ing.info("found local_config in %s" % PATH_APP)132 logger.debug("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.debug(msgConfig) 141 142 else: 142 logg ing.info("using custom_config in %s" % os.getcwd())143 logger.debug("using custom_config in %s" % os.getcwd()) 143 144 else: 144 logg ing.info("using custom_config from %s" % c_conf_dir)145 logger.debug("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() … … 2121 2122 """ 2122 2123 if custom_config is not None: 2123 sas_opencl = os.environ.get("SAS_OPENCL" ,None)2124 sas_opencl = os.environ.get("SAS_OPENCL") 2124 2125 new_config_lines = [] 2125 2126 config_file = open(custom_config.__file__) … … 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 … … 2155 2156 if response is not None: 2156 2157 try: 2157 #2158 2158 content = response.read().strip() 2159 logging.info("Connected to www.sasview.org. Latest version: %s" 2160 % (content)) 2159 logger.info("Connected to www.sasview.org. Latest version: %s", content) 2161 2160 version_info = json.loads(content) 2162 2161 except: 2163 logg ing.info("Failed to connect to www.sasview.org")2162 logger.info("Failed to connect to www.sasview.org") 2164 2163 self._process_version(version_info, standalone=event is None) 2165 2164 … … 2201 2200 msg = "guiframe: could not get latest application" 2202 2201 msg += " version number\n %s" % sys.exc_value 2203 logg ing.error(msg)2202 logger.error(msg) 2204 2203 if not standalone: 2205 2204 msg = "Could not connect to the application server." … … 2248 2247 dialog.Show(True) 2249 2248 except: 2250 logg ing.error("Error in _onTutorial: %s" % sys.exc_value)2249 logger.error("Error in _onTutorial: %s" % sys.exc_value) 2251 2250 try: 2252 2251 # Try an alternate method 2253 logg ing.error(2252 logger.error( 2254 2253 "Could not open the tutorial pdf, trying xhtml2pdf") 2255 2254 from xhtml2pdf import pisa 2256 2255 pisa.startViewer(path) 2257 2256 except: 2258 logg ing.error(2257 logger.error( 2259 2258 "Could not open the tutorial pdf with xhtml2pdf") 2260 2259 msg = "This feature requires 'PDF Viewer'\n" … … 2267 2266 try: 2268 2267 # Try an alternate method 2269 logg ing.error(2268 logger.error( 2270 2269 "Could not open the tutorial pdf, trying xhtml2pdf") 2271 2270 from xhtml2pdf import pisa 2272 2271 pisa.startViewer(path) 2273 2272 except: 2274 logg ing.error(2273 logger.error( 2275 2274 "Could not open the tutorial pdf with xhtml2pdf") 2276 2275 msg = "This feature requires the Preview application\n" … … 2411 2410 else: 2412 2411 msg = "Guiframe does not have a current perspective" 2413 logg ing.info(msg)2412 logger.info(msg) 2414 2413 2415 2414 def set_theory(self, state_id, theory_id=None): … … 2422 2421 except: 2423 2422 msg = "Guiframe set_theory: \n" + str(sys.exc_value) 2424 logg ing.info(msg)2423 logger.info(msg) 2425 2424 wx.PostEvent(self, StatusEvent(status=msg, info="error")) 2426 2425 else: 2427 2426 msg = "Guiframe does not have a current perspective" 2428 logg ing.info(msg)2427 logger.info(msg) 2429 2428 2430 2429 def plot_data(self, state_id, data_id=None, … … 2508 2507 action='remove')) 2509 2508 except: 2510 logg ing.error(sys.exc_value)2509 logger.error(sys.exc_value) 2511 2510 2512 2511 def save_data1d(self, data, fname): … … 3306 3305 msg = "%s Could not load " % str(APPLICATION_NAME) 3307 3306 msg += "input file from command line.\n" 3308 logg ing.error(msg)3307 logger.error(msg) 3309 3308 # Display a splash screen on top of the frame. 3310 3309 try: … … 3320 3319 msg = "Cannot display splash screen\n" 3321 3320 msg += str(sys.exc_value) 3322 logg ing.error(msg)3321 logger.error(msg) 3323 3322 self.frame.Show() 3324 3323 … … 3375 3374 os.remove(file_path) 3376 3375 except: 3377 logg ing.error("gui_manager.clean_plugin_models:\n %s"3376 logger.error("gui_manager.clean_plugin_models:\n %s" 3378 3377 % sys.exc_value) 3379 3378 -
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
r7f75a3f r278ddee 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 … … 73 75 path = None 74 76 self._default_save_location = self.parent._default_save_location 75 if self._default_save_location ==None:77 if self._default_save_location is None: 76 78 self._default_save_location = os.getcwd() 77 79 … … 90 92 if dlg.ShowModal() == wx.ID_OK: 91 93 file_list = dlg.GetPaths() 92 if len(file_list) >= 0 and not file_list[0] isNone:94 if len(file_list) >= 0 and file_list[0] is not None: 93 95 self._default_save_location = os.path.dirname(file_list[0]) 94 96 path = self._default_save_location … … 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 … … 191 193 log_msg += "Please try to open that file from \"open project\"" 192 194 log_msg += "or \"open analysis\" menu." 193 logg ing.info(log_msg)195 logger.info(log_msg) 194 196 file_errors[basename] = [log_msg] 195 197 continue … … 227 229 info="warning") 228 230 except: 229 logg ing.error(sys.exc_value)231 logger.error(sys.exc_value) 230 232 231 233 error_message = "The Data file you selected could not be " -
src/sas/sasgui/guiframe/local_perspectives/plotting/AnnulusSlicer.py
rd85c194 r7432acb 122 122 data = self.base.data2D 123 123 # If we have no data, just return 124 if data ==None:124 if data is None: 125 125 return 126 126 … … 132 132 # if the user does not specify the numbers of points to plot 133 133 # the default number will be nbins= 36 134 if nbins ==None:134 if nbins is None: 135 135 self.nbins = 36 136 136 else: … … 498 498 # Update locations 499 499 self.outer_circle.update() 500 # if self.is_inside !=None:500 # if self.is_inside is not None: 501 501 out = self._post_data() 502 502 return out … … 521 521 522 522 # If we have no data, just return 523 if data ==None:523 if data is None: 524 524 return 525 525 mask = data.mask -
src/sas/sasgui/guiframe/local_perspectives/plotting/Arc.py
rd85c194 r7432acb 71 71 x = [] 72 72 y = [] 73 if theta1 !=None:73 if theta1 is not None: 74 74 self.theta1 = theta1 75 if theta2 !=None:75 if theta2 is not None: 76 76 self.theta2 = theta2 77 77 while self.theta2 < self.theta1: … … 81 81 npts = int((self.theta2 - self.theta1) / (math.pi / 120)) 82 82 83 if r ==None:83 if r is None: 84 84 self.radius = math.sqrt(math.pow(self._mouse_x, 2) + \ 85 85 math.pow(self._mouse_y, 2)) -
src/sas/sasgui/guiframe/local_perspectives/plotting/Edge.py
rd85c194 r7432acb 63 63 Draw the new roughness on the graph. 64 64 """ 65 if r1 !=None:65 if r1 is not None: 66 66 self.r1 = r1 67 if r2 !=None:67 if r2 is not None: 68 68 self.r2 = r2 69 if theta !=None:69 if theta is not None: 70 70 self.theta = theta 71 71 x1 = self.r1 * math.cos(self.theta) -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
r9a5097c r7432acb 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 … … 181 183 # So manually recode the size (=x_size) and compare here. 182 184 # Massy code to work around:< 183 if self.parent._mgr !=None:185 if self.parent._mgr is not None: 184 186 max_panel = self.parent._mgr.GetPane(self) 185 187 if max_panel.IsMaximized(): 186 188 self.parent._mgr.RestorePane(max_panel) 187 189 max_panel.Maximize() 188 if self.x_size !=None:190 if self.x_size is not None: 189 191 if self.x_size == self.GetSize(): 190 192 self.resizing = False … … 210 212 On Qmin Qmax vertical line event 211 213 """ 212 if event ==None:214 if event is None: 213 215 return 214 216 event.Skip() 215 217 active_ctrl = event.active 216 if active_ctrl ==None:218 if active_ctrl is None: 217 219 return 218 220 if hasattr(event, 'is_corfunc'): … … 229 231 colors.append('purple') 230 232 values.append(min(x_data.max(), float(ctrl[2].GetValue()))) 231 if self.ly ==None:233 if self.ly is None: 232 234 self.ly = [] 233 235 for c, v in zip(colors, values): … … 239 241 xval = float(active_ctrl.GetValue()) 240 242 position = self.get_data_xy_vals(xval) 241 if position !=None and not self.is_corfunc:243 if position is not None and not self.is_corfunc: 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 … … 334 336 if hasattr(event, "action"): 335 337 dclick = event.action == 'dclick' 336 if ax ==None or dclick:338 if ax is None or dclick: 337 339 # remove the vline 338 340 self._check_zoom_plot() … … 340 342 self.q_ctrl = None 341 343 return 342 if self.ly != None and event.xdata !=None:344 if self.ly is not None and event.xdata is not None: 343 345 # Selecting a new line if cursor lines are displayed already 344 346 dqmin = math.fabs(event.xdata - self.ly[0].get_xdata()) … … 359 361 Move the cursor line to write Q range 360 362 """ 361 if self.q_ctrl ==None:363 if self.q_ctrl is None: 362 364 return 363 365 # release a q range vline 364 if self.ly !=None and not self.leftdown:366 if self.ly is not None and not self.leftdown: 365 367 for ly in self.ly: 366 368 ly.set_alpha(0.7) … … 368 370 return 369 371 ax = event.inaxes 370 if ax ==None or not hasattr(event, 'action'):372 if ax is None or not hasattr(event, 'action'): 371 373 return 372 end_drag = event.action != 'drag' and event.xdata !=None374 end_drag = event.action != 'drag' and event.xdata is not None 373 375 nop = len(self.plots) 374 376 pos_x, _ = float(event.xdata), float(event.ydata) … … 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): … … 512 514 ax = event.inaxes 513 515 PlotPanel.onLeftDown(self, event) 514 if ax !=None:516 if ax is not None: 515 517 try: 516 518 pos_x = float(event.xdata) # / size_x … … 616 618 # add menu of other plugins 617 619 item_list = self.parent.get_current_context_menu(self) 618 if ( not item_list == None) and (not len(item_list) == 0):620 if (item_list is not None) and (len(item_list)): 619 621 for item, wx_id in zip(item_list, [ids.next() for i in range(len(item_list))]): 620 621 622 try: 622 623 plot_menu.Append(wx_id, item[0], name) … … 682 683 683 684 684 if self.position !=None:685 if self.position is not None: 685 686 wx_id = ids.next() 686 687 self._slicerpop.Append(wx_id, '&Add Text') … … 759 760 default_name = default_name.split('.')[0] 760 761 default_name += "_out" 761 if self.parent !=None:762 if self.parent is not None: 762 763 self.parent.save_data1d(data, default_name) 763 764 … … 777 778 default_name = default_name.split('.')[0] 778 779 # default_name += "_out" 779 if self.parent !=None:780 if self.parent is not None: 780 781 self.parent.show_data1d(data, default_name) 781 782 … … 809 810 curr_label = self.appearance_selected_plot.label 810 811 811 if curr_color ==None:812 if curr_color is None: 812 813 curr_color = self._color_labels['Blue'] 813 814 curr_symbol = 13 -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py
r9a5097c r7432acb 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 … … 142 144 """ 143 145 # Not implemented 144 if event ==None:146 if event is None: 145 147 return 146 148 event.Skip() … … 154 156 PlotPanel.onLeftDown(self, event) 155 157 ax = event.inaxes 156 if ax !=None:158 if ax is not None: 157 159 # data coordinate position 158 160 pos_x = "%8.3g" % event.xdata … … 225 227 if self._is_changed_legend_label: 226 228 data.label = self.title_label 227 if data.label ==None:229 if data.label is None: 228 230 data.label = data.name 229 231 if not self.title_font: … … 262 264 # control axis labels from the panel itself 263 265 yname, yunits = data.get_yaxis() 264 if self.yaxis_label !=None:266 if self.yaxis_label is not None: 265 267 yname = self.yaxis_label 266 268 yunits = self.yaxis_unit … … 269 271 self.yaxis_unit = yunits 270 272 xname, xunits = data.get_xaxis() 271 if self.xaxis_label !=None:273 if self.xaxis_label is not None: 272 274 xname = self.xaxis_label 273 275 xunits = self.xaxis_unit … … 318 320 if len(self.data2D.detector) <= 1: 319 321 item_list = self.parent.get_current_context_menu(self) 320 if ( not item_list == None) and (not len(item_list) == 0) and\321 self.data2D.name.split(" ")[0] != 'Residuals' :322 if ((item_list is not None) and len(item_list) and 323 self.data2D.name.split(" ")[0] != 'Residuals'): 322 324 for item, wx_id in zip(item_list, [ids.next() for i in range(len(item_list))]): 323 325 try: … … 353 355 slicerpop.Append(wx_id, '&Box Averaging in Qy') 354 356 wx.EVT_MENU(self, wx_id, self.onBoxavgY) 355 if self.slicer !=None:357 if self.slicer is not None: 356 358 wx_id = ids.next() 357 359 slicerpop.Append(wx_id, '&Clear Slicer') … … 432 434 except: 433 435 msg = "Add Text: Error. Check your property values..." 434 logg ing.error(msg)435 if self.parent !=None:436 logger.error(msg) 437 if self.parent is not None: 436 438 wx.PostEvent(self.parent, StatusEvent(status=msg)) 437 439 dial.Destroy() … … 531 533 """ 532 534 ## Clear current slicer 533 if not self.slicer ==None:535 if self.slicer is not None: 534 536 self.slicer.clear() 535 537 ## Create a new slicer … … 627 629 628 630 """ 629 if self.slicer !=None:631 if self.slicer is not None: 630 632 from SlicerParameters import SlicerParameterPanel 631 633 dialog = SlicerParameterPanel(self, -1, "Slicer Parameters") … … 717 719 Clear the slicer on the plot 718 720 """ 719 if not self.slicer ==None:721 if self.slicer is not None: 720 722 self.slicer.clear() 721 723 self.subplot.figure.canvas.draw() … … 733 735 """ 734 736 event_id = str(evt.GetId()) 735 if self.parent !=None:737 if self.parent is not None: 736 738 self._default_save_location = self.parent._default_save_location 737 739 default_name = self.plots[self.graph.selected_plottable].label … … 757 759 default_name = default_name.split('.')[0] 758 760 #default_name += "_out" 759 if self.parent !=None:761 if self.parent is not None: 760 762 self.parent.show_data2d(data, default_name) 761 763 -
src/sas/sasgui/guiframe/local_perspectives/plotting/SectorSlicer.py
rd85c194 r7432acb 144 144 data = self.base.data2D 145 145 # If we have no data, just return 146 if data ==None:146 if data is None: 147 147 return 148 148 ## Averaging … … 151 151 phimin = -self.left_line.phi + self.main_line.theta 152 152 phimax = self.left_line.phi + self.main_line.theta 153 if nbins ==None:153 if nbins is None: 154 154 nbins = 20 155 155 sect = SectorQ(r_min=0.0, r_max=radius, … … 362 362 self.left_moving = left 363 363 theta3 = 0 364 if phi !=None:364 if phi is not None: 365 365 self.phi = phi 366 if delta ==None:366 if delta is None: 367 367 delta = 0 368 368 if right: … … 374 374 self.theta = mline.theta + self.phi 375 375 376 if mline !=None:376 if mline is not None: 377 377 if delta != 0: 378 378 self.theta2 = mline + delta … … 538 538 """ 539 539 540 if theta !=None:540 if theta is not None: 541 541 self.theta = theta 542 542 x1 = self.radius * math.cos(self.theta) -
src/sas/sasgui/guiframe/local_perspectives/plotting/SimplePlot.py
r25b9707a r7432acb 87 87 pos = (pos_x, pos_y + 5) 88 88 self.PopupMenu(slicerpop, pos) 89 if self.scale !=None:89 if self.scale is not None: 90 90 self.parent.scale2d = self.scale 91 91 … … 106 106 self.leftdown = True 107 107 ax = event.inaxes 108 if ax !=None:108 if ax is not None: 109 109 self.xInit, self.yInit = event.xdata, event.ydata 110 110 try: … … 123 123 """ 124 124 self.resizing = False 125 if self.x_size !=None:125 if self.x_size is not None: 126 126 if self.x_size == self.GetSize(): 127 127 self.canvas.set_resizing(self.resizing) … … 161 161 self.plots[plot.name] = plot 162 162 # Axis scales 163 if plot.xtransform !=None:163 if plot.xtransform is not None: 164 164 self.xLabel = plot.xtransform 165 if plot.ytransform !=None:165 if plot.ytransform is not None: 166 166 self.yLabel = plot.ytransform 167 167 # Init graph -
src/sas/sasgui/guiframe/local_perspectives/plotting/SlicerParameters.py
rd85c194 r235f514 46 46 """ 47 47 event.Skip() 48 if event.obj_class ==None:48 if event.obj_class is None: 49 49 self.set_slicer(None, None) 50 50 else: … … 57 57 self.bck.Clear(True) 58 58 self.type = type 59 if type ==None:59 if type is None: 60 60 label = "Right-click on 2D plot for slicer options" 61 61 title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) -
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/local_perspectives/plotting/boxMask.py
rd85c194 r7432acb 123 123 x2=self.vertical_lines.x2, 124 124 width=self.vertical_lines.half_width) 125 # if self.is_inside !=None:125 # if self.is_inside is not None: 126 126 out = self._post_data() 127 127 return out -
src/sas/sasgui/guiframe/local_perspectives/plotting/boxSlicer.py
r9a5097c r7432acb 139 139 140 140 """ 141 if self.direction ==None:141 if self.direction is None: 142 142 self.direction = direction 143 143 … … 147 147 y_max = math.fabs(self.horizontal_lines.y) 148 148 149 if nbins !=None:149 if nbins is not None: 150 150 self.nbins = nbins 151 if self.averager ==None:152 if new_slab ==None:151 if self.averager is None: 152 if new_slab is None: 153 153 msg = "post data:cannot average , averager is empty" 154 154 raise ValueError, msg … … 357 357 """ 358 358 # # Reset x, y- coordinates if send as parameters 359 if x !=None:359 if x is not None: 360 360 self.x = np.sign(self.x) * math.fabs(x) 361 if y !=None:361 if y is not None: 362 362 self.y = np.sign(self.y) * math.fabs(y) 363 363 # # Draw lines and markers … … 464 464 """ 465 465 # # reset x, y -coordinates if given as parameters 466 if x !=None:466 if x is not None: 467 467 self.x = np.sign(self.x) * math.fabs(x) 468 if y !=None:468 if y is not None: 469 469 self.y = np.sign(self.y) * math.fabs(y) 470 470 # # draw lines and markers -
src/sas/sasgui/guiframe/local_perspectives/plotting/boxSum.py
rd85c194 r7432acb 353 353 Draw the new roughness on the graph. 354 354 """ 355 if center_x !=None:355 if center_x is not None: 356 356 self.x = center_x 357 if center_y !=None:357 if center_y is not None: 358 358 self.y = center_y 359 359 self.center_marker.set(xdata=[self.x], ydata=[self.y]) … … 490 490 """ 491 491 # # save the new height, witdh of the rectangle if given as a param 492 if width !=None:492 if width is not None: 493 493 self.half_width = width 494 if height !=None:494 if height is not None: 495 495 self.half_height = height 496 496 # # If new center coordinates are given draw the rectangle 497 497 # #given these value 498 if center !=None:498 if center is not None: 499 499 self.center_x = center.x 500 500 self.center_y = center.y … … 511 511 return 512 512 # # if x1, y1, y2, y3 are given draw the rectangle with this value 513 if x1 !=None:513 if x1 is not None: 514 514 self.x1 = x1 515 if x2 !=None:515 if x2 is not None: 516 516 self.x2 = x2 517 if y1 !=None:517 if y1 is not None: 518 518 self.y1 = y1 519 if y2 !=None:519 if y2 is not None: 520 520 self.y2 = y2 521 521 # # Draw 2 vertical lines and a marker … … 657 657 """ 658 658 # # save the new height, witdh of the rectangle if given as a param 659 if width !=None:659 if width is not None: 660 660 self.half_width = width 661 if height !=None:661 if height is not None: 662 662 self.half_height = height 663 663 # # If new center coordinates are given draw the rectangle 664 664 # #given these value 665 if center !=None:665 if center is not None: 666 666 self.center_x = center.x 667 667 self.center_y = center.y … … 679 679 return 680 680 # # if x1, y1, y2, y3 are given draw the rectangle with this value 681 if x1 !=None:681 if x1 is not None: 682 682 self.x1 = x1 683 if x2 !=None:683 if x2 is not None: 684 684 self.x2 = x2 685 if y1 !=None:685 if y1 is not None: 686 686 self.y1 = y1 687 if y2 !=None:687 if y2 is not None: 688 688 self.y2 = y2 689 689 # # Draw 2 vertical lines and a marker -
src/sas/sasgui/guiframe/local_perspectives/plotting/detector_dialog.py
r8416a02 r7432acb 90 90 zmin = self.reset_zmin_ctl 91 91 zmax = self.reset_zmax_ctl 92 if zmin ==None:92 if zmin is None: 93 93 zmin = "" 94 if zmax ==None:94 if zmax is None: 95 95 zmax = "" 96 96 self.zmin_ctl.SetValue(str(zmin)) … … 155 155 self.qmax_ctl.SetLabel(str(format_number(qmax))) 156 156 self.beam_ctl.SetLabel(str(format_number(beam))) 157 if zmin !=None:157 if zmin is not None: 158 158 self.zmin_ctl.SetValue(str(format_number(zmin))) 159 if zmax !=None:159 if zmax is not None: 160 160 self.zmax_ctl.SetValue(str(format_number(zmax))) 161 161 -
src/sas/sasgui/guiframe/local_perspectives/plotting/masking.py
r9a5097c r45dffa69 100 100 wx.Dialog.__init__(self, parent, id=id, *args, **kwds) 101 101 102 if data !=None:102 if data is not None: 103 103 # Font size 104 104 kwds = [] … … 235 235 event.Skip() 236 236 # from boxMask import BoxMask 237 if event !=None:237 if event is not None: 238 238 self._on_clear_slicer(event) 239 239 self.slicer_z += 1 … … 249 249 Add new mask to old mask 250 250 """ 251 if not self.slicer ==None:251 if self.slicer is not None: 252 252 data = Data2D() 253 253 data = self.data … … 269 269 Erase new mask from old mask 270 270 """ 271 if not self.slicer ==None:271 if self.slicer is not None: 272 272 self.slicer_mask = self.slicer.update() 273 273 mask = self.data.mask … … 307 307 Clear the slicer on the plot 308 308 """ 309 if not self.slicer ==None:309 if self.slicer is not None: 310 310 self.slicer.clear() 311 311 self.subplot.figure.canvas.draw() … … 336 336 """ 337 337 # the case of liitle numbers of True points 338 if len(mask[mask]) < 10 and self.data !=None:338 if len(mask[mask]) < 10 and self.data is not None: 339 339 self.ShowMessage() 340 340 mask = copy.deepcopy(self.mask) … … 355 355 temp_data.data[mask == False] = temp_mask[mask == False] 356 356 self.plotpanel.clear() 357 if self.slicer !=None:357 if self.slicer is not None: 358 358 self.slicer.clear() 359 359 self.slicer = None … … 460 460 wx.Dialog.__init__(self, parent, id=id, *args, **kwds) 461 461 462 if data !=None:462 if data is not None: 463 463 # Font size 464 464 kwds = [] … … 710 710 Status msg 711 711 """ 712 if self.parent.parent.parent !=None:712 if self.parent.parent.parent is not None: 713 713 wx.PostEvent(self.parent.parent.parent, 714 714 StatusEvent(status=msg, type=type)) -
src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py
rca224b1 r235f514 88 88 On Qmin Qmax vertical line event 89 89 """ 90 if event ==None:90 if event is None: 91 91 return 92 92 if event.id in self.plot_panels.keys(): … … 99 99 100 100 def _on_plot_lim(self, event=None): 101 if event ==None:101 if event is None: 102 102 return 103 103 if event.id in self.plot_panels.keys(): -
src/sas/sasgui/guiframe/local_perspectives/plotting/profile_dialog.py
rd85c194 r7432acb 44 44 wx.Dialog.__init__(self, parent, id=id, *args, **kwds) 45 45 46 if data !=None:46 if data is not None: 47 47 #Font size 48 48 kwds = [] … … 284 284 default_name = default_name.split('.')[0] 285 285 default_name += "_out" 286 if self.parent !=None:286 if self.parent is not None: 287 287 # What an ancestor! 288 288 fit_panel = self.parent.parent.parent -
src/sas/sasgui/guiframe/local_perspectives/plotting/sector_mask.py
rd85c194 r7432acb 96 96 self.left_line.update(phi=self.right_line.phi, delta=None, 97 97 mline=self.main_line, side=True, left=False) 98 #if self.is_inside !=None:98 #if self.is_inside is not None: 99 99 out = self._post_data() 100 100 return out … … 117 117 data = self.base.data 118 118 # If we have no data, just return 119 if data ==None:119 if data is None: 120 120 return 121 121 ## Averaging -
src/sas/sasgui/guiframe/local_perspectives/plotting/slicerpanel.py
rd85c194 r7432acb 37 37 self.bck = wx.GridBagSizer(5, 5) 38 38 self.SetSizer(self.bck) 39 if type == None and params ==None:39 if type is None and params is None: 40 40 label = "Right-click on 2D plot for slicer options" 41 41 title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) … … 57 57 """ 58 58 event.Skip() 59 if event.obj_class ==None:59 if event.obj_class is None: 60 60 self.set_slicer(None, None) 61 61 else: … … 68 68 self.bck.Clear(True) 69 69 self.type = type 70 if type ==None:70 if type is None: 71 71 label = "Right-click on 2D plot for slicer options" 72 72 title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) … … 114 114 self.Layout() 115 115 psizer = self.parent.GetSizer() 116 if psizer !=None:116 if psizer is not None: 117 117 psizer.Layout() 118 118 -
src/sas/sasgui/guiframe/media/data_formats_help.rst
r48b8f6d r959eb01 4 4 .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 5 5 .. WG Bouwman, DUT, added during CodeCamp-V in Oct 2016 the SESANS data format 6 .. WG Bouwman, DUT, updated during CodeCamp-VI in Apr 2017 the SESANS data format 6 7 7 8 .. _Formats: … … 82 83 The file format has a list of name-value pairs at the top of the file which detail the general experimental parameters necessary for fitting and analyzing data. This list should contain all the information necessary for the file to be 'portable' between users. 83 84 84 Following the header is a 6column list of instrument experimental variables:85 Following the header is a 8 (only the first 4 are really needed) column list of instrument experimental variables: 85 86 86 87 - Spin echo length (z, in Angstroms) 88 - depolarization (:math:`log(P/P_0)/(lambda^2 * thickness)`, in Angstrom :sup:`-1` cm :sup:`-1`\ ) 89 - depolarization error in the same unit) (measurement error) 87 90 - Spin echo length error (:math:`\Delta`\ z, in Angstroms) (experimental resolution) 88 - Neutron wavelength (:math:`\lambda`, in Angstroms) (essential for ToF instruments)91 - Neutron wavelength (:math:`\lambda`, in Angstroms) 89 92 - Neutron wavelength error (:math:`\Delta \lambda`, in Angstroms) 90 93 - Normalized polarization (:math:`P/P_0`, unitless) … … 93 96 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 94 97 95 .. note:: This help document was last changed by Steve King, 07Oct201698 .. note:: This help document was last changed by Wim Bouwman, 05Apr2017 -
src/sas/sasgui/guiframe/panel_base.py
r18b7ecb9 r235f514 441 441 """ 442 442 """ 443 if self._manager ==None:443 if self._manager is None: 444 444 return None 445 445 return self._manager.frame -
src/sas/sasgui/guiframe/plugin_base.py
rd85c194 r7432acb 161 161 Sets default frame config 162 162 """ 163 if self.frame !=None:163 if self.frame is not None: 164 164 self.frame.EnableCloseButton(False) 165 165 self.frame.Show(False) … … 230 230 old_frame = None 231 231 old_persp = self.parent.get_current_perspective() 232 if old_persp !=None:232 if old_persp is not None: 233 233 old_frame = old_persp.get_frame() 234 234 self.parent.check_multimode(self) … … 236 236 self.parent.set_perspective(self.perspective) 237 237 238 if self.frame !=None:239 if old_frame !=None:238 if self.frame is not None: 239 if old_frame is not None: 240 240 pos_x, pos_y = old_frame.GetPositionTuple() 241 241 self.frame.SetPosition((pos_x, pos_y)) -
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 -
src/sas/sasgui/guiframe/startup_configuration.py
r73cbeec r7432acb 129 129 width, _ = panel.frame.GetSizeTuple() 130 130 if panel.frame.IsShown(): 131 if p_size ==None or width > p_size:131 if p_size is None or width > p_size: 132 132 p_size = width 133 if p_size ==None:133 if p_size is None: 134 134 p_size = CURRENT_STRINGS['PLOPANEL_WIDTH'] 135 135 self.current_string['PLOPANEL_WIDTH'] = p_size … … 145 145 146 146 data_pw, _ = self.parent.panels["data_panel"].frame.GetSizeTuple() 147 if data_pw ==None:147 if data_pw is None: 148 148 data_pw = CURRENT_STRINGS['DATAPANEL_WIDTH'] 149 149 self.current_string['DATAPANEL_WIDTH'] = data_pw … … 208 208 for key, item in strings.iteritems(): 209 209 if (key == 'DEFAULT_PERSPECTIVE') or \ 210 (key == 'DEFAULT_OPEN_FOLDER' and item !=None):210 (key == 'DEFAULT_OPEN_FOLDER' and item is not None): 211 211 out_f.write("%s = \"%s\"\n" % (key,str(item))) 212 212 else: -
src/sas/sasgui/guiframe/utils.py
ra0373d5 r7432acb 89 89 list = [] 90 90 for item in mylist: 91 if re.search(separator,item) !=None:91 if re.search(separator,item)is not None: 92 92 if n > 0: 93 93 word = re.split(separator, item, int(n))
Note: See TracChangeset
for help on using the changeset viewer.