Changeset ccb560a in sasview


Ignore:
Timestamp:
Aug 4, 2008 1:32:50 PM (16 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:
4d2a0d1
Parents:
b39c817
Message:

Send message to user when the loader is unable to read a file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/data_loader.py

    racb1ad1 rccb560a  
    1 import os 
     1import os, sys 
    22import wx 
    33 
     
    5656 
    5757def plot_data(parent, path, name="Loaded Data"): 
    58     from sans.guicomm.events import NewPlotEvent 
     58    from sans.guicomm.events import NewPlotEvent, StatusEvent 
    5959    from sans.guitools.plottables import Data1D, Theory1D 
    6060    from DataLoader.loader import  Loader 
     61    import numpy 
    6162    #Instantiate a loader  
    6263    L=Loader() 
    6364     
    6465    #Recieves data  
    65     output=L.load(path) 
    66      
    67     import numpy 
    68      
     66    try: 
     67        output=L.load(path) 
     68    except: 
     69        wx.PostEvent(parent, StatusEvent(status="Problem loading file: %s" % sys.exc_value)) 
     70        return 
     71         
    6972    if output.dy==None: 
    7073        new_plot = Theory1D(output.x, output.y) 
Note: See TracChangeset for help on using the changeset viewer.