Changeset d7412e0 in sasview


Ignore:
Timestamp:
Aug 1, 2009 10:22:46 AM (15 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
4d5005e
Parents:
cb0d17c
Message:

prview: standalone mode: pop up error message when file can't be loaded

File:
1 edited

Legend:

Unmodified
Added
Removed
  • prview/perspectives/pr/pr.py

    r9ff861b rd7412e0  
    2323from sans.pr.invertor import Invertor 
    2424from DataLoader.loader import Loader 
     25from sans.guiframe.data_loader import load_error  
    2526 
    2627import copy 
     
    10461047                y = self._current_file_data.y 
    10471048                err = self._current_file_data.err 
     1049                 
     1050                message = "The data from this file has already been loaded." 
     1051                wx.PostEvent(self.parent, StatusEvent(status=message)) 
    10481052            else: 
    10491053                # Reset the status bar so that we don't get mixed up 
     
    10541058                    x, y, err = self.load(path) 
    10551059                except: 
    1056                     message = "Could not read the data file: %s" % path 
    1057                     wx.PostEvent(self.parent, StatusEvent(status=message)) 
     1060                    load_error(sys.exc_value) 
    10581061                    return None 
    10591062                 
    10601063                # If the file contains no data, just return 
    1061                 if x is None: 
    1062                     message = "The loaded file contains no data" 
    1063                     wx.PostEvent(self.parent, StatusEvent(status=message)) 
     1064                if x is None or len(x)==0: 
     1065                    load_error("The loaded file contains no data") 
    10641066                    return None 
    10651067             
     
    10931095                return pr 
    10941096            except: 
    1095                 wx.PostEvent(self.parent, StatusEvent(status="Problem reading data: %s" % sys.exc_value)) 
     1097                load_error(sys.exc_value) 
    10961098        return None 
    10971099         
Note: See TracChangeset for help on using the changeset viewer.