Exemple #1
0
    def create_main_panel(self):
        from matplotlib.backends.backend_wxagg import \
             FigureCanvasWxAgg as FigCanvas
        self.panel = wx.Panel(self)

        self.init_plot()
        self.canvas = FigCanvas(self.panel, -1, self.fig)

        self.close_button = wx.Button(self.panel, -1, "Close")
        self.Bind(wx.EVT_BUTTON, self.on_close_button, self.close_button)

        self.pause_button = wx.Button(self.panel, -1, "Pause")
        self.Bind(wx.EVT_BUTTON, self.on_pause_button, self.pause_button)
        self.Bind(wx.EVT_UPDATE_UI, self.on_update_pause_button,
                  self.pause_button)

        self.hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox1.Add(self.close_button,
                       border=5,
                       flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox1.AddSpacer(1)
        self.hbox1.Add(self.pause_button,
                       border=5,
                       flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)

        self.vbox = wx.BoxSizer(wx.VERTICAL)
        self.vbox.Add(self.canvas, 1, flag=wx.LEFT | wx.TOP | wx.GROW)
        self.vbox.Add(self.hbox1, 0, flag=wx.ALIGN_LEFT | wx.TOP)

        self.panel.SetSizer(self.vbox)
        self.vbox.Fit(self)
    def __init__(self, state, title):
        self.state = state
        wx.Frame.__init__(self, None, title=title, size=(800,300))
        self.panel = wx.Panel(self)
        state.frame = self

        # values for the status bar
        self.values = {}

        self.menu = None
        self.menu_callback = None

        self.control = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE | wx.TE_READONLY)


        self.vbox = wx.BoxSizer(wx.VERTICAL)
        # start with one status row
        self.status = [wx.BoxSizer(wx.HORIZONTAL)]
        self.vbox.Add(self.status[0], 0, flag=wx.ALIGN_LEFT | wx.TOP)
        self.vbox.Add(self.control, 1, flag=wx.LEFT | wx.BOTTOM | wx.GROW)

        self.panel.SetSizer(self.vbox)

        self.timer = wx.Timer(self)

        self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
        self.timer.Start(100)

        self.Bind(wx.EVT_IDLE, self.on_idle)

        self.Show(True)
        self.pending = []
