Ignore:
Timestamp:
Aug 9, 2016 4:23:08 AM (8 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.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
dc8a553
Parents:
b7c21a7
Message:

Add more descriptive error messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/file_converter/converter_panel.py

    rb7c21a7 r9c500ab  
    186186        loader = OTOKOLoader(self.q_input.GetPath(), 
    187187            self.iq_input.GetPath()) 
    188         bsl_data = loader.load_bsl_data() 
    189         qdata = bsl_data.q_axis.data 
    190         iqdata = bsl_data.data_axis.data 
     188        otoko_data = loader.load_otoko_data() 
     189        qdata = otoko_data.q_axis.data 
     190        iqdata = otoko_data.data_axis.data 
    191191        if len(qdata) > 1: 
    192192            msg = ("Q-Axis file has multiple frames. Only 1 frame is " 
     
    212212        loader = BSLLoader(filename) 
    213213        frames = [0] 
     214        should_continue = True 
     215 
    214216        if loader.n_frames > 1: 
    215217            params = self.ask_frame_range(loader.n_frames) 
    216218            frames = params['frames'] 
     219        elif loader.n_rasters == 1 and loader.n_frames == 1: 
     220            message = ("The selected file is an OTOKO file. Please select the " 
     221            "'OTOKO 1D' option if you wish to convert it.") 
     222            dlg = wx.MessageDialog(self, 
     223            message, 
     224            'Error!', 
     225            wx.OK | wx.ICON_WARNING) 
     226            dlg.ShowModal() 
     227            should_continue = False 
     228            dlg.Destroy() 
     229        else: 
     230            message = ("The selected data file only has 1 frame, it might be" 
     231                " a multi-frame OTOKO file.\nContinue conversion?") 
     232            dlg = wx.MessageDialog(self, 
     233            message, 
     234            'Warning!', 
     235            wx.YES_NO | wx.ICON_WARNING) 
     236            should_continue = (dlg.ShowModal() == wx.ID_YES) 
     237            dlg.Destroy() 
     238 
     239        if not should_continue: 
     240            return None, None, None 
     241 
    217242        frame_data = {} 
    218243 
     
    294319                    self.iq_input.GetPath()) 
    295320 
     321                if x_data == None and y_data == None and frame_data == None: 
     322                    wx.PostEvent(self.parent.manager.parent, 
     323                        StatusEvent(status="Conversion cancelled.")) 
     324                    return 
     325 
    296326                file_path = self.output.GetPath() 
    297327                self.convert_to_red2d(file_path, x_data, y_data, frame_data) 
     
    342372            'source': self.source 
    343373        } 
    344         import pdb; pdb.set_trace() 
    345374 
    346375        frame_data = {} 
Note: See TracChangeset for help on using the changeset viewer.