Changeset 2df1bd1 in sasview for src/sas/sasgui/guiframe


Ignore:
Timestamp:
Apr 6, 2017 9:06:43 AM (7 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:
982577b
Parents:
54557b5 (diff), ec8886e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into batch_slicer

Location:
src/sas/sasgui/guiframe
Files:
1 added
1 deleted
14 edited
1 moved

Legend:

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

    rddbac66 r463e7ffc  
    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 
     
    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 r64ca561  
    77import sas.sasview 
    88import logging 
     9 
     10 
     11logger = logging.getLogger(__name__) 
    912 
    1013# Version of the application 
     
    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/data_manager.py

    r2ffe241 r463e7ffc  
    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/documentation_window.py

    rd85c194 r463e7ffc  
    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 r64ca561  
    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.info(sys.executable) 
     80    logger.info(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.info("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.info("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.info("using default local_config") 
    128129    else: 
    129         logging.info("found local_config in %s" % os.getcwd()) 
     130        logger.info("found local_config in %s" % os.getcwd()) 
    130131else: 
    131     logging.info("found local_config in %s" % PATH_APP) 
     132    logger.info("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.info(msgConfig) 
    141142    else: 
    142         logging.info("using custom_config in %s" % os.getcwd()) 
     143        logger.info("using custom_config in %s" % os.getcwd()) 
    143144else: 
    144     logging.info("using custom_config from %s" % c_conf_dir) 
     145    logger.info("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() 
     
    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 
     
    21572158                #  
    21582159                content = response.read().strip() 
    2159                 logging.info("Connected to www.sasview.org. Latest version: %s" 
     2160                logger.info("Connected to www.sasview.org. Latest version: %s" 
    21602161                             % (content)) 
    21612162                version_info = json.loads(content) 
    21622163            except: 
    2163                 logging.info("Failed to connect to www.sasview.org") 
     2164                logger.info("Failed to connect to www.sasview.org") 
    21642165        self._process_version(version_info, standalone=event is None) 
    21652166 
     
    22012202            msg = "guiframe: could not get latest application" 
    22022203            msg += " version number\n  %s" % sys.exc_value 
    2203             logging.error(msg) 
     2204            logger.error(msg) 
    22042205            if not standalone: 
    22052206                msg = "Could not connect to the application server." 
     
    22482249                    dialog.Show(True) 
    22492250                except: 
    2250                     logging.error("Error in _onTutorial: %s" % sys.exc_value) 
     2251                    logger.error("Error in _onTutorial: %s" % sys.exc_value) 
    22512252                    try: 
    22522253                        # Try an alternate method 
    2253                         logging.error( 
     2254                        logger.error( 
    22542255                            "Could not open the tutorial pdf, trying xhtml2pdf") 
    22552256                        from xhtml2pdf import pisa 
    22562257                        pisa.startViewer(path) 
    22572258                    except: 
    2258                         logging.error( 
     2259                        logger.error( 
    22592260                            "Could not open the tutorial pdf with xhtml2pdf") 
    22602261                        msg = "This feature requires 'PDF Viewer'\n" 
     
    22672268                    try: 
    22682269                        # Try an alternate method 
    2269                         logging.error( 
     2270                        logger.error( 
    22702271                            "Could not open the tutorial pdf, trying xhtml2pdf") 
    22712272                        from xhtml2pdf import pisa 
    22722273                        pisa.startViewer(path) 
    22732274                    except: 
    2274                         logging.error( 
     2275                        logger.error( 
    22752276                            "Could not open the tutorial pdf with xhtml2pdf") 
    22762277                        msg = "This feature requires the Preview application\n" 
     
    24112412        else: 
    24122413            msg = "Guiframe does not have a current perspective" 
    2413             logging.info(msg) 
     2414            logger.info(msg) 
    24142415 
    24152416    def set_theory(self, state_id, theory_id=None): 
     
    24222423            except: 
    24232424                msg = "Guiframe set_theory: \n" + str(sys.exc_value) 
    2424                 logging.info(msg) 
     2425                logger.info(msg) 
    24252426                wx.PostEvent(self, StatusEvent(status=msg, info="error")) 
    24262427        else: 
    24272428            msg = "Guiframe does not have a current perspective" 
    2428             logging.info(msg) 
     2429            logger.info(msg) 
    24292430 
    24302431    def plot_data(self, state_id, data_id=None, 
     
    25082509                                            action='remove')) 
    25092510        except: 
    2510             logging.error(sys.exc_value) 
     2511            logger.error(sys.exc_value) 
    25112512 
    25122513    def save_data1d(self, data, fname): 
     
    33063307            msg = "%s Could not load " % str(APPLICATION_NAME) 
    33073308            msg += "input file from command line.\n" 
    3308             logging.error(msg) 
     3309            logger.error(msg) 
    33093310        # Display a splash screen on top of the frame. 
    33103311        try: 
     
    33203321            msg = "Cannot display splash screen\n" 
    33213322            msg += str(sys.exc_value) 
    3322             logging.error(msg) 
     3323            logger.error(msg) 
    33233324            self.frame.Show() 
    33243325 
     
    33753376                            os.remove(file_path) 
    33763377                except: 
    3377                     logging.error("gui_manager.clean_plugin_models:\n  %s" 
     3378                    logger.error("gui_manager.clean_plugin_models:\n  %s" 
    33783379                                  % sys.exc_value) 
    33793380 
  • 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

    ra674d0b r463e7ffc  
    77import wx 
    88import logging 
     9 
     10logger = logging.getLogger(__name__) 
    911 
    1012from sas.sascalc.dataloader.loader import Loader 
     
    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 
     
    182184                log_msg += "Please try to open that file from \"open project\"" 
    183185                log_msg += "or \"open analysis\" menu." 
    184                 logging.info(log_msg) 
     186                logger.info(log_msg) 
    185187                file_errors[basename] = [log_msg] 
    186188                continue 
     
    212214 
    213215            except: 
    214                 logging.error(sys.exc_value) 
     216                logger.error(sys.exc_value) 
    215217 
    216218                error_message = "The Data file you selected could not be loaded.\n" 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py

    r9a5097c r9c0f3c17  
    2424from appearanceDialog import appearanceDialog 
    2525from graphAppearance import graphAppearance 
     26 
     27logger = logging.getLogger(__name__) 
    2628 
    2729DEFAULT_QMAX = 0.05 
     
    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 
     
    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): 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py

    r0d8ee36 r2df1bd1  
    3030from graphAppearance import graphAppearance 
    3131(InternalEvent, EVT_INTERNAL) = wx.lib.newevent.NewEvent() 
     32 
     33logger = logging.getLogger(__name__) 
    3234 
    3335DEFAULT_QMAX = 0.05 
     
    433435            except: 
    434436                msg = "Add Text: Error. Check your property values..." 
    435                 logging.error(msg) 
     437                logger.error(msg) 
    436438                if self.parent != None: 
    437439                    wx.PostEvent(self.parent, StatusEvent(status=msg)) 
  • 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/media/data_formats_help.rst

    r98c44f3 r76c4469  
    8686 
    8787- Spin echo length (z, in Angstroms) 
    88 - depolarization (:math:`log(P/P_0)/(lambda^2 * thickness)`, in Angstrom^-1 cm^-1) 
     88- depolarization (:math:`log(P/P_0)/(lambda^2 * thickness)`, in Angstrom :sup:`-1` cm :sup:`-1`\ ) 
    8989- depolarization error in the same unit) (measurement error) 
    9090- Spin echo length error (:math:`\Delta`\ z, in Angstroms) (experimental resolution) 
  • 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 
Note: See TracChangeset for help on using the changeset viewer.