Exemple #3
0
    def __init__(self, title, graphdef, callback):
        wx.Dialog.__init__(self, None, -1, title, size=(900, 400))

        self.callback = callback
        self.graphdef = graphdef

        self.panel = wx.Panel(self, -1)
        vbox = wx.BoxSizer(wx.VERTICAL)

        # name entry
        hbox_name = wx.BoxSizer(wx.HORIZONTAL)
        st_name = wx.StaticText(self.panel, -1, 'Name: ')
        self.tc_name = wx.TextCtrl(self.panel, -1, size=(400, -1))
        self.tc_name.Value = self.graphdef.name
        hbox_name.Add(st_name, 0, wx.LEFT, 10)
        hbox_name.Add(self.tc_name, 0, wx.LEFT, 35)
        vbox.Add(hbox_name, 0, wx.TOP, 10)

        # expression entry
        st = wx.StaticText(self.panel, -1, 'Expressions: ')
        vbox.Add(st, 0, wx.LEFT, 10)

        hbox_expressions = wx.BoxSizer(wx.HORIZONTAL)
        self.tc_expressions = wx.TextCtrl(self.panel,
                                          -1,
                                          style=wx.TE_MULTILINE | wx.HSCROLL,
                                          size=(800, 80))
        elist = []
        for e in self.graphdef.expressions:
            e = ' '.join(e.split())
            elist.append(e)
        self.tc_expressions.Value = '\n'.join(elist)
        vbox.Add(self.tc_expressions, 0, wx.LEFT, 15)

        # description entry
        st = wx.StaticText(self.panel, -1, 'Description: ')
        vbox.Add(st, 0, wx.LEFT, 10)
        self.tc_description = wx.TextCtrl(self.panel,
                                          -1,
                                          style=wx.TE_MULTILINE)
        vbox.Add(self.tc_description, 1,
                 wx.EXPAND | wx.TOP | wx.RIGHT | wx.LEFT, 15)
        self.tc_description.Value = self.graphdef.description

        # buttons
        button_save = wx.Button(self.panel, 1, 'Save')
        button_cancel = wx.Button(self.panel, 2, 'Cancel')
        button_test = wx.Button(self.panel, 3, 'Test')
        hbox_buttons = wx.BoxSizer(wx.HORIZONTAL)
        hbox_buttons.Add(button_save, 0, wx.LEFT, 10)
        hbox_buttons.Add(button_cancel, 0, wx.LEFT, 10)
        hbox_buttons.Add(button_test, 0, wx.LEFT, 10)
        vbox.Add(hbox_buttons, 0, wx.TOP, 10)
        self.Bind(wx.EVT_BUTTON, self.OnSave, id=1)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)
        self.Bind(wx.EVT_BUTTON, self.OnTest, id=3)

        self.panel.SetSizer(vbox)
        self.Centre()
    def __init__(self, state, title):
        self.state = state
        wx.Frame.__init__(self, None, title=title, size=(350,400), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)

        #use tabs for the individual checklists
        self.createLists()
        self.panel = wx.Panel(self)
        self.nb = wx.Choicebook(self.panel, wx.ID_ANY)

        #create the tabs
        self.createWidgets()

        #assign events to the buttons on the tabs
        self.createActions()

        #add in the pipe from MAVProxy
        self.timer = wx.Timer(self)
        #self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
        self.Bind(wx.EVT_TIMER, lambda evt, notebook=self.nb: self.on_timer(evt, notebook), self.timer)
        self.timer.Start(100)

        # finally, put the notebook in a sizer for the panel to manage
        # the layout
        sizer = wx.BoxSizer()
        sizer.Add(self.nb, 1, wx.EXPAND)
        self.panel.SetSizer(sizer)

        self.Show(True)
        self.pending = []
