Changeset 9df816b in sasview for src/sas/sasgui


Ignore:
Timestamp:
Jul 31, 2017 5:07:50 AM (7 years ago)
Author:
lewis
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:
fafe52a
Parents:
0615d54
Message:

Only show warning messages once

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py

    r8dec7e7 r9df816b  
    223223 
    224224            except NoKnownLoaderException as e: 
     225                exception_occurred = True 
    225226                logging.error(e.message) 
     227 
    226228                error_message = "Loading data failed!\n" + e.message 
    227229                self.load_update(output=None, message=e.message, info="warning") 
    228                 self.load_complete(output=None, 
    229                                    message=error_message, 
    230                                    info="error") 
    231             except: 
    232                 logger.error(sys.exc_value) 
    233  
    234                 error_message = "The Data file you selected could not be " 
    235                 error_message += "loaded.\nMake sure the content of your file" 
    236                 error_message += " is properly formatted.\n" 
    237                 error_message += "When contacting the SasView team, mention the" 
    238                 error_message += " following:\n" 
    239                 error_message += "Error: " + str(sys.exc_info()[1]) 
    240                 file_errors[basename] = [error_message] 
    241                 self.load_update(output=output, message=error_message, 
    242                                  info="warning") 
     230 
     231            except Exception as e: 
     232                import pdb; pdb.set_trace() 
     233                exception_occurred = True 
     234                logger.error(e.message) 
     235 
     236                file_err = "The Data file you selected could not be " 
     237                file_err += "loaded.\nMake sure the content of your file" 
     238                file_err += " is properly formatted.\n" 
     239                file_err += "When contacting the SasView team, mention the" 
     240                file_err += " following:\n" 
     241                file_err += "Error: " + e.message 
     242                file_errors[basename] = [file_err] 
    243243 
    244244        if len(file_errors) > 0: 
     
    250250                    error_message += message + "\n" 
    251251                error_message += "\n" 
    252             self.load_update(output=output, message=error_message, info="error") 
    253  
    254         self.load_complete(output=output, message="Loading data complete!", 
    255                            info="info") 
     252            if not exception_occurred: # Some data loaded but with errors 
     253                self.load_update(output=output, message=error_message, info="error") 
     254 
     255        if not exception_occurred: # Everything loaded as expected 
     256            self.load_complete(output=output, message="Loading data complete!", 
     257                               info="info") 
     258        else: 
     259            self.load_complete(output=None, message=error_message, info="error") 
     260 
    256261 
    257262    def load_update(self, output=None, message="", info="warning"): 
Note: See TracChangeset for help on using the changeset viewer.