Ignore:
Timestamp:
Nov 3, 2017 10:58:39 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
412e069e
Parents:
304d082
Message:

More Qt5 related fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Calculators/SlitSizeCalculator.py

    r0849aec r6280464  
    44import os 
    55import sys 
     6import logging 
    67 
    78from PyQt5 import QtCore 
     
    6465            return 
    6566        loader = Loader() 
    66         data = loader.load(path_str)[0] 
     67        try: 
     68            data = loader.load(path_str)[0] 
     69        # Can return multiple exceptions - gather them all under one umbrella and complain 
     70        except Exception as ex: 
     71            logging.error(ex) 
     72            return 
    6773 
    6874        self.data_file.setText(os.path.basename(path_str)) 
     
    7985                                                 "SAXSess 1D data (*.txt *.TXT *.dat *.DAT)", 
    8086                                                 None, 
    81                                                  QtWidgets.QFileDialog.DontUseNativeDialog) 
    82  
    83         if path is None: 
    84             return 
    85  
     87                                                 QtWidgets.QFileDialog.DontUseNativeDialog)[0] 
    8688        return path 
    8789 
     
    106108            self.clearResults() 
    107109            msg = "ERROR: Data hasn't been loaded correctly" 
    108             raise RuntimeError(msg) 
     110            logging.error(msg) 
     111            return 
    109112 
    110113        if data.__class__.__name__ == 'Data2D': 
    111114            self.clearResults() 
    112115            msg = "Slit Length cannot be computed for 2D Data" 
    113             raise RuntimeError(msg) 
     116            logging.error(msg) 
     117            return 
    114118 
    115119        #compute the slit size 
     
    119123            if xdata == [] or xdata is None or ydata == [] or ydata is None: 
    120124                msg = "The current data is empty please check x and y" 
    121                 raise ValueError(msg) 
     125                logging.error(msg) 
     126                return 
    122127            slit_length_calculator = SlitlengthCalculator() 
    123128            slit_length_calculator.set_data(x=xdata, y=ydata) 
     
    126131            self.clearResults() 
    127132            msg = "Slit Size Calculator: %s" % (sys.exc_info()[1]) 
    128             raise RuntimeError(msg) 
     133            logging.error(msg) 
     134            return 
    129135 
    130136        slit_length_str = "{:.5f}".format(slit_length) 
Note: See TracChangeset for help on using the changeset viewer.