Changeset e43c012 in sasview for prview/perspectives/pr/pr.py


Ignore:
Timestamp:
Oct 24, 2008 11:41:56 AM (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:
b24bf4e
Parents:
bbc8013
Message:

Notify user when multi-entry data files are loaded

File:
1 edited

Legend:

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

    r14d05ba re43c012  
    366366            err = dataread.dy 
    367367        else: 
    368             raise RuntimeError, "This tool can only read 1D data" 
     368            if isinstance(dataread, list) and len(dataread)>0: 
     369                x = dataread[0].x 
     370                y = dataread[0].y 
     371                err = dataread[0].dy 
     372                msg = "PrView only allows a single data set at a time. " 
     373                msg += "Only the first data set was loaded."  
     374                wx.PostEvent(self.parent, StatusEvent(status=msg)) 
     375            else: 
     376                raise RuntimeError, "This tool can only read 1D data" 
    369377         
    370378        self._current_file_data.x = x 
     
    613621                err = dataread.dy 
    614622            else: 
    615                 wx.PostEvent(self.parent, StatusEvent(status="This tool can only read 1D data")) 
    616                 return 
     623                if isinstance(dataread, list) and len(dataread)>0: 
     624                    x = dataread[0].x 
     625                    y = dataread[0].y 
     626                    err = dataread[0].dy 
     627                    msg = "PrView only allows a single data set at a time. " 
     628                    msg += "Only the first data set was loaded."  
     629                    wx.PostEvent(self.parent, StatusEvent(status=msg)) 
     630                else: 
     631                    wx.PostEvent(self.parent, StatusEvent(status="This tool can only read 1D data")) 
     632                    return 
     633             
    617634        except: 
    618635            wx.PostEvent(self.parent, StatusEvent(status=sys.exc_value)) 
     
    908925                err = self._current_file_data.err 
    909926            else: 
     927                # Reset the status bar so that we don't get mixed up 
     928                # with old messages.  
     929                #TODO: refactor this into a proper status handling 
     930                wx.PostEvent(self.parent, StatusEvent(status='')) 
    910931                x, y, err = self.load(path) 
    911932             
     
    923944                message = "The loaded file had no error bars, statistical errors are assumed." 
    924945                wx.PostEvent(self.parent, StatusEvent(status=message)) 
    925             else: 
    926                 wx.PostEvent(self.parent, StatusEvent(status='')) 
    927946             
    928947            try: 
Note: See TracChangeset for help on using the changeset viewer.