Changeset 278ddee in sasview for src/sas/sasgui/guiframe


Ignore:
Timestamp:
Apr 11, 2017 9:51:05 AM (8 years ago)
Author:
krzywon
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)
Message:

Merge branch 'master' into ticket-876

# Conflicts:
# src/sas/sascalc/dataloader/readers/ascii_reader.py
# src/sas/sascalc/dataloader/readers/xml_reader.py

Location:
src/sas/sasgui/guiframe
Files:
35 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/CategoryInstaller.py

    rddbac66 r235f514  
    1616 
    1717USER_FILE = 'categories.json' 
     18 
     19logger = logging.getLogger(__name__) 
    1820 
    1921class CategoryInstaller: 
     
    114116    @staticmethod 
    115117    def get_default_file(): 
    116         logging.warning("CategoryInstaller.get_default_file is deprecated.") 
     118        logger.warning("CategoryInstaller.get_default_file is deprecated.") 
    117119 
    118120    @staticmethod 
     
    130132 
    131133        serialized_file = None 
    132         if homedir == None: 
     134        if homedir is None: 
    133135            serialized_file = CategoryInstaller.get_user_file() 
    134136        else: 
     
    153155                        model_enabled_dict.pop(model_name) 
    154156                    except: 
    155                         logging.error("CategoryInstaller: %s", sys.exc_value) 
     157                        logger.error("CategoryInstaller: %s", sys.exc_value) 
    156158                else: 
    157159                    add_list.remove(model_name) 
  • src/sas/sasgui/guiframe/CategoryManager.py

    r212bfc2 r463e7ffc  
    2020from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 
    2121IS_MAC = (sys.platform == 'darwin') 
     22 
     23logger = logging.getLogger(__name__) 
    2224 
    2325""" Notes 
     
    373375                    self.master_category_dict = json.load(f) 
    374376        except IOError: 
    375             logging.error('Problem reading in category file.') 
     377            logger.error('Problem reading in category file.') 
    376378 
    377379        self._regenerate_model_dict() 
  • src/sas/sasgui/guiframe/config.py

    r1779e72 rea45bfe  
    77import sas.sasview 
    88import logging 
     9 
     10 
     11logger = logging.getLogger(__name__) 
    912 
    1013# Version of the application 
     
    4649 
    4750_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: https://github.com/orgs/SasView/people 
     51'''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 
    4952''' 
    5053 
     
    5760 
    5861icon_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "images")) 
    59 logging.info("icon path: %s" % icon_path) 
     62logger.info("icon path: %s" % icon_path) 
    6063media_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "media")) 
    6164test_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "test")) 
  • src/sas/sasgui/guiframe/dataFitting.py

    r9a5097c r7432acb  
    7878        result.clone_without_data(length=len(self.x), clone=self) 
    7979        result.copy_from_datainfo(data1d=self) 
    80         if self.dxw == None: 
     80        if self.dxw is None: 
    8181            result.dxw = None 
    8282        else: 
    8383            result.dxw = np.zeros(len(self.x)) 
    84         if self.dxl == None: 
     84        if self.dxl is None: 
    8585            result.dxl = None 
    8686        else: 
     
    125125        tot_length = len(self.x) + len(other.x) 
    126126        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: 
    128128            result.dlam = None 
    129129        else: 
    130130            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: 
    132132            result.dy = None 
    133133        else: 
    134134            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: 
    136136            result.dx = None 
    137137        else: 
    138138            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: 
    140140            result.dxw = None 
    141141        else: 
    142142            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: 
    144144            result.dxl = None 
    145145        else: 
     
    154154        result.lam = np.append(self.lam, other.lam) 
    155155        result.lam = result.lam[ind] 
    156         if result.dlam != None: 
     156        if result.dlam is not None: 
    157157            result.dlam = np.append(self.dlam, other.dlam) 
    158158            result.dlam = result.dlam[ind] 
    159         if result.dy != None: 
     159        if result.dy is not None: 
    160160            result.dy = np.append(self.dy, other.dy) 
    161161            result.dy = result.dy[ind] 
     
    227227        result = self.clone_without_data(len(self.x)) 
    228228        result.copy_from_datainfo(data1d=self) 
    229         if self.dxw == None: 
     229        if self.dxw is None: 
    230230            result.dxw = None 
    231231        else: 
    232232            result.dxw = np.zeros(len(self.x)) 
    233         if self.dxl == None: 
     233        if self.dxl is None: 
    234234            result.dxl = None 
    235235        else: 
     
    279279        tot_length = len(self.x)+len(other.x) 
    280280        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: 
    282282            result.dlam = None 
    283283        else: 
    284284            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: 
    286286            result.dy = None 
    287287        else: 
    288288            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: 
    290290            result.dx = None 
    291291        else: 
    292292            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: 
    294294            result.dxw = None 
    295295        else: 
    296296            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: 
    298298            result.dxl = None 
    299299        else: 
     
    307307        result.lam = np.append(self.lam, other.lam) 
    308308        result.lam = result.lam[ind] 
    309         if result.dy != None: 
     309        if result.dy is not None: 
    310310            result.dy = np.append(self.dy, other.dy) 
    311311            result.dy = result.dy[ind] 
     
    405405        result.ymin = self.ymin 
    406406        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: 
    408408            result.dqx_data = None 
    409409            result.dqy_data = None 
     
    468468        result.ymin = self.ymin 
    469469        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 : 
    472472            result.dqx_data = None 
    473473            result.dqy_data = None 
  • src/sas/sasgui/guiframe/data_manager.py

    r2ffe241 r959eb01  
    2525from sas.sasgui.guiframe.dataFitting import Data2D 
    2626import time 
     27 
     28logger = logging.getLogger(__name__) 
    2729 
    2830class DataManager(object): 
     
    136138                msg = "Data manager already stores %s" % str(data.name) 
    137139                msg += "" 
    138                 logging.info(msg) 
     140                logger.info(msg) 
    139141                data_state = self.stored_data[id] 
    140142                data_state.data = data 
  • src/sas/sasgui/guiframe/data_processor.py

    r9a5097c r7432acb  
    1818 
    1919""" 
    20 import wx 
    21 import numpy 
    22 import math 
    23 import re 
    2420import os 
    2521import sys 
    2622import copy 
    27 from wx.lib.scrolledpanel import ScrolledPanel 
     23import math 
     24import re 
     25import wx 
     26import numpy as np 
     27 
    2828import wx.aui 
    2929from wx.aui import AuiNotebook as nb 
    3030import wx.lib.sheet as sheet 
     31from wx.lib.scrolledpanel import ScrolledPanel 
     32 
    3133from sas.sasgui.guiframe.panel_base import PanelBase 
    3234from sas.sasgui.guiframe.events import NewPlotEvent 
     
    313315        if row > self.max_row_touse: 
    314316            self.max_row_touse = row 
    315         if self.data == None: 
     317        if self.data is None: 
    316318            self.data = {} 
    317319        event.Skip() 
     
    812814        """ 
    813815 
    814         if self.data == None: 
     816        if self.data is None: 
    815817            self.data = {} 
    816         if self.file_name == None: 
     818        if self.file_name is None: 
    817819            self.file_name = 'copied_data' 
    818820        self.Paste() 
     
    10151017                            if index - 1 >= 0: 
    10161018                                new_row, _ = temp_list[index - 1] 
    1017                                 if not new_row == None and new_row != ' ': 
     1019                                if new_row is not None and new_row != ' ': 
    10181020                                    label += create_label(col_name, None, 
    10191021                                                          int(new_row) + 1) 
     
    10231025                            if index + 1 < len(temp_list): 
    10241026                                new_row, _ = temp_list[index + 1] 
    1025                                 if not new_row == None: 
     1027                                if new_row is not None: 
    10261028                                    label += create_label(col_name, 
    10271029                                                          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: 
    10291031                        if index == 0: 
    10301032                            label += create_label(col_name, 
     
    10831085 
    10841086        # Let's re-order the data from the keys in 'Data' name. 
    1085         if outputs == None: 
     1087        if outputs is None: 
    10861088            return 
    10871089        try: 
     
    13721374            wx.PostEvent(self.parent.parent, StatusEvent(status=msg, info="error")) 
    13731375            return 
    1374         if dy != None and (len(y) != len(dy)): 
     1376        if dy is not None and (len(y) != len(dy)): 
    13751377            msg = "Need same length for Y and dY axis and both greater than 0" 
    13761378            msg += " to plot.\n" 
     
    13781380            wx.PostEvent(self.parent.parent, StatusEvent(status=msg, info="error")) 
    13791381            return 
    1380         if dy == None: 
     1382        if dy is None: 
    13811383            dy = np.zeros(len(y)) 
    13821384        #plotting 
     
    14391441            col = column_names[col_name] 
    14401442            axis = self.get_plot_axis(col, list) 
    1441             if axis == None: 
     1443            if axis is None: 
    14421444                return None 
    14431445            sentence = sentence.replace(tok, "numpy.array(%s)" % str(axis)) 
     
    15701572        """ 
    15711573 
    1572         if label != None: 
     1574        if label is not None: 
    15731575            tcrtl_label.SetValue(str(label)) 
    1574         if title != None: 
     1576        if title is not None: 
    15751577            tcrtl_title.SetValue(str(title)) 
    15761578 
     
    16831685        # I Believe this is no longer used now that we have removed the  
    16841686        # edit menu from the menubar - PDB July 12, 2015 
    1685         if event != None: 
     1687        if event is not None: 
    16861688            event.Skip() 
    16871689        pos = self.panel.notebook.GetSelection() 
     
    16951697        # I Believe this is no longer used now that we have removed the  
    16961698        # edit menu from the menubar - PDB July 12, 2015 
    1697         if event != None: 
     1699        if event is not None: 
    16981700            event.Skip() 
    16991701        pos = self.panel.notebook.GetSelection() 
     
    17371739            pos = self.panel.notebook.GetSelection() 
    17381740            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 != {}) 
    17401742            self.open_excel_menu.Enable(has_data) 
    17411743            self.save_menu.Enable(has_data) 
     
    18201822                    path = dlg.GetPath() 
    18211823                dlg.Destroy() 
    1822                 if path != None: 
     1824                if path is not None: 
    18231825                    if self.parent is not None: 
    18241826                        data = grid.get_grid_view() 
     
    20052007                    path = dlg.GetPath() 
    20062008                dlg.Destroy() 
    2007                 if path != None: 
     2009                if path is not None: 
    20082010                    if self.parent is not None and  self.data is not None: 
    20092011                        self.parent.write_batch_tofile(data=self.data, 
  • src/sas/sasgui/guiframe/documentation_window.py

    rd85c194 r959eb01  
    2020import urllib 
    2121import sys 
     22 
     23logger = logging.getLogger(__name__) 
    2224 
    2325SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 
     
    7173 
    7274        if not os.path.exists(file_path): 
    73             logging.error("Could not find Sphinx documentation at %s \ 
     75            logger.error("Could not find Sphinx documentation at %s \ 
    7476            -- has it been built?", file_path) 
    7577        elif WX_SUPPORTS_HTML2: 
     
    7981            self.Show() 
    8082        else: 
    81             logging.error("No html2 support, popping up a web browser") 
     83            logger.error("No html2 support, popping up a web browser") 
    8284            #For cases that do not build against current version dependency 
    8385            # Wx 3.0 we provide a webbrowser call - this is particularly for 
  • src/sas/sasgui/guiframe/gui_manager.py

    r73cbeec r38beeab  
    4848from matplotlib import _pylab_helpers 
    4949 
     50logger = logging.getLogger(__name__) 
     51 
    5052warnings.simplefilter("ignore") 
    51  
    5253 
    5354def get_app_dir(): 
     
    6465    if os.path.isfile(os.path.join(app_path, "custom_config.py")): 
    6566        app_path = os.path.abspath(app_path) 
    66         logging.info("Using application path: %s", app_path) 
     67        logger.info("Using application path: %s", app_path) 
    6768        return app_path 
    6869 
    6970    # Next, try the current working directory 
    7071    if os.path.isfile(os.path.join(os.getcwd(), "custom_config.py")): 
    71         logging.info("Using application path: %s", os.getcwd()) 
     72        logger.info("Using application path: %s", os.getcwd()) 
    7273        return os.path.abspath(os.getcwd()) 
    7374 
     
    7677    # clean all these module variables and put them into a config class 
    7778    # that can be passed by sasview.py. 
    78     logging.info(sys.executable) 
    79     logging.info(str(sys.argv)) 
     79    logger.debug(sys.executable) 
     80    logger.debug(str(sys.argv)) 
    8081    from sas import sasview as sasview 
    8182    app_path = os.path.dirname(sasview.__file__) 
    82     logging.info("Using application path: %s", app_path) 
     83    logger.debug("Using application path: %s", app_path) 
    8384    return app_path 
    8485 
     
    104105        config_module = imp.load_module(file, fObj, path_config, descr) 
    105106    except: 
    106         logging.error("Error loading %s/%s: %s" % (path, file, sys.exc_value)) 
     107        logger.error("Error loading %s/%s: %s" % (path, file, sys.exc_value)) 
    107108    finally: 
    108109        if fObj is not None: 
    109110            fObj.close() 
    110     logging.info("GuiManager loaded %s/%s" % (path, file)) 
     111    logger.debug("GuiManager loaded %s/%s" % (path, file)) 
    111112    return config_module 
    112113 
     
    125126        # Didn't find local config, load the default 
    126127        import sas.sasgui.guiframe.config as config 
    127         logging.info("using default local_config") 
     128        logger.debug("using default local_config") 
    128129    else: 
    129         logging.info("found local_config in %s" % os.getcwd()) 
     130        logger.debug("found local_config in %s" % os.getcwd()) 
    130131else: 
    131     logging.info("found local_config in %s" % PATH_APP) 
     132    logger.debug("found local_config in %s" % PATH_APP) 
    132133 
    133134from sas.sasgui.guiframe.customdir import SetupCustom 
     
    138139    if custom_config is None: 
    139140        msgConfig = "Custom_config file was not imported" 
    140         logging.info(msgConfig) 
     141        logger.debug(msgConfig) 
    141142    else: 
    142         logging.info("using custom_config in %s" % os.getcwd()) 
     143        logger.debug("using custom_config in %s" % os.getcwd()) 
    143144else: 
    144     logging.info("using custom_config from %s" % c_conf_dir) 
     145    logger.debug("using custom_config from %s" % c_conf_dir) 
    145146 
    146147# read some constants from config 
     
    374375                    frame.SetIcon(icon) 
    375376                except: 
    376                     logging.error("ViewerFrame.put_icon: could not set icon") 
     377                    logger.error("ViewerFrame.put_icon: could not set icon") 
    377378 
    378379    def get_client_size(self): 
     
    803804                                                str(self._input_file)) 
    804805            msg += str(sys.exc_value) + '\n' 
    805             logging.error(msg) 
     806            logger.error(msg) 
    806807        if self._data_panel is not None and len(self.plugins) > 0: 
    807808            self._data_panel.fill_cbox_analysis(self.plugins) 
     
    869870            if plugin.__class__ == item.__class__: 
    870871                msg = "Plugin %s already loaded" % plugin.sub_menu 
    871                 logging.info(msg) 
     872                logger.info(msg) 
    872873                is_loaded = True 
    873874        if not is_loaded: 
    874875            self.plugins.append(plugin) 
    875876            msg = "Plugin %s appended" % plugin.sub_menu 
    876             logging.info(msg) 
     877            logger.info(msg) 
    877878 
    878879    def _get_local_plugins(self): 
     
    894895                msg = "ViewerFrame._get_local_plugins:" 
    895896                msg += "cannot import dataloader plugin.\n %s" % sys.exc_value 
    896                 logging.error(msg) 
     897                logger.error(msg) 
    897898        if style2 == GUIFRAME.PLOTTING_ON: 
    898899            try: 
     
    904905                msg = "ViewerFrame._get_local_plugins:" 
    905906                msg += "cannot import plotting plugin.\n %s" % sys.exc_value 
    906                 logging.error(msg) 
     907                logger.error(msg) 
    907908 
    908909        return plugins 
     
    949950                                plugins.append(module.Plugin()) 
    950951                                msg = "Found plug-in: %s" % module.PLUGIN_ID 
    951                                 logging.info(msg) 
     952                                logger.info(msg) 
    952953                            except: 
    953954                                msg = "Error accessing PluginPanel" 
     
    956957                    except: 
    957958                        msg = "ViewerFrame._find_plugins: %s" % sys.exc_value 
    958                         logging.error(msg) 
     959                        logger.error(msg) 
    959960                    finally: 
    960961                        if file is not None: 
     
    963964            # Should raise and catch at a higher level and 
    964965            # display error on status bar 
    965             logging.error(sys.exc_value) 
     966            logger.error(sys.exc_value) 
    966967 
    967968        return plugins 
     
    13851386 
    13861387        if config._do_aboutbox: 
    1387             logging.info("Doing help menu") 
     1388            logger.info("Doing help menu") 
    13881389            wx_id = wx.NewId() 
    13891390            self._help_menu.Append(wx_id, '&About', 'Software information') 
     
    17461747                del self.panels[ID] 
    17471748        else: 
    1748             logging.error("delete_panel: No such plot id as %s" % ID) 
     1749            logger.error("delete_panel: No such plot id as %s" % ID) 
    17491750 
    17501751    def create_gui_data(self, data, path=None): 
     
    17631764            log_msg += "load: %s\n" % str(basename) 
    17641765            log_msg += "Try Data opening...." 
    1765             logging.error(log_msg) 
     1766            logger.error(log_msg) 
    17661767            return 
    17671768 
     
    18431844            log_msg += "load: %s\n" % str(path) 
    18441845            log_msg += "Try File opening ...." 
    1845             logging.error(log_msg) 
     1846            logger.error(log_msg) 
    18461847            return 
    18471848        log_msg = '' 
     
    18491850        error_message = "" 
    18501851        try: 
    1851             logging.info("Loading Data...:\n" + str(path) + "\n") 
     1852            logger.info("Loading Data...:\n" + str(path) + "\n") 
    18521853            temp = self.loader.load(path) 
    18531854            if temp.__class__.__name__ == "list": 
     
    18641865            error_message += " Data from cmd:\n %s\n" % str(path) 
    18651866            error_message += str(sys.exc_value) + "\n" 
    1866             logging.error(error_message) 
     1867            logger.error(error_message) 
    18671868 
    18681869    def load_folder(self, path): 
     
    18851886            error_message += " Data folder from cmd:\n %s\n" % str(path) 
    18861887            error_message += str(sys.exc_value) + "\n" 
    1887             logging.error(error_message) 
     1888            logger.error(error_message) 
    18881889 
    18891890    def _on_open_state_application(self, event): 
     
    20442045                msg += "and model selected. " 
    20452046                msg += "No project was saved to %s" % (str(path)) 
    2046                 logging.warning(msg) 
     2047                logger.warning(msg) 
    20472048                wx.PostEvent(self, StatusEvent(status=msg, info="error")) 
    20482049        except Exception: 
     
    21112112        #IF SAS_OPENCL is set, settings are stored in the custom config file 
    21122113        self._write_opencl_config_file() 
    2113         logging.info(" --- SasView session was closed --- \n") 
     2114        logger.info(" --- SasView session was closed --- \n") 
    21142115        wx.Exit() 
    21152116        sys.exit() 
     
    21212122        """ 
    21222123        if custom_config is not None: 
    2123             sas_opencl = os.environ.get("SAS_OPENCL",None) 
     2124            sas_opencl = os.environ.get("SAS_OPENCL") 
    21242125            new_config_lines = [] 
    21252126            config_file = open(custom_config.__file__) 
     
    21402141            new_config_file.close() 
    21412142        else: 
    2142             logging.info("Failed to save OPENCL settings in custom config file") 
     2143            logger.info("Failed to save OPENCL settings in custom config file") 
    21432144 
    21442145 
     
    21552156        if response is not None: 
    21562157            try: 
    2157                 #  
    21582158                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) 
    21612160                version_info = json.loads(content) 
    21622161            except: 
    2163                 logging.info("Failed to connect to www.sasview.org") 
     2162                logger.info("Failed to connect to www.sasview.org") 
    21642163        self._process_version(version_info, standalone=event is None) 
    21652164 
     
    22012200            msg = "guiframe: could not get latest application" 
    22022201            msg += " version number\n  %s" % sys.exc_value 
    2203             logging.error(msg) 
     2202            logger.error(msg) 
    22042203            if not standalone: 
    22052204                msg = "Could not connect to the application server." 
     
    22482247                    dialog.Show(True) 
    22492248                except: 
    2250                     logging.error("Error in _onTutorial: %s" % sys.exc_value) 
     2249                    logger.error("Error in _onTutorial: %s" % sys.exc_value) 
    22512250                    try: 
    22522251                        # Try an alternate method 
    2253                         logging.error( 
     2252                        logger.error( 
    22542253                            "Could not open the tutorial pdf, trying xhtml2pdf") 
    22552254                        from xhtml2pdf import pisa 
    22562255                        pisa.startViewer(path) 
    22572256                    except: 
    2258                         logging.error( 
     2257                        logger.error( 
    22592258                            "Could not open the tutorial pdf with xhtml2pdf") 
    22602259                        msg = "This feature requires 'PDF Viewer'\n" 
     
    22672266                    try: 
    22682267                        # Try an alternate method 
    2269                         logging.error( 
     2268                        logger.error( 
    22702269                            "Could not open the tutorial pdf, trying xhtml2pdf") 
    22712270                        from xhtml2pdf import pisa 
    22722271                        pisa.startViewer(path) 
    22732272                    except: 
    2274                         logging.error( 
     2273                        logger.error( 
    22752274                            "Could not open the tutorial pdf with xhtml2pdf") 
    22762275                        msg = "This feature requires the Preview application\n" 
     
    24112410        else: 
    24122411            msg = "Guiframe does not have a current perspective" 
    2413             logging.info(msg) 
     2412            logger.info(msg) 
    24142413 
    24152414    def set_theory(self, state_id, theory_id=None): 
     
    24222421            except: 
    24232422                msg = "Guiframe set_theory: \n" + str(sys.exc_value) 
    2424                 logging.info(msg) 
     2423                logger.info(msg) 
    24252424                wx.PostEvent(self, StatusEvent(status=msg, info="error")) 
    24262425        else: 
    24272426            msg = "Guiframe does not have a current perspective" 
    2428             logging.info(msg) 
     2427            logger.info(msg) 
    24292428 
    24302429    def plot_data(self, state_id, data_id=None, 
     
    25082507                                            action='remove')) 
    25092508        except: 
    2510             logging.error(sys.exc_value) 
     2509            logger.error(sys.exc_value) 
    25112510 
    25122511    def save_data1d(self, data, fname): 
     
    33063305            msg = "%s Could not load " % str(APPLICATION_NAME) 
    33073306            msg += "input file from command line.\n" 
    3308             logging.error(msg) 
     3307            logger.error(msg) 
    33093308        # Display a splash screen on top of the frame. 
    33103309        try: 
     
    33203319            msg = "Cannot display splash screen\n" 
    33213320            msg += str(sys.exc_value) 
    3322             logging.error(msg) 
     3321            logger.error(msg) 
    33233322            self.frame.Show() 
    33243323 
     
    33753374                            os.remove(file_path) 
    33763375                except: 
    3377                     logging.error("gui_manager.clean_plugin_models:\n  %s" 
     3376                    logger.error("gui_manager.clean_plugin_models:\n  %s" 
    33783377                                  % sys.exc_value) 
    33793378 
  • src/sas/sasgui/guiframe/gui_statusbar.py

    r3a22ce7 r463e7ffc  
    1212from sas.sasgui.guiframe.gui_style import GUIFRAME_ICON 
    1313 
     14logger = logging.getLogger(__name__) 
     15 
    1416# Number of fields on the status bar 
    1517NB_FIELDS = 4 
     
    7173            icon_type = event.info.lower() 
    7274            if icon_type == "warning": 
    73                 logging.warning(status) 
     75                logger.warning(status) 
    7476                color = (0, 0, 255) # blue 
    7577                icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_WARNING, 
    7678                                                    wx.ART_TOOLBAR) 
    7779            if icon_type == "error": 
    78                 logging.error(status) 
     80                logger.error(status) 
    7981                color = (255, 0, 0) # red 
    8082                icon_bmp = wx.ArtProvider.GetBitmap(wx.ART_ERROR, 
  • src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py

    r7f75a3f r278ddee  
    77import wx 
    88import logging 
     9 
     10logger = logging.getLogger(__name__) 
    911 
    1012from sas.sascalc.dataloader.loader import Loader 
     
    7375        path = None 
    7476        self._default_save_location = self.parent._default_save_location 
    75         if self._default_save_location == None: 
     77        if self._default_save_location is None: 
    7678            self._default_save_location = os.getcwd() 
    7779 
     
    9092        if dlg.ShowModal() == wx.ID_OK: 
    9193            file_list = dlg.GetPaths() 
    92             if len(file_list) >= 0 and not file_list[0] is None: 
     94            if len(file_list) >= 0 and file_list[0] is not None: 
    9395                self._default_save_location = os.path.dirname(file_list[0]) 
    9496                path = self._default_save_location 
     
    160162                message += "\tError: {0}\n".format(error_data) 
    161163        else: 
    162             logging.error("Loader returned an invalid object:\n %s" % str(item)) 
     164            logger.error("Loader returned an invalid object:\n %s" % str(item)) 
    163165            data_error = True 
    164166 
     
    191193                log_msg += "Please try to open that file from \"open project\"" 
    192194                log_msg += "or \"open analysis\" menu." 
    193                 logging.info(log_msg) 
     195                logger.info(log_msg) 
    194196                file_errors[basename] = [log_msg] 
    195197                continue 
     
    227229                                   info="warning") 
    228230            except: 
    229                 logging.error(sys.exc_value) 
     231                logger.error(sys.exc_value) 
    230232 
    231233                error_message = "The Data file you selected could not be " 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/AnnulusSlicer.py

    rd85c194 r7432acb  
    122122        data = self.base.data2D 
    123123        # If we have no data, just return 
    124         if data == None: 
     124        if data is None: 
    125125            return 
    126126 
     
    132132        # if the user does not specify the numbers of points to plot 
    133133        # the default number will be nbins= 36 
    134         if nbins == None: 
     134        if nbins is None: 
    135135            self.nbins = 36 
    136136        else: 
     
    498498        # Update locations 
    499499        self.outer_circle.update() 
    500         # if self.is_inside != None: 
     500        # if self.is_inside is not None: 
    501501        out = self._post_data() 
    502502        return out 
     
    521521 
    522522        # If we have no data, just return 
    523         if data == None: 
     523        if data is None: 
    524524            return 
    525525        mask = data.mask 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Arc.py

    rd85c194 r7432acb  
    7171        x = [] 
    7272        y = [] 
    73         if theta1 != None: 
     73        if theta1 is not None: 
    7474            self.theta1 = theta1 
    75         if theta2 != None: 
     75        if theta2 is not None: 
    7676            self.theta2 = theta2 
    7777        while self.theta2 < self.theta1: 
     
    8181        npts = int((self.theta2 - self.theta1) / (math.pi / 120)) 
    8282 
    83         if r == None: 
     83        if r is None: 
    8484            self.radius = math.sqrt(math.pow(self._mouse_x, 2) + \ 
    8585                                     math.pow(self._mouse_y, 2)) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Edge.py

    rd85c194 r7432acb  
    6363        Draw the new roughness on the graph. 
    6464        """ 
    65         if r1 != None: 
     65        if r1 is not None: 
    6666            self.r1 = r1 
    67         if r2 != None: 
     67        if r2 is not None: 
    6868            self.r2 = r2 
    69         if theta != None: 
     69        if theta is not None: 
    7070            self.theta = theta 
    7171        x1 = self.r1 * math.cos(self.theta) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py

    r9a5097c r7432acb  
    2424from appearanceDialog import appearanceDialog 
    2525from graphAppearance import graphAppearance 
     26 
     27logger = logging.getLogger(__name__) 
    2628 
    2729DEFAULT_QMAX = 0.05 
     
    181183        # So manually recode the size (=x_size) and compare here. 
    182184        # Massy code to work around:< 
    183         if self.parent._mgr != None: 
     185        if self.parent._mgr is not None: 
    184186            max_panel = self.parent._mgr.GetPane(self) 
    185187            if max_panel.IsMaximized(): 
    186188                self.parent._mgr.RestorePane(max_panel) 
    187189                max_panel.Maximize() 
    188         if self.x_size != None: 
     190        if self.x_size is not None: 
    189191            if self.x_size == self.GetSize(): 
    190192                self.resizing = False 
     
    210212        On Qmin Qmax vertical line event 
    211213        """ 
    212         if event == None: 
     214        if event is None: 
    213215            return 
    214216        event.Skip() 
    215217        active_ctrl = event.active 
    216         if active_ctrl == None: 
     218        if active_ctrl is None: 
    217219            return 
    218220        if hasattr(event, 'is_corfunc'): 
     
    229231                colors.append('purple') 
    230232                values.append(min(x_data.max(), float(ctrl[2].GetValue()))) 
    231             if self.ly == None: 
     233            if self.ly is None: 
    232234                self.ly = [] 
    233235                for c, v in zip(colors, values): 
     
    239241                xval = float(active_ctrl.GetValue()) 
    240242                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: 
    242244                    wx.PostEvent(self.parent, StatusEvent(status=position)) 
    243245            except: 
    244                 logging.error(sys.exc_value) 
     246                logger.error(sys.exc_value) 
    245247            if not event.leftdown: 
    246248                # text event 
     
    255257                        self.canvas.draw() 
    256258                except: 
    257                     logging.error(sys.exc_value) 
     259                    logger.error(sys.exc_value) 
    258260                event.Skip() 
    259261                return 
     
    334336        if hasattr(event, "action"): 
    335337            dclick = event.action == 'dclick' 
    336             if ax == None or dclick: 
     338            if ax is None or dclick: 
    337339                # remove the vline 
    338340                self._check_zoom_plot() 
     
    340342                self.q_ctrl = None 
    341343                return 
    342         if self.ly != None and event.xdata != None: 
     344        if self.ly is not None and event.xdata is not None: 
    343345            # Selecting a new line if cursor lines are displayed already 
    344346            dqmin = math.fabs(event.xdata - self.ly[0].get_xdata()) 
     
    359361        Move the cursor line to write Q range 
    360362        """ 
    361         if self.q_ctrl == None: 
     363        if self.q_ctrl is None: 
    362364            return 
    363365        # 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: 
    365367            for ly in self.ly: 
    366368                ly.set_alpha(0.7) 
     
    368370            return 
    369371        ax = event.inaxes 
    370         if ax == None or not hasattr(event, 'action'): 
     372        if ax is None or not hasattr(event, 'action'): 
    371373            return 
    372         end_drag = event.action != 'drag' and event.xdata != None 
     374        end_drag = event.action != 'drag' and event.xdata is not None 
    373375        nop = len(self.plots) 
    374376        pos_x, _ = float(event.xdata), float(event.ydata) 
     
    409411            self.q_ctrl[vl_ind].SetValue(str(pos_x)) 
    410412        except: 
    411             logging.error(sys.exc_value) 
     413            logger.error(sys.exc_value) 
    412414 
    413415    def set_resizing(self, resizing=False): 
     
    512514        ax = event.inaxes 
    513515        PlotPanel.onLeftDown(self, event) 
    514         if ax != None: 
     516        if ax is not None: 
    515517            try: 
    516518                pos_x = float(event.xdata)  # / size_x 
     
    616618            # add menu of other plugins 
    617619            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)): 
    619621                for item, wx_id in zip(item_list, [ids.next() for i in range(len(item_list))]): 
    620  
    621622                    try: 
    622623                        plot_menu.Append(wx_id, item[0], name) 
     
    682683 
    683684 
    684         if self.position != None: 
     685        if self.position is not None: 
    685686            wx_id = ids.next() 
    686687            self._slicerpop.Append(wx_id, '&Add Text') 
     
    759760            default_name = default_name.split('.')[0] 
    760761        default_name += "_out" 
    761         if self.parent != None: 
     762        if self.parent is not None: 
    762763            self.parent.save_data1d(data, default_name) 
    763764 
     
    777778            default_name = default_name.split('.')[0] 
    778779        # default_name += "_out" 
    779         if self.parent != None: 
     780        if self.parent is not None: 
    780781            self.parent.show_data1d(data, default_name) 
    781782 
     
    809810        curr_label = self.appearance_selected_plot.label 
    810811 
    811         if curr_color == None: 
     812        if curr_color is None: 
    812813            curr_color = self._color_labels['Blue'] 
    813814            curr_symbol = 13 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py

    r9a5097c r7432acb  
    3030from graphAppearance import graphAppearance 
    3131(InternalEvent, EVT_INTERNAL) = wx.lib.newevent.NewEvent() 
     32 
     33logger = logging.getLogger(__name__) 
    3234 
    3335DEFAULT_QMAX = 0.05 
     
    142144        """ 
    143145        # Not implemented 
    144         if event == None: 
     146        if event is None: 
    145147            return 
    146148        event.Skip() 
     
    154156        PlotPanel.onLeftDown(self, event) 
    155157        ax = event.inaxes 
    156         if ax != None: 
     158        if ax is not None: 
    157159            # data coordinate position 
    158160            pos_x = "%8.3g" % event.xdata 
     
    225227        if self._is_changed_legend_label: 
    226228            data.label = self.title_label 
    227         if data.label == None: 
     229        if data.label is None: 
    228230            data.label = data.name 
    229231        if not self.title_font: 
     
    262264        # control axis labels from the panel itself 
    263265        yname, yunits = data.get_yaxis() 
    264         if self.yaxis_label != None: 
     266        if self.yaxis_label is not None: 
    265267            yname = self.yaxis_label 
    266268            yunits = self.yaxis_unit 
     
    269271            self.yaxis_unit = yunits 
    270272        xname, xunits = data.get_xaxis() 
    271         if self.xaxis_label != None: 
     273        if self.xaxis_label is not None: 
    272274            xname = self.xaxis_label 
    273275            xunits = self.xaxis_unit 
     
    318320        if len(self.data2D.detector) <= 1: 
    319321            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'): 
    322324                for item, wx_id in zip(item_list, [ids.next() for i in range(len(item_list))]): 
    323325                    try: 
     
    353355            slicerpop.Append(wx_id, '&Box Averaging in Qy') 
    354356            wx.EVT_MENU(self, wx_id, self.onBoxavgY) 
    355             if self.slicer != None: 
     357            if self.slicer is not None: 
    356358                wx_id = ids.next() 
    357359                slicerpop.Append(wx_id, '&Clear Slicer') 
     
    432434            except: 
    433435                msg = "Add Text: Error. Check your property values..." 
    434                 logging.error(msg) 
    435                 if self.parent != None: 
     436                logger.error(msg) 
     437                if self.parent is not None: 
    436438                    wx.PostEvent(self.parent, StatusEvent(status=msg)) 
    437439        dial.Destroy() 
     
    531533        """ 
    532534        ## Clear current slicer 
    533         if not self.slicer == None: 
     535        if self.slicer is not None: 
    534536            self.slicer.clear() 
    535537        ## Create a new slicer 
     
    627629 
    628630        """ 
    629         if self.slicer != None: 
     631        if self.slicer is not None: 
    630632            from SlicerParameters import SlicerParameterPanel 
    631633            dialog = SlicerParameterPanel(self, -1, "Slicer Parameters") 
     
    717719        Clear the slicer on the plot 
    718720        """ 
    719         if not self.slicer == None: 
     721        if self.slicer is not None: 
    720722            self.slicer.clear() 
    721723            self.subplot.figure.canvas.draw() 
     
    733735        """ 
    734736        event_id = str(evt.GetId()) 
    735         if self.parent != None: 
     737        if self.parent is not None: 
    736738            self._default_save_location = self.parent._default_save_location 
    737739        default_name = self.plots[self.graph.selected_plottable].label 
     
    757759            default_name = default_name.split('.')[0] 
    758760        #default_name += "_out" 
    759         if self.parent != None: 
     761        if self.parent is not None: 
    760762            self.parent.show_data2d(data, default_name) 
    761763 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/SectorSlicer.py

    rd85c194 r7432acb  
    144144        data = self.base.data2D 
    145145        # If we have no data, just return 
    146         if data == None: 
     146        if data is None: 
    147147            return 
    148148        ## Averaging 
     
    151151        phimin = -self.left_line.phi + self.main_line.theta 
    152152        phimax = self.left_line.phi + self.main_line.theta 
    153         if nbins == None: 
     153        if nbins is None: 
    154154            nbins = 20 
    155155        sect = SectorQ(r_min=0.0, r_max=radius, 
     
    362362        self.left_moving = left 
    363363        theta3 = 0 
    364         if phi != None: 
     364        if phi is not None: 
    365365            self.phi = phi 
    366         if delta == None: 
     366        if delta is None: 
    367367            delta = 0 
    368368        if  right: 
     
    374374            self.theta = mline.theta + self.phi 
    375375 
    376         if mline != None: 
     376        if mline is not None: 
    377377            if delta != 0: 
    378378                self.theta2 = mline + delta 
     
    538538        """ 
    539539 
    540         if theta != None: 
     540        if theta is not None: 
    541541            self.theta = theta 
    542542        x1 = self.radius * math.cos(self.theta) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/SimplePlot.py

    r25b9707a r7432acb  
    8787            pos = (pos_x, pos_y + 5) 
    8888        self.PopupMenu(slicerpop, pos) 
    89         if self.scale != None: 
     89        if self.scale is not None: 
    9090            self.parent.scale2d = self.scale 
    9191 
     
    106106            self.leftdown = True 
    107107            ax = event.inaxes 
    108             if ax != None: 
     108            if ax is not None: 
    109109                self.xInit, self.yInit = event.xdata, event.ydata 
    110110                try: 
     
    123123        """ 
    124124        self.resizing = False 
    125         if self.x_size != None: 
     125        if self.x_size is not None: 
    126126            if self.x_size == self.GetSize(): 
    127127                self.canvas.set_resizing(self.resizing) 
     
    161161        self.plots[plot.name] = plot 
    162162        # Axis scales 
    163         if plot.xtransform != None: 
     163        if plot.xtransform is not None: 
    164164            self.xLabel = plot.xtransform 
    165         if plot.ytransform != None: 
     165        if plot.ytransform is not None: 
    166166            self.yLabel = plot.ytransform 
    167167        # Init graph 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/SlicerParameters.py

    rd85c194 r235f514  
    4646        """ 
    4747        event.Skip() 
    48         if event.obj_class == None: 
     48        if event.obj_class is None: 
    4949            self.set_slicer(None, None) 
    5050        else: 
     
    5757        self.bck.Clear(True) 
    5858        self.type = type 
    59         if type == None: 
     59        if type is None: 
    6060            label = "Right-click on 2D plot for slicer options" 
    6161            title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/binder.py

    rd85c194 r463e7ffc  
    44import logging 
    55import sys 
     6 
     7logger = logging.getLogger(__name__) 
    68 
    79class Selection(object): 
     
    7072            canvas.mpl_disconnect(canvas.scroll_pick_id) 
    7173        except: 
    72             logging.error(sys.exc_value) 
     74            logger.error(sys.exc_value) 
    7375        self.canvas = canvas 
    7476        self.figure = figure 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/boxMask.py

    rd85c194 r7432acb  
    123123                                         x2=self.vertical_lines.x2, 
    124124                                         width=self.vertical_lines.half_width) 
    125         # if self.is_inside != None: 
     125        # if self.is_inside is not None: 
    126126        out = self._post_data() 
    127127        return out 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/boxSlicer.py

    r9a5097c r7432acb  
    139139 
    140140        """ 
    141         if self.direction == None: 
     141        if self.direction is None: 
    142142            self.direction = direction 
    143143 
     
    147147        y_max = math.fabs(self.horizontal_lines.y) 
    148148 
    149         if nbins != None: 
     149        if nbins is not None: 
    150150            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: 
    153153                msg = "post data:cannot average , averager is empty" 
    154154                raise ValueError, msg 
     
    357357        """ 
    358358        # # Reset x, y- coordinates if send as parameters 
    359         if x != None: 
     359        if x is not None: 
    360360            self.x = np.sign(self.x) * math.fabs(x) 
    361         if y != None: 
     361        if y is not None: 
    362362            self.y = np.sign(self.y) * math.fabs(y) 
    363363        # # Draw lines and markers 
     
    464464        """ 
    465465        # # reset x, y -coordinates if given as parameters 
    466         if x != None: 
     466        if x is not None: 
    467467            self.x = np.sign(self.x) * math.fabs(x) 
    468         if y != None: 
     468        if y is not None: 
    469469            self.y = np.sign(self.y) * math.fabs(y) 
    470470        # # draw lines and markers 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/boxSum.py

    rd85c194 r7432acb  
    353353            Draw the new roughness on the graph. 
    354354        """ 
    355         if center_x != None: 
     355        if center_x is not None: 
    356356            self.x = center_x 
    357         if center_y != None: 
     357        if center_y is not None: 
    358358            self.y = center_y 
    359359        self.center_marker.set(xdata=[self.x], ydata=[self.y]) 
     
    490490        """ 
    491491        # # save the new height, witdh of the rectangle if given as a param 
    492         if width != None: 
     492        if width is not None: 
    493493            self.half_width = width 
    494         if height != None: 
     494        if height is not None: 
    495495            self.half_height = height 
    496496        # # If new  center coordinates are given draw the rectangle 
    497497        # #given these value 
    498         if center != None: 
     498        if center is not None: 
    499499            self.center_x = center.x 
    500500            self.center_y = center.y 
     
    511511            return 
    512512        # # if x1, y1, y2, y3 are given draw the rectangle with this value 
    513         if x1 != None: 
     513        if x1 is not None: 
    514514            self.x1 = x1 
    515         if x2 != None: 
     515        if x2 is not None: 
    516516            self.x2 = x2 
    517         if y1 != None: 
     517        if y1 is not None: 
    518518            self.y1 = y1 
    519         if y2 != None: 
     519        if y2 is not None: 
    520520            self.y2 = y2 
    521521        # # Draw 2 vertical lines and a marker 
     
    657657        """ 
    658658        # # save the new height, witdh of the rectangle if given as a param 
    659         if width != None: 
     659        if width is not None: 
    660660            self.half_width = width 
    661         if height != None: 
     661        if height is not None: 
    662662            self.half_height = height 
    663663        # # If new  center coordinates are given draw the rectangle 
    664664        # #given these value 
    665         if center != None: 
     665        if center is not None: 
    666666            self.center_x = center.x 
    667667            self.center_y = center.y 
     
    679679            return 
    680680        # # if x1, y1, y2, y3 are given draw the rectangle with this value 
    681         if x1 != None: 
     681        if x1 is not None: 
    682682            self.x1 = x1 
    683         if x2 != None: 
     683        if x2 is not None: 
    684684            self.x2 = x2 
    685         if y1 != None: 
     685        if y1 is not None: 
    686686            self.y1 = y1 
    687         if y2 != None: 
     687        if y2 is not None: 
    688688            self.y2 = y2 
    689689        # # Draw 2 vertical lines and a marker 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/detector_dialog.py

    r8416a02 r7432acb  
    9090            zmin = self.reset_zmin_ctl 
    9191            zmax = self.reset_zmax_ctl 
    92             if zmin == None: 
     92            if zmin is None: 
    9393                zmin = "" 
    94             if zmax == None: 
     94            if zmax is None: 
    9595                zmax = "" 
    9696            self.zmin_ctl.SetValue(str(zmin)) 
     
    155155        self.qmax_ctl.SetLabel(str(format_number(qmax))) 
    156156        self.beam_ctl.SetLabel(str(format_number(beam))) 
    157         if zmin != None: 
     157        if zmin is not None: 
    158158            self.zmin_ctl.SetValue(str(format_number(zmin))) 
    159         if zmax != None: 
     159        if zmax is not None: 
    160160            self.zmax_ctl.SetValue(str(format_number(zmax))) 
    161161 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/masking.py

    r9a5097c r45dffa69  
    100100        wx.Dialog.__init__(self, parent, id=id, *args, **kwds) 
    101101 
    102         if data != None: 
     102        if data is not None: 
    103103            # Font size 
    104104            kwds = [] 
     
    235235        event.Skip() 
    236236        # from boxMask import BoxMask 
    237         if event != None: 
     237        if event is not None: 
    238238            self._on_clear_slicer(event) 
    239239        self.slicer_z += 1 
     
    249249        Add new mask to old mask 
    250250        """ 
    251         if not self.slicer == None: 
     251        if self.slicer is not None: 
    252252            data = Data2D() 
    253253            data = self.data 
     
    269269        Erase new mask from old mask 
    270270        """ 
    271         if not self.slicer == None: 
     271        if self.slicer is not None: 
    272272            self.slicer_mask = self.slicer.update() 
    273273            mask = self.data.mask 
     
    307307        Clear the slicer on the plot 
    308308        """ 
    309         if not self.slicer == None: 
     309        if self.slicer is not None: 
    310310            self.slicer.clear() 
    311311            self.subplot.figure.canvas.draw() 
     
    336336        """ 
    337337        # 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: 
    339339            self.ShowMessage() 
    340340            mask = copy.deepcopy(self.mask) 
     
    355355        temp_data.data[mask == False] = temp_mask[mask == False] 
    356356        self.plotpanel.clear() 
    357         if self.slicer != None: 
     357        if self.slicer is not None: 
    358358            self.slicer.clear() 
    359359            self.slicer = None 
     
    460460        wx.Dialog.__init__(self, parent, id=id, *args, **kwds) 
    461461 
    462         if data != None: 
     462        if data is not None: 
    463463            # Font size 
    464464            kwds = [] 
     
    710710        Status msg 
    711711        """ 
    712         if self.parent.parent.parent != None: 
     712        if self.parent.parent.parent is not None: 
    713713            wx.PostEvent(self.parent.parent.parent, 
    714714                         StatusEvent(status=msg, type=type)) 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py

    rca224b1 r235f514  
    8888        On Qmin Qmax vertical line event 
    8989        """ 
    90         if event == None: 
     90        if event is None: 
    9191            return 
    9292        if event.id in self.plot_panels.keys(): 
     
    9999 
    100100    def _on_plot_lim(self, event=None): 
    101         if event == None: 
     101        if event is None: 
    102102            return 
    103103        if event.id in self.plot_panels.keys(): 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/profile_dialog.py

    rd85c194 r7432acb  
    4444        wx.Dialog.__init__(self, parent, id=id, *args, **kwds) 
    4545 
    46         if data != None: 
     46        if data is not None: 
    4747            #Font size 
    4848            kwds = [] 
     
    284284            default_name = default_name.split('.')[0] 
    285285        default_name += "_out" 
    286         if self.parent != None: 
     286        if self.parent is not None: 
    287287            # What an ancestor! 
    288288            fit_panel = self.parent.parent.parent 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/sector_mask.py

    rd85c194 r7432acb  
    9696            self.left_line.update(phi=self.right_line.phi, delta=None, 
    9797                                  mline=self.main_line, side=True, left=False) 
    98         #if self.is_inside != None: 
     98        #if self.is_inside is not None: 
    9999        out = self._post_data() 
    100100        return out 
     
    117117        data = self.base.data 
    118118        # If we have no data, just return 
    119         if data == None: 
     119        if data is None: 
    120120            return 
    121121        ## Averaging 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/slicerpanel.py

    rd85c194 r7432acb  
    3737        self.bck = wx.GridBagSizer(5, 5) 
    3838        self.SetSizer(self.bck) 
    39         if type == None and params == None: 
     39        if type is None and params is None: 
    4040            label = "Right-click on 2D plot for slicer options" 
    4141            title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) 
     
    5757        """ 
    5858        event.Skip() 
    59         if event.obj_class == None: 
     59        if event.obj_class is None: 
    6060            self.set_slicer(None, None) 
    6161        else: 
     
    6868        self.bck.Clear(True) 
    6969        self.type = type 
    70         if type == None: 
     70        if type is None: 
    7171            label = "Right-click on 2D plot for slicer options" 
    7272            title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) 
     
    114114        self.Layout() 
    115115        psizer = self.parent.GetSizer() 
    116         if psizer != None: 
     116        if psizer is not None: 
    117117            psizer.Layout() 
    118118 
  • src/sas/sasgui/guiframe/media/data_formats_help.rst

    r48b8f6d r959eb01  
    44.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
    55.. 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 
    67 
    78.. _Formats: 
     
    8283The 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. 
    8384 
    84 Following the header is a 6 column list of instrument experimental variables: 
     85Following the header is a 8 (only the first 4 are really needed) column list of instrument experimental variables: 
    8586 
    8687- 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) 
    8790- 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) 
    8992- Neutron wavelength error (:math:`\Delta \lambda`, in Angstroms) 
    9093- Normalized polarization (:math:`P/P_0`, unitless) 
     
    9396.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    9497 
    95 .. note::  This help document was last changed by Steve King, 07Oct2016 
     98.. note::  This help document was last changed by Wim Bouwman, 05Apr2017 
  • src/sas/sasgui/guiframe/panel_base.py

    r18b7ecb9 r235f514  
    441441        """ 
    442442        """ 
    443         if self._manager == None: 
     443        if self._manager is None: 
    444444            return None 
    445445        return self._manager.frame 
  • src/sas/sasgui/guiframe/plugin_base.py

    rd85c194 r7432acb  
    161161        Sets default frame config 
    162162        """ 
    163         if self.frame != None: 
     163        if self.frame is not None: 
    164164            self.frame.EnableCloseButton(False) 
    165165            self.frame.Show(False) 
     
    230230        old_frame = None 
    231231        old_persp = self.parent.get_current_perspective() 
    232         if old_persp != None: 
     232        if old_persp is not None: 
    233233            old_frame = old_persp.get_frame() 
    234234        self.parent.check_multimode(self) 
     
    236236        self.parent.set_perspective(self.perspective) 
    237237 
    238         if self.frame != None: 
    239             if old_frame != None: 
     238        if self.frame is not None: 
     239            if old_frame is not None: 
    240240                pos_x, pos_y = old_frame.GetPositionTuple() 
    241241                self.frame.SetPosition((pos_x, pos_y)) 
  • src/sas/sasgui/guiframe/proxy.py

    rd85c194 r463e7ffc  
    66import logging 
    77import re 
     8 
     9 
     10logger = logging.getLogger(__name__) 
    811 
    912''' 
     
    7174        proxy_url_list = [] 
    7275        for this_pac_url in pac_urls_list: 
    73             logging.debug('Trying pac file (%s)...' % this_pac_url) 
     76            logger.debug('Trying pac file (%s)...' % this_pac_url) 
    7477            try: 
    7578                response = urllib2.urlopen( 
    7679                    this_pac_url, timeout=self.timeout) 
    77                 logging.debug('Succeeded (%s)...' % this_pac_url) 
     80                logger.debug('Succeeded (%s)...' % this_pac_url) 
    7881            except Exception: 
    79                 logging.debug('Failled (%s)...' % this_pac_url) 
     82                logger.debug('Failled (%s)...' % this_pac_url) 
    8083                continue 
    8184            pacStr = response.read() 
     
    120123        response = None 
    121124        try: 
    122             logging.debug("Trying Direct connection to %s..."%self.url) 
     125            logger.debug("Trying Direct connection to %s..."%self.url) 
    123126            response = urllib2.urlopen(req, timeout=self.timeout) 
    124127        except Exception, e: 
    125             logging.debug("Failed!") 
    126             logging.debug(e) 
     128            logger.debug("Failed!") 
     129            logger.debug(e) 
    127130            try: 
    128                 logging.debug("Trying to use system proxy if it exists...") 
     131                logger.debug("Trying to use system proxy if it exists...") 
    129132                self._set_proxy() 
    130133                response = urllib2.urlopen(req, timeout=self.timeout) 
    131134            except Exception, e: 
    132                 logging.debug("Failed!") 
    133                 logging.debug(e) 
     135                logger.debug("Failed!") 
     136                logger.debug(e) 
    134137                pac_urls = self._get_addresses_of_proxy_pac() 
    135138                proxy_urls = self._parse_proxy_pac(pac_urls) 
    136139                for proxy in proxy_urls: 
    137140                    try: 
    138                         logging.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) 
    139142                        self._set_proxy(proxy) 
    140143                        response = urllib2.urlopen(req, timeout=self.timeout) 
    141144                    except Exception, e: 
    142                         logging.debug("Failed!") 
    143                         logging.debug(e) 
     145                        logger.debug("Failed!") 
     146                        logger.debug(e) 
    144147        if response is not None: 
    145             logging.debug("The connection to %s was successful."%self.url) 
     148            logger.debug("The connection to %s was successful."%self.url) 
    146149        else: 
    147             logging.warning("Connection to %s failed..."%self.url) 
     150            logger.warning("Connection to %s failed..."%self.url) 
    148151        return response 
    149152 
  • src/sas/sasgui/guiframe/report_dialog.py

    r6dd6e32 r463e7ffc  
    77import sys 
    88import wx.html as html 
     9 
     10logger = logging.getLogger(__name__) 
    911 
    1012ISPDF = False 
     
    135137            return pisaStatus.err 
    136138        except: 
    137             logging.error("Error creating pdf: %s" % sys.exc_value) 
     139            logger.error("Error creating pdf: %s" % sys.exc_value) 
    138140        return False 
    139141 
  • src/sas/sasgui/guiframe/startup_configuration.py

    r73cbeec r7432acb  
    129129                width, _ = panel.frame.GetSizeTuple() 
    130130                if panel.frame.IsShown(): 
    131                     if p_size == None or width > p_size: 
     131                    if p_size is None or width > p_size: 
    132132                        p_size = width 
    133             if p_size == None: 
     133            if p_size is None: 
    134134                p_size = CURRENT_STRINGS['PLOPANEL_WIDTH'] 
    135135            self.current_string['PLOPANEL_WIDTH'] = p_size 
     
    145145                 
    146146            data_pw, _ = self.parent.panels["data_panel"].frame.GetSizeTuple() 
    147             if data_pw == None: 
     147            if data_pw is None: 
    148148                data_pw = CURRENT_STRINGS['DATAPANEL_WIDTH'] 
    149149            self.current_string['DATAPANEL_WIDTH'] = data_pw 
     
    208208        for key, item in strings.iteritems(): 
    209209            if (key == 'DEFAULT_PERSPECTIVE') or \ 
    210                 (key == 'DEFAULT_OPEN_FOLDER' and item != None): 
     210                (key == 'DEFAULT_OPEN_FOLDER' and item is not None): 
    211211                out_f.write("%s = \"%s\"\n" % (key,str(item))) 
    212212            else: 
  • src/sas/sasgui/guiframe/utils.py

    ra0373d5 r7432acb  
    8989    list = [] 
    9090    for item in mylist: 
    91         if re.search(separator,item)!= None: 
     91        if re.search(separator,item)is not None: 
    9292            if n > 0: 
    9393                word = re.split(separator, item, int(n)) 
Note: See TracChangeset for help on using the changeset viewer.