Exemple #5
0
 def __init__(self, state):
     wx.Frame.__init__(self, None, wx.ID_ANY, state.title)
     self.state = state
     state.frame = self
     self.sizer = wx.BoxSizer(wx.VERTICAL)
     state.panel = MPImagePanel(self, state)
     self.sizer.Add(state.panel, 1, wx.EXPAND)
     self.SetSizer(self.sizer)
     self.Bind(wx.EVT_IDLE, self.on_idle)
     self.Bind(wx.EVT_SIZE, state.panel.on_size)
 def createPlotPanel(self):
     '''Creates the figure and axes for the plotting panel.'''
     self.figure = Figure()
     self.axes = self.figure.add_subplot(111)
     self.canvas = FigureCanvas(self,-1,self.figure)
     self.canvas.SetSize(wx.Size(300,300))
     self.axes.axis('off')
     self.figure.subplots_adjust(left=0,right=1,top=1,bottom=0)
     self.sizer = wx.BoxSizer(wx.VERTICAL)
     self.sizer.Add(self.canvas,1,wx.EXPAND,wx.ALL)
     self.SetSizerAndFit(self.sizer)
     self.Fit()
 def on_timer(self, event):
     state = self.state
     if state.close_event.wait(0.001):
         self.timer.Stop()
         self.Destroy()
         return
     while state.child_pipe_recv.poll():
         obj = state.child_pipe_recv.recv()
         if isinstance(obj, Value):
             # request to set a status field
             if not obj.name in self.values:
                 # create a new status field
                 value = wx.StaticText(self.panel, -1, obj.text)
                 # possibly add more status rows
                 for i in range(len(self.status), obj.row + 1):
                     self.status.append(wx.BoxSizer(wx.HORIZONTAL))
                     self.vbox.Insert(len(self.status) - 1,
                                      self.status[i],
                                      0,
                                      flag=wx.ALIGN_LEFT | wx.TOP)
                     self.vbox.Layout()
                 self.status[obj.row].Add(value, border=5)
                 self.status[obj.row].AddSpacer(20)
                 self.values[obj.name] = value
             value = self.values[obj.name]
             value.SetForegroundColour(obj.fg)
             value.SetBackgroundColour(obj.bg)
             value.SetLabel(obj.text)
             self.panel.Layout()
         elif isinstance(obj, Text):
             '''request to add text to the console'''
             self.pending.append(obj)
             for p in self.pending:
                 # we're scrolled at the bottom
                 oldstyle = self.control.GetDefaultStyle()
                 style = wx.TextAttr()
                 style.SetTextColour(p.fg)
                 style.SetBackgroundColour(p.bg)
                 self.control.SetDefaultStyle(style)
                 self.control.AppendText(p.text)
                 self.control.SetDefaultStyle(oldstyle)
             self.pending = []
         elif isinstance(obj, mp_menu.MPMenuTop):
             if obj is not None:
                 self.SetMenuBar(None)
                 self.menu = obj
                 self.SetMenuBar(self.menu.wx_menu())
                 self.Bind(wx.EVT_MENU, self.on_menu)
             self.Refresh()
             self.Update()
 def __init__(self, tab_names, title='Title', size=wx.DefaultSize):
     wx.Dialog.__init__(self,
                        None,
                        -1,
                        title,
                        style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
     self.tab_names = tab_names
     self.notebook = wx.Notebook(self, -1, size=size)
     self.panels = {}
     self.sizers = {}
     for t in tab_names:
         self.panels[t] = wx.Panel(self.notebook)
         self.notebook.AddPage(self.panels[t], t)
         self.sizers[t] = wx.BoxSizer(wx.VERTICAL)
         self.panels[t].SetSizer(self.sizers[t])
     self.dialog_sizer = wx.BoxSizer(wx.VERTICAL)
     self.dialog_sizer.Add(self.notebook, 1, wx.EXPAND | wx.ALL, 5)
     self.controls = {}
     self.browse_option_map = {}
     self.control_map = {}
     self.setting_map = {}
     button_box = wx.BoxSizer(wx.HORIZONTAL)
     self.button_apply = wx.Button(self, -1, "Apply")
     self.button_cancel = wx.Button(self, -1, "Cancel")
     self.button_save = wx.Button(self, -1, "Save")
     self.button_load = wx.Button(self, -1, "Load")
     button_box.Add(self.button_cancel, 0, wx.ALL)
     button_box.Add(self.button_apply, 0, wx.ALL)
     button_box.Add(self.button_save, 0, wx.ALL)
     button_box.Add(self.button_load, 0, wx.ALL)
     self.dialog_sizer.Add(button_box, 0,
                           wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
     wx.EVT_BUTTON(self, self.button_cancel.GetId(), self.on_cancel)
     wx.EVT_BUTTON(self, self.button_apply.GetId(), self.on_apply)
     wx.EVT_BUTTON(self, self.button_save.GetId(), self.on_save)
     wx.EVT_BUTTON(self, self.button_load.GetId(), self.on_load)
     self.Centre()
    def __init__(self, parent, state):
        wx.Panel.__init__(self, parent)
        self.frame = parent
        self.state = state
        self.img = None
        self.redraw_timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.on_redraw_timer, self.redraw_timer)
        self.Bind(wx.EVT_SET_FOCUS, self.on_focus)
        self.redraw_timer.Start(100)

        self.mouse_down = None
        self.drag_step = 10
        self.zoom = 1.0
        self.menu = None
        self.popup_menu = None
        self.wx_popup_menu = None
        self.popup_pos = None
        self.last_size = None
        self.done_PIL_warning = False
        state.brightness = 1.0

        # dragpos is the top left position in image coordinates
        self.dragpos = wx.Point(0, 0)
        self.need_redraw = True

        self.mainSizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.mainSizer)

        # panel for the main image
        self.imagePanel = mp_widgets.ImagePanel(
            self, wx.EmptyImage(state.width, state.height))
        self.mainSizer.Add(self.imagePanel,
                           flag=wx.TOP | wx.LEFT | wx.GROW,
                           border=0)
        if state.mouse_events:
            self.imagePanel.Bind(wx.EVT_MOUSE_EVENTS, self.on_event)
        else:
            self.imagePanel.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse_event)
        if state.key_events:
            self.imagePanel.Bind(wx.EVT_KEY_DOWN, self.on_event)
        else:
            self.imagePanel.Bind(wx.EVT_KEY_DOWN, self.on_key_event)
        self.imagePanel.Bind(wx.EVT_MOUSEWHEEL, self.on_mouse_wheel)

        self.redraw()
        state.frame.Fit()
 def _add_input(self, setting, ctrl, ctrl2=None, value=None):
     tab_name = setting.tab
     label = setting.label
     tab = self.panel(tab_name)
     box = wx.BoxSizer(wx.HORIZONTAL)
     labelctrl = wx.StaticText(tab, -1, label)
     box.Add(labelctrl, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
     box.Add(ctrl, 1, wx.ALIGN_CENTRE | wx.ALL, 5)
     if ctrl2 is not None:
         box.Add(ctrl2, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
     self.sizer(tab_name).Add(box, 0,
                              wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                              5)
     self.controls[label] = ctrl
     if value is not None:
         ctrl.Value = value
     else:
         ctrl.Value = str(setting.value)
     self.control_map[ctrl.GetId()] = label
     self.setting_map[label] = setting
    def createWidgets(self):
        #create the panels for the tabs
        PanelAssembly = wx.Panel(self.nb)
        boxAssembly = wx.BoxSizer(wx.VERTICAL)
        PanelAssembly.SetAutoLayout(True)
        PanelAssembly.SetSizer(boxAssembly)
        PanelAssembly.Layout()

        PanelEngine = wx.Panel(self.nb)
        boxEngine = wx.BoxSizer(wx.VERTICAL)
        PanelEngine.SetAutoLayout(True)
        PanelEngine.SetSizer(boxEngine)
        PanelEngine.Layout()

        PanelTakeoff = wx.Panel(self.nb)
        boxTakeoff = wx.BoxSizer(wx.VERTICAL)
        PanelTakeoff.SetAutoLayout(True)
        PanelTakeoff.SetSizer(boxTakeoff)
        PanelTakeoff.Layout()

        PanelCruise = wx.Panel(self.nb)
        boxCruise = wx.BoxSizer(wx.VERTICAL)
        PanelCruise.SetAutoLayout(True)
        PanelCruise.SetSizer(boxCruise)
        PanelCruise.Layout()

        PanelDrop = wx.Panel(self.nb)
        boxDrop = wx.BoxSizer(wx.VERTICAL)
        PanelDrop.SetAutoLayout(True)
        PanelDrop.SetSizer(boxDrop)
        PanelDrop.Layout()

        PanelLanding = wx.Panel(self.nb)
        boxLanding = wx.BoxSizer(wx.VERTICAL)
        PanelLanding.SetAutoLayout(True)
        PanelLanding.SetSizer(boxLanding)
        PanelLanding.Layout()

        PanelShutdown = wx.Panel(self.nb)
        boxShutdown = wx.BoxSizer(wx.VERTICAL)
        PanelShutdown.SetAutoLayout(True)
        PanelShutdown.SetSizer(boxShutdown)
        PanelShutdown.Layout()

        #add the data to the individual tabs

        '''before assembly checklist'''
        for key in self.beforeAssemblyList:
            if self.beforeAssemblyList[key] == 0:
                disCheckBox = wx.CheckBox(PanelAssembly, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxAssembly.Add(disCheckBox)
            if self.beforeAssemblyList[key] == 2:
                boxAssembly.Add(wx.CheckBox(PanelAssembly, wx.ID_ANY, key))

        self.AssemblyButton = wx.Button(PanelAssembly, wx.ID_ANY, "Close final hatches")
        boxAssembly.Add(self.AssemblyButton)

        '''before Engine Start checklist'''
        for key in self.beforeEngineList:
            if self.beforeEngineList[key] == 0:
                disCheckBox = wx.CheckBox(PanelEngine, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxEngine.Add(disCheckBox)
            if self.beforeEngineList[key] == 2:
                boxEngine.Add(wx.CheckBox(PanelEngine, wx.ID_ANY, key))

        self.EngineButton = wx.Button(PanelEngine, wx.ID_ANY, "Ready for Engine start")
        boxEngine.Add(self.EngineButton)

        '''before takeoff checklist'''
        for key in self.beforeTakeoffList:
            if self.beforeTakeoffList[key] == 0:
                disCheckBox = wx.CheckBox(PanelTakeoff, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxTakeoff.Add(disCheckBox)
            if self.beforeTakeoffList[key] == 2:
                boxTakeoff.Add(wx.CheckBox(PanelTakeoff, wx.ID_ANY, key))

        self.TakeoffButton = wx.Button(PanelTakeoff, wx.ID_ANY, "Ready for Takeoff")
        boxTakeoff.Add(self.TakeoffButton)

        '''before cruise/AUTO checklist'''
        for key in self.beforeCruiseList:
            if self.beforeCruiseList[key] == 0:
                disCheckBox = wx.CheckBox(PanelCruise, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxCruise.Add(disCheckBox)
            if self.beforeCruiseList[key] == 2:
                boxCruise.Add(wx.CheckBox(PanelCruise, wx.ID_ANY, key))

        self.CruiseButton = wx.Button(PanelCruise, wx.ID_ANY, "Ready for Cruise/AUTO")
        boxCruise.Add(self.CruiseButton)

        '''before bottle drop checklist'''
        for key in self.bottleDropList:
            if self.bottleDropList[key] == 0:
                disCheckBox = wx.CheckBox(PanelDrop, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxDrop.Add(disCheckBox)
            if self.bottleDropList[key] == 2:
                boxDrop.Add(wx.CheckBox(PanelDrop, wx.ID_ANY, key))

        self.DropButton = wx.Button(PanelDrop, wx.ID_ANY, "Ready for Bottle Drop")
        boxDrop.Add(self.DropButton)

        '''before landing checklist'''
        for key in self.beforeLandingList:
            if self.beforeLandingList[key] == 0:
                disCheckBox = wx.CheckBox(PanelLanding, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxLanding.Add(disCheckBox)
            if self.beforeLandingList[key] == 2:
                boxLanding.Add(wx.CheckBox(PanelLanding, wx.ID_ANY, key))

        self.LandingButton = wx.Button(PanelLanding, wx.ID_ANY, "Ready for Landing")
        boxLanding.Add(self.LandingButton)

        '''before shutdown checklist'''
        for key in self.beforeShutdownList:
            if self.beforeShutdownList[key] == 0:
                disCheckBox = wx.CheckBox(PanelShutdown, wx.ID_ANY, key)
                disCheckBox.Enable(False)
                boxShutdown.Add(disCheckBox)
            if self.beforeShutdownList[key] == 2:
                boxShutdown.Add(wx.CheckBox(PanelShutdown, wx.ID_ANY, key))

        self.ShutdownButton = wx.Button(PanelShutdown, wx.ID_ANY, "Ready for Shutdown")
        boxShutdown.Add(self.ShutdownButton)

        #and add in the tabs
        self.nb.AddPage(PanelAssembly, "1. During Assembly")
        self.nb.AddPage(PanelEngine, "2. Before Engine Start")
        self.nb.AddPage(PanelTakeoff, "3. Before Takeoff")
        self.nb.AddPage(PanelCruise, "4. Before Cruise/AUTO")
        self.nb.AddPage(PanelDrop, "5. Before Bottle Drop")
        self.nb.AddPage(PanelLanding, "6. Before Landing")
        self.nb.AddPage(PanelShutdown, "7. Before Shutdown")
Exemple #12
0
    def __init__(
        self,
        option_parser,  #The OptionParser object
        parent=None,
        ID=0,
        title='Optparse Dialog',
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        style=wx.DEFAULT_DIALOG_STYLE,
        name='OptparseDialog',
    ):

        provider = wx.SimpleHelpProvider()
        wx.HelpProvider_Set(provider)

        pre = wx.PreDialog()
        pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
        pre.Create(parent, ID, title, pos, size, style)

        self.PostCreate(pre)

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.option_controls = {}

        top_label_text = '%s %s' % (option_parser.get_prog_name(),
                                    option_parser.get_version())
        label = wx.StaticText(self, -1, top_label_text)
        sizer.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

        self.browse_option_map = {}

        # Add controls for all the options
        for option in option_parser.option_list:
            if option.dest is None:
                continue

            if option.help is None:
                option.help = u''

            box = wx.BoxSizer(wx.HORIZONTAL)
            if 'store' == option.action:
                label = wx.StaticText(self, -1, option.dest)
                label.SetHelpText(option.help)
                box.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

                if 'choice' == option.type:
                    if optparse.NO_DEFAULT == option.default:
                        option.default = option.choices[0]
                    ctrl = wx.ComboBox(self,
                                       -1,
                                       choices=option.choices,
                                       value=option.default,
                                       style=wx.CB_DROPDOWN | wx.CB_READONLY
                                       | wx.CB_SORT)
                else:
                    if 'MULTILINE' in option.help:
                        ctrl = wx.TextCtrl(self,
                                           -1,
                                           "",
                                           size=(300, 100),
                                           style=wx.TE_MULTILINE
                                           | wx.TE_PROCESS_ENTER)
                    else:
                        ctrl = wx.TextCtrl(self, -1, "", size=(300, -1))

                    if ( option.default != optparse.NO_DEFAULT ) and \
                       ( option.default is not None ):
                        ctrl.Value = unicode(option.default)

                box.Add(ctrl, 1, wx.ALIGN_CENTRE | wx.ALL, 5)

                if option.type in ['file', 'directory']:
                    browse = wx.Button(self, label='...')
                    browse.SetHelpText('Click to open %s browser' %
                                       (option.type))
                    self.browse_option_map[browse.GetId()] = option, ctrl
                    wx.EVT_BUTTON(self, browse.GetId(), self.OnSelectPath)
                    box.Add(browse, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

            elif option.action in ('store_true', 'store_false'):
                ctrl = wx.CheckBox(self, -1, option.dest, size=(300, -1))
                box.Add(ctrl, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
            else:
                raise NotImplementedError('Unknown option action: %s' %
                                          repr(option.action))

            ctrl.SetHelpText(option.help)
            sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

            self.option_controls[option] = ctrl

        # Add a text control for entering args
        box = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1, 'args')
        label.SetHelpText('This is the place to enter the args')

        self.args_ctrl = wx.TextCtrl(self,
                                     -1,
                                     '',
                                     size=(-1, 100),
                                     style=wx.TE_MULTILINE
                                     | wx.TE_PROCESS_ENTER)
        self.args_ctrl.SetHelpText(
            '''Args can either be separated by a space or a newline
Args the contain spaces must be entered like so: "arg with sapce"
''')
        box.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        box.Add(self.args_ctrl, 1, wx.ALIGN_CENTRE | wx.ALL, 5)

        sizer.Add(box, 0,
                  wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)

        line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
        sizer.Add(line, 0,
                  wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)

        btnsizer = wx.StdDialogButtonSizer()

        if wx.Platform != "__WXMSW__":
            btn = wx.ContextHelpButton(self)
            btnsizer.AddButton(btn)

        btn = wx.Button(self, wx.ID_OK)
        btn.SetHelpText("The OK button completes the dialog")
        btn.SetDefault()
        btnsizer.AddButton(btn)

        btn = wx.Button(self, wx.ID_CANCEL)
        btn.SetHelpText("The Cancel button cancels the dialog. (Cool, huh?)")
        btnsizer.AddButton(btn)
        btnsizer.Realize()

        sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        self.SetSizer(sizer)
        sizer.Fit(self)