Changeset 360eff3 in sasview


Ignore:
Timestamp:
May 2, 2018 11:28:56 PM (6 years ago)
Author:
wojciech
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
Children:
20610f5
Parents:
47439ce
Message:

message box improved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasview/sasview.py

    r47439ce r360eff3  
    209209                               size = (360,140), pos=(20,20), 
    210210                               style = wx.DEFAULT_DIALOG_STYLE ) 
    211             panel = wx.Panel(self, wx.ID_ANY, size = (360, 100), pos = (0,0)) 
    212             panel.SetBackgroundColour('#FFFFFF') 
    213             label = wx.StaticText(panel, -1, text, pos = (0,20)) 
    214             panel2 = wx.Panel(self, wx.ID_ANY, size = (360, 40), pos = (0, 60)) 
    215             btn = wx.Button(panel2, wx.ID_OK, pos = (250,7)) 
    216             self.ShowModal() 
    217  
     211            panel = wx.Panel(self, -1) 
     212            top_row_sizer = wx.BoxSizer(wx.HORIZONTAL) 
     213 
     214            error_bitmap = wx.ArtProvider.GetBitmap( 
     215                wx.ART_ERROR, wx.ART_MESSAGE_BOX 
     216            ) 
     217            error_bitmap_ctrl = wx.StaticBitmap(panel, -1) 
     218            error_bitmap_ctrl.SetBitmap(error_bitmap) 
     219            label = wx.StaticText(panel, -1, text) 
     220            top_row_sizer.Add(error_bitmap_ctrl, flag=wx.ALL, border=10) 
     221            top_row_sizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL) 
     222 
     223            #Create the OK button in the bottom row. 
     224            ok_button = wx.Button(panel, -1, 'OK') 
     225            self.Bind(wx.EVT_BUTTON, self.on_ok, source=ok_button) 
     226            ok_button.SetFocus() 
     227            ok_button.SetDefault() 
     228 
     229            sizer = wx.BoxSizer(wx.VERTICAL) 
     230            sizer.Add(top_row_sizer) 
     231            # sizer.Add(message_label, flag=wx.ALL | wx.EXPAND, border=10) 
     232            sizer.Add(ok_button, flag=wx.ALIGN_CENTER | wx.ALL, border=5) 
     233            panel.SetSizer(sizer) 
     234 
     235        def on_ok(self, event): 
     236            self.Destroy() 
    218237 
    219238    logger = logging.getLogger(__name__) 
    220239    try: 
    221240        subprocess.check_output(["cc","--version"], stderr=subprocess.STDOUT) 
    222     except subprocess.CalledProcessError as exc: 
    223241        app = wx.App() 
    224242        dlg = GenericMessageBox(parent=None, 
     
    227245                'SasView is terminating now\n', 
    228246            title = 'Info') 
     247        dlg.ShowModal() 
     248        app.MainLoop() 
     249        pass 
     250        raise RuntimeError("Terminating sasview") 
     251 
     252    except subprocess.CalledProcessError as exc: 
     253        app = wx.App() 
     254        dlg = GenericMessageBox(parent=None, 
     255            text='No compiler installed. Please follow instruction for ' 
     256                'Xcode command line installation and restart SasView' 
     257                'SasView is terminating now', 
     258            title = 'Compiler Info') 
    229259        dlg.Destroy() 
    230260 
Note: See TracChangeset for help on using the changeset viewer.