Changeset 47439ce in sasview


Ignore:
Timestamp:
May 2, 2018 6:15:59 AM (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:
360eff3
Parents:
b80d945
Message:

Generic message box implemented to support position change of dialog

File:
1 edited

Legend:

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

    rb80d945 r47439ce  
    201201    tools for installation 
    202202    """ 
    203     #TODO: This doesn't work if someone uses different compiler e.g. gcc and has no cc installed. Will fix it 
     203    import wx 
    204204    import subprocess 
     205    #Generic message box is nessary here becuase standard MessageBox is not moveable 
     206    class GenericMessageBox(wx.Dialog): 
     207        def __init__(self, parent, text, title = ''): 
     208            wx.Dialog.__init__(self, parent, -1, title = title, 
     209                               size = (360,140), pos=(20,20), 
     210                               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 
     218 
    205219    logger = logging.getLogger(__name__) 
    206220    try: 
    207221        subprocess.check_output(["cc","--version"], stderr=subprocess.STDOUT) 
    208222    except subprocess.CalledProcessError as exc: 
    209         #At this stage wx should be working as it is imported earlier 
    210         import wx 
    211223        app = wx.App() 
    212         dlg = wx.MessageBox('No compiler installed. Please follow instruction for ' 
    213                       'Xcode command line installation and restart SasView' 
    214                       'SasView is terminating now', 
    215                       'Info', wx.OK | wx.ICON_INFORMATION | wx.STAY_ON_TOP) 
     224        dlg = GenericMessageBox(parent=None, 
     225            text='No compiler installed. Please follow instruction for\n ' 
     226                'Xcode command line installation and restart SasView\n' 
     227                'SasView is terminating now\n', 
     228            title = 'Info') 
    216229        dlg.Destroy() 
     230 
    217231        logger.error("No compiler installed. %s\n"%(exc)) 
    218232        logger.error(traceback.format_exc()) 
Note: See TracChangeset for help on using the changeset viewer.