Ignore:
Timestamp:
Mar 12, 2015 10:32:02 AM (10 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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
7d64b0e
Parents:
6b0fc72
Message:

Modified the cansas reader and the dataloader to be more explicit in the
errors that occurred when loading data files. Also, only each error now
only appears a single time.

File:
1 edited

Legend:

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

    rb9dbd6b rd26dea0  
    204204            except: 
    205205                any_error = True 
    206         if any_error or error_message != "": 
    207             if error_message == "": 
    208                 error = "Error: " + str(sys.exc_value) + "\n" 
    209                 error += "while loading Data: \n%s\n" % str(p_file) 
    210                 error_message = "The data file you selected could not be loaded.\n" 
    211                 error_message += "Make sure the content of your file" 
    212                 error_message += " is properly formatted.\n\n" 
    213                 error_message += "When contacting the SasView team, mention the" 
    214                 error_message += " following:\n%s" % str(error) 
    215             elif data_error: 
    216                 base_message = "Errors occurred while loading {0}\n".format(p_file) 
    217                 base_message += "The data file loaded but with errors.\n" 
    218                 error_message = base_message + error_message 
    219             else: 
    220                 error_message += "%s\n" % str(p_file) 
    221             info = "error" 
     206            if any_error or error_message != "": 
     207                if error_message == "": 
     208                    error = "Error: " + str(sys.exc_info()[1]) + "\n" 
     209                    error += "while loading Data: \n%s\n" % str(basename) 
     210                    error_message += "The data file you selected could not be loaded.\n" 
     211                    error_message += "Make sure the content of your file" 
     212                    error_message += " is properly formatted.\n\n" 
     213                    error_message += "When contacting the SasView team, mention the" 
     214                    error_message += " following:\n%s" % str(error) 
     215                elif data_error: 
     216                    base_message = "Errors occurred while loading " 
     217                    base_message += "{0}\n".format(basename) 
     218                    base_message += "The data file loaded but with errors.\n" 
     219                    error_message = base_message + error_message 
     220                else: 
     221                    error_message += "%s\n" % str(p_file) 
     222                info = "error" 
     223         
     224        if any_error or error_message: 
    222225            self.load_update(output=output, message=error_message, info=info) 
    223  
    224226        else: 
    225227            message = "Loading Data Complete! " 
    226228        message += log_msg 
    227229        self.load_complete(output=output, error_message=error_message, 
    228                            message=message, path=path, info=info) 
     230                           message=message, path=path, info='warning') 
    229231 
    230232    def load_update(self, output=None, message="", info="warning"): 
     
    233235        """ 
    234236        if message != "": 
    235             wx.PostEvent(self.parent, StatusEvent(status=message, info='info', 
     237            wx.PostEvent(self.parent, StatusEvent(status=message, info=info, 
    236238                                                  type="progress")) 
    237239    def load_complete(self, output, message="", error_message="", path=None, 
Note: See TracChangeset for help on using the changeset viewer.