Exemplo n.º 1
0
def MakeRoundButton(parent, label, bType=0):
    btn = RoundButton(parent,
                      wx.ID_ANY,
                      label,
                      size=(RoundButtonSize, RoundButtonSize))
    btn.SetBackgroundColour(wx.WHITE)
    btn.SetForegroundColour(buttonColors[bType])
    btn.SetFontToFitLabel()
    return btn
Exemplo n.º 2
0
def CreateCaptureButtons( parent ):	
	snapshot = RoundButton( parent, label="SNAPSHOT", size=(90,90) )
	snapshot.SetBackgroundColour( wx.WHITE )
	snapshot.SetForegroundColour( snapshotEnableColour )
	snapshot.SetFontToFitLabel( wx.Font(wx.FontInfo(10).Bold()) )
	snapshot.SetToolTip( _('Record a Single Frame') )
	
	autoCapture = RoundButton( parent, label="AUTO\nCAPTURE", size=(90,90) )
	autoCapture.SetBackgroundColour( wx.WHITE )
	autoCapture.SetForegroundColour( autoCaptureEnableColour )
	autoCapture.SetFontToFitLabel( wx.Font(wx.FontInfo(10).Bold()) )
	autoCapture.SetToolTip( _('Capture Video for an Automatic Interval\nSet in "Config Auto Capture"') )
	
	capture = RoundButton( parent, label="CAPTURE", size=(90,90) )
	capture.SetBackgroundColour( wx.WHITE )
	capture.SetForegroundColour( captureEnableColour )
	capture.SetFontToFitLabel( wx.Font(wx.FontInfo(10).Bold()) )
	capture.SetToolTip( _('Capture Video\nwhile the Button is held down') )
		
	return snapshot, autoCapture, capture
Exemplo n.º 3
0
    def __init__(self, parent, id=wx.ID_ANY, title='', size=(200, 200)):
        wx.Frame.__init__(self, parent, id, title, size=size)

        dataDir = Utils.getHomeDir()
        configFileName = os.path.join(dataDir, 'CrossMgrImpinj.cfg')
        self.config = wx.Config(appName="CrossMgrImpinj",
                                vendorName="SmartCyclingSolutions",
                                localFilename=configFileName)

        ID_MENU_ADVANCECONFIG = wx.NewIdRef()
        ID_MENU_COPYLOGS = wx.NewIdRef()
        ID_MENU_AUTODETECT = wx.NewIdRef()
        self.menuBar = wx.MenuBar(wx.MB_DOCKABLE)
        if 'WXMAC' in wx.Platform:
            self.appleMenu = self.menuBar.OSXGetAppleMenu()
            self.appleMenu.SetTitle("CrossMgrImpinj")

            self.appleMenu.Insert(0, wx.ID_ABOUT, "&About")

            self.Bind(wx.EVT_MENU, self.OnAboutBox, id=wx.ID_ABOUT)

            self.editMenu = wx.Menu()
            self.editMenu.Append(
                wx.MenuItem(self.editMenu, ID_MENU_ADVANCECONFIG,
                            "A&dvanced Configuration"))
            self.editMenu.Append(
                wx.MenuItem(self.editMenu, ID_MENU_COPYLOGS,
                            "&Copy Logs to Clipboard"))
            self.editMenu.Append(
                wx.MenuItem(self.editMenu, ID_MENU_AUTODETECT,
                            "&Autodetect Reader"))

            self.Bind(wx.EVT_MENU, self.doAdvanced, id=ID_MENU_ADVANCECONFIG)
            self.Bind(wx.EVT_MENU, self.doCopyToClipboard, id=ID_MENU_COPYLOGS)
            self.Bind(wx.EVT_MENU, self.doAutoDetect, id=ID_MENU_AUTODETECT)
            self.menuBar.Append(self.editMenu, "&Edit")

        else:
            self.fileMenu = wx.Menu()
            self.fileMenu.Append(
                wx.MenuItem(self.fileMenu, ID_MENU_ADVANCECONFIG,
                            "A&dvanced Configuration"))
            self.fileMenu.Append(
                wx.MenuItem(self.fileMenu, ID_MENU_COPYLOGS,
                            "&Copy Logs to Clipboard"))
            self.fileMenu.Append(
                wx.MenuItem(self.fileMenu, ID_MENU_AUTODETECT,
                            "&Autodetect Reader"))
            self.fileMenu.Append(wx.ID_EXIT)
            self.Bind(wx.EVT_MENU, self.doAdvanced, id=ID_MENU_ADVANCECONFIG)
            self.Bind(wx.EVT_MENU, self.doCopyToClipboard, id=ID_MENU_COPYLOGS)
            self.Bind(wx.EVT_MENU, self.doAutoDetect, id=ID_MENU_AUTODETECT)
            self.Bind(wx.EVT_MENU, self.onCloseWindow, id=wx.ID_EXIT)
            self.menuBar.Append(self.fileMenu, "&File")
            self.helpMenu = wx.Menu()
            self.helpMenu.Insert(0, wx.ID_ABOUT, "&About")
            self.Bind(wx.EVT_MENU, self.OnAboutBox, id=wx.ID_ABOUT)
            self.menuBar.Append(self.helpMenu, "&Help")

        self.SetMenuBar(self.menuBar)
        self.SetBackgroundColour(wx.Colour(232, 232, 232))

        self.LightGreen = wx.Colour(153, 255, 153)
        self.LightRed = wx.Colour(255, 153, 153)

        font = self.GetFont()
        bigFont = wx.Font(int(font.GetPointSize() * 1.2), font.GetFamily(),
                          font.GetStyle(), wx.FONTWEIGHT_BOLD)
        titleFont = wx.Font(int(bigFont.GetPointSize() * 2.2),
                            bigFont.GetFamily(), bigFont.GetStyle(),
                            bigFont.GetWeight())

        self.vbs = wx.BoxSizer(wx.VERTICAL)

        bs = wx.BoxSizer(wx.HORIZONTAL)

        self.reset = RoundButton(self, label='Reset', size=(80, 80))
        self.reset.SetBackgroundColour(wx.WHITE)
        self.reset.SetForegroundColour(wx.Colour(0, 128, 128))
        self.reset.SetFontToFitLabel(
        )  # Use the button's default font, but change the font size to fit the label.
        self.reset.Bind(wx.EVT_BUTTON, self.doReset)
        self.reset.Refresh()
        bs.Add(self.reset, border=8, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        bs.Add(setFont(titleFont, wx.StaticText(self, label='CrossMgrImpinj')),
               border=8,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        bs.AddStretchSpacer()
        bitmap = wx.Bitmap(clipboard_xpm)
        self.copyToClipboard = wx.BitmapButton(self, bitmap=bitmap)
        self.copyToClipboard.SetToolTip(
            wx.ToolTip('Copy Configuration and Logs to Clipboard...'))
        self.copyToClipboard.Bind(wx.EVT_BUTTON, self.doCopyToClipboard)
        bs.Add(self.copyToClipboard,
               border=32,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        self.tStart = datetime.datetime.now()
        bs.Add(setFont(
            bigFont,
            wx.StaticText(self,
                          label='Last Reset: %s' %
                          self.tStart.strftime('%H:%M:%S'))),
               border=10,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        self.runningTime = setFont(bigFont,
                                   wx.StaticText(self, label='00:00:00'))
        bs.Add(self.runningTime,
               border=20,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        bs.Add(setFont(bigFont, wx.StaticText(self, label=' / ')),
               flag=wx.ALIGN_CENTER_VERTICAL)
        self.time = setFont(bigFont, wx.StaticText(self, label='00:00:00'))
        bs.Add(self.time, flag=wx.ALIGN_CENTER_VERTICAL)

        self.vbs.Add(bs, flag=wx.ALL | wx.EXPAND, border=4)

        fgs = wx.FlexGridSizer(rows=2, cols=2, vgap=4, hgap=4)
        fgs.AddGrowableRow(1)
        fgs.AddGrowableCol(0)
        fgs.AddGrowableCol(1)
        fgs.SetFlexibleDirection(wx.BOTH)

        self.vbs.Add(fgs, flag=wx.EXPAND, proportion=5)

        #------------------------------------------------------------------------------------------------
        # Impinj configuration.
        #
        gbs = wx.GridBagSizer(4, 4)
        fgs.Add(gbs, flag=wx.EXPAND | wx.ALL, border=4)

        iRow = 0
        hb = wx.BoxSizer(wx.HORIZONTAL)
        hb.Add(setFont(bigFont,
                       wx.StaticText(self, label='Impinj Configuration:')),
               flag=wx.ALIGN_CENTER_VERTICAL)
        self.autoDetectButton = wx.Button(self, label='Auto Detect')
        self.autoDetectButton.Bind(wx.EVT_BUTTON, self.doAutoDetect)
        hb.Add(self.autoDetectButton, flag=wx.LEFT, border=6)

        self.advancedButton = wx.Button(self, label='Advanced...')
        self.advancedButton.Bind(wx.EVT_BUTTON, self.doAdvanced)
        hb.Add(self.advancedButton, flag=wx.LEFT, border=6)

        gbs.Add(hb, pos=(iRow, 0), span=(1, 2), flag=wx.ALIGN_LEFT)

        iRow += 1

        gs = wx.GridSizer(rows=0, cols=4, vgap=0, hgap=2)
        self.antennaLabels = []
        self.antennas = []
        for i in range(4):
            self.antennaLabels.append(
                wx.StaticText(self,
                              label='{}'.format(i + 1),
                              style=wx.ALIGN_CENTER))
            gs.Add(self.antennaLabels[-1], flag=wx.ALIGN_CENTER | wx.EXPAND)
        for i in range(4):
            cb = wx.CheckBox(self, wx.ID_ANY, '')
            if i < 2:
                cb.SetValue(True)
            cb.Bind(wx.EVT_CHECKBOX, lambda x: self.getAntennaStr())
            gs.Add(cb, flag=wx.ALIGN_CENTER)
            self.antennas.append(cb)

        hb = wx.BoxSizer()
        hb.Add(gs)
        self.methodName = wx.StaticText(self)
        self.refreshMethodName()
        hb.Add(self.methodName, flag=wx.ALIGN_BOTTOM | wx.LEFT, border=8)

        gbs.Add(wx.StaticText(self, label='ANT Ports:'),
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM)
        gbs.Add(hb, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL)

        iRow += 1

        self.useHostName = wx.RadioButton(self,
                                          label='Host Name:',
                                          style=wx.RB_GROUP)
        gbs.Add(self.useHostName,
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_CENTER_VERTICAL)
        hb = wx.BoxSizer(wx.HORIZONTAL)
        hb.Add(wx.StaticText(self, label=ImpinjHostNamePrefix),
               flag=wx.ALIGN_CENTER_VERTICAL)
        if 'WXMAC' in wx.Platform:
            self.impinjHostName = masked.TextCtrl(
                self,
                defaultValue='00-00-00',
                useFixedWidthFont=True,
                size=(80, -1),
            )
        else:
            self.impinjHostName = masked.TextCtrl(
                self,
                mask='NN-NN-NN',
                defaultValue='00-00-00',
                useFixedWidthFont=True,
                size=(80, -1),
            )
        hb.Add(self.impinjHostName)
        hb.Add(wx.StaticText(self, label=ImpinjHostNameSuffix),
               flag=wx.ALIGN_CENTER_VERTICAL)
        hb.Add(wx.StaticText(self,
                             label=' : ' + '{}'.format(ImpinjInboundPort)),
               flag=wx.ALIGN_CENTER_VERTICAL)
        gbs.Add(hb, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_LEFT)

        iRow += 1
        self.useStaticAddress = wx.RadioButton(self, label='IP:')
        gbs.Add(self.useStaticAddress,
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_CENTER_VERTICAL)
        hb = wx.BoxSizer(wx.HORIZONTAL)
        self.impinjHost = IpAddrCtrl(self, style=wx.TE_PROCESS_TAB)
        hb.Add(self.impinjHost)
        hb.Add(wx.StaticText(self,
                             label=' : ' + '{}'.format(ImpinjInboundPort)),
               flag=wx.ALIGN_CENTER_VERTICAL)

        gbs.Add(hb, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_LEFT)

        self.useHostName.SetValue(True)
        self.useStaticAddress.SetValue(False)

        iRow += 1
        self.antennaReads = AntennaReads(self)
        gbs.Add(self.antennaReads,
                pos=(iRow, 0),
                span=(1, 3),
                flag=wx.ALIGN_LEFT | wx.EXPAND)

        iRow += 1
        self.antennaReadCount = wx.StaticText(
            self,
            label='ANT Reads: 1:0 0% | 2:0 0% | 3:0 0% | 4:0 0%               '
        )
        gbs.Add(self.antennaReadCount,
                pos=(iRow, 0),
                span=(1, 3),
                flag=wx.ALIGN_LEFT)

        iRow += 1
        gbs.Add(wx.StaticText(self, label='Backup File:'),
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_RIGHT)
        self.backupFile = wx.StaticText(
            self, label='                                                   ')
        gbs.Add(self.backupFile,
                pos=(iRow, 1),
                span=(1, 2),
                flag=wx.ALIGN_LEFT)

        #------------------------------------------------------------------------------------------------
        # CrossMgr configuration.
        #
        cmcs = wx.BoxSizer(wx.VERTICAL)
        fgs.Add(cmcs, flag=wx.EXPAND | wx.ALL, border=4)

        cmcs.Add(
            setFont(bigFont,
                    wx.StaticText(self, label='CrossMgr Configuration:')))
        hh = wx.BoxSizer(wx.HORIZONTAL)
        hh.Add(wx.StaticText(self, label='CrossMgr Address:'),
               flag=wx.ALIGN_CENTER_VERTICAL)
        self.crossMgrHost = IpAddrCtrl(self, style=wx.TE_PROCESS_TAB)
        hh.Add(self.crossMgrHost, flag=wx.ALIGN_LEFT)
        hh.Add(wx.StaticText(self, label=' : 53135'),
               flag=wx.ALIGN_CENTER_VERTICAL)
        cmcs.Add(hh, flag=wx.ALL, border=4)

        #------------------------------------------------------------------------------------------------
        # Add strays
        #
        cmcs.Add(wx.StaticLine(self, style=wx.LI_HORIZONTAL),
                 flag=wx.EXPAND | wx.TOP | wx.BOTTOM,
                 border=2)
        self.strayTagsLabel = wx.StaticText(self, label='Stray Tags:         ')
        cmcs.Add(self.strayTagsLabel, flag=wx.LEFT | wx.RIGHT, border=4)

        self.strays = wx.ListCtrl(self,
                                  style=wx.LC_REPORT | wx.BORDER_SUNKEN,
                                  size=(-1, 50))
        self.strays.InsertColumn(0, 'Tag', wx.LIST_AUTOSIZE_USEHEADER)
        self.strays.InsertColumn(1, 'Time', wx.LIST_AUTOSIZE_USEHEADER)

        cmcs.Add(self.strays,
                 1,
                 flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                 border=4)

        #------------------------------------------------------------------------------------------------
        # Add messages
        #
        self.impinjMessagesText = wx.TextCtrl(self,
                                              style=wx.TE_READONLY
                                              | wx.TE_MULTILINE | wx.HSCROLL,
                                              size=(-1, 400))
        fgs.Add(self.impinjMessagesText, flag=wx.EXPAND, proportion=2)
        self.impinjMessages = MessageManager(self.impinjMessagesText)

        self.crossMgrMessagesText = wx.TextCtrl(self,
                                                style=wx.TE_READONLY
                                                | wx.TE_MULTILINE | wx.HSCROLL,
                                                size=(-1, 400))
        fgs.Add(self.crossMgrMessagesText, flag=wx.EXPAND, proportion=2)
        self.crossMgrMessages = MessageManager(self.crossMgrMessagesText)
        self.fgs = fgs

        #------------------------------------------------------------------------------------------------
        # Create a timer to update the messages.
        #
        self.timer = wx.Timer()
        self.timer.Bind(wx.EVT_TIMER, self.updateMessages)
        self.timer.Start(1000, False)

        self.Bind(wx.EVT_CLOSE, self.onCloseWindow)

        self.readOptions()

        self.SetSizer(self.vbs)
        self.start()
Exemplo n.º 4
0
    def __init__(self, parent, id=wx.ID_ANY, title='', size=(200, 200)):
        wx.Frame.__init__(self, parent, id, title, size=size)

        self.config = wx.Config(
            appName="CrossMgrImpinj",
            vendorName="SmartCyclingSolutions",
            #style=wx.Config.CONFIG_USE_LOCAL_FILE
        )

        self.SetBackgroundColour(wx.Colour(232, 232, 232))

        self.LightGreen = wx.Colour(153, 255, 153)
        self.LightRed = wx.Colour(255, 153, 153)

        font = self.GetFont()
        bigFont = wx.Font(int(font.GetPointSize() * 1.5), font.GetFamily(),
                          font.GetStyle(), wx.FONTWEIGHT_BOLD)
        titleFont = wx.Font(int(bigFont.GetPointSize() * 2.2),
                            bigFont.GetFamily(), bigFont.GetStyle(),
                            bigFont.GetWeight())

        self.vbs = wx.BoxSizer(wx.VERTICAL)

        bs = wx.BoxSizer(wx.HORIZONTAL)

        self.reset = RoundButton(self, label='Reset', size=(80, 80))
        self.reset.SetBackgroundColour(wx.WHITE)
        self.reset.SetForegroundColour(wx.Colour(0, 128, 128))
        self.reset.SetFontToFitLabel(
        )  # Use the button's default font, but change the font size to fit the label.
        self.reset.Bind(wx.EVT_BUTTON, self.doReset)
        self.reset.Refresh()
        bs.Add(self.reset, border=8, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        bs.Add(setFont(titleFont, wx.StaticText(self, label='CrossMgrImpinj')),
               border=8,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        bs.AddStretchSpacer()
        bitmap = wx.Bitmap(clipboard_xpm)
        self.copyToClipboard = wx.BitmapButton(self, bitmap=bitmap)
        self.copyToClipboard.SetToolTip(
            wx.ToolTip('Copy Configuration and Logs to Clipboard...'))
        self.copyToClipboard.Bind(wx.EVT_BUTTON, self.doCopyToClipboard)
        bs.Add(self.copyToClipboard,
               border=32,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        self.tStart = datetime.datetime.now()
        bs.Add(setFont(
            bigFont,
            wx.StaticText(self,
                          label='Last Reset: %s' %
                          self.tStart.strftime('%H:%M:%S'))),
               border=10,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        self.runningTime = setFont(bigFont,
                                   wx.StaticText(self, label='00:00:00'))
        bs.Add(self.runningTime,
               border=20,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        bs.Add(setFont(bigFont, wx.StaticText(self, label=' / ')),
               flag=wx.ALIGN_CENTER_VERTICAL)
        self.time = setFont(bigFont, wx.StaticText(self, label='00:00:00'))
        bs.Add(self.time, flag=wx.ALIGN_CENTER_VERTICAL)

        self.vbs.Add(bs, flag=wx.ALL | wx.EXPAND, border=4)

        fgs = wx.FlexGridSizer(rows=2, cols=2, vgap=4, hgap=4)
        fgs.AddGrowableRow(1)
        fgs.AddGrowableCol(0)
        fgs.AddGrowableCol(1)
        fgs.SetFlexibleDirection(wx.BOTH)

        self.vbs.Add(fgs, flag=wx.EXPAND, proportion=5)

        #------------------------------------------------------------------------------------------------
        # Impinj configuration.
        #
        gbs = wx.GridBagSizer(4, 4)
        fgs.Add(gbs, flag=wx.EXPAND | wx.ALL, border=4)

        iRow = 0
        hb = wx.BoxSizer(wx.HORIZONTAL)
        hb.Add(setFont(bigFont,
                       wx.StaticText(self, label='Impinj Configuration:')),
               flag=wx.ALIGN_CENTER_VERTICAL)
        self.autoDetectButton = wx.Button(self, label='Auto Detect')
        self.autoDetectButton.Bind(wx.EVT_BUTTON, self.doAutoDetect)
        hb.Add(self.autoDetectButton, flag=wx.LEFT, border=6)

        self.advancedButton = wx.Button(self, label='Advanced...')
        self.advancedButton.Bind(wx.EVT_BUTTON, self.doAdvanced)
        hb.Add(self.advancedButton, flag=wx.LEFT, border=6)

        gbs.Add(hb, pos=(iRow, 0), span=(1, 2), flag=wx.ALIGN_LEFT)

        iRow += 1

        gs = wx.GridSizer(rows=0, cols=4, vgap=0, hgap=2)
        self.antennaLabels = []
        self.antennas = []
        for i in xrange(4):
            self.antennaLabels.append(
                wx.StaticText(self,
                              label='{}'.format(i + 1),
                              style=wx.ALIGN_CENTER))
            gs.Add(self.antennaLabels[-1], flag=wx.ALIGN_CENTER | wx.EXPAND)
        for i in xrange(4):
            cb = wx.CheckBox(self, wx.ID_ANY, '')
            if i < 2:
                cb.SetValue(True)
            cb.Bind(wx.EVT_CHECKBOX, lambda x: self.getAntennaStr())
            gs.Add(cb, flag=wx.ALIGN_CENTER)
            self.antennas.append(cb)

        gbs.Add(wx.StaticText(self, label='ANT Ports:'),
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM)
        gbs.Add(gs, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL)

        iRow += 1

        self.useHostName = wx.RadioButton(self,
                                          label='Host Name:',
                                          style=wx.RB_GROUP)
        gbs.Add(self.useHostName,
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_CENTER_VERTICAL)
        hb = wx.BoxSizer(wx.HORIZONTAL)
        hb.Add(wx.StaticText(self, label=ImpinjHostNamePrefix),
               flag=wx.ALIGN_CENTER_VERTICAL)
        self.impinjHostName = masked.TextCtrl(
            self,
            mask='NN-NN-NN',
            defaultValue='00-00-00',
            useFixedWidthFont=True,
            size=(80, -1),
        )
        hb.Add(self.impinjHostName)
        hb.Add(wx.StaticText(self, label=ImpinjHostNameSuffix),
               flag=wx.ALIGN_CENTER_VERTICAL)
        hb.Add(wx.StaticText(self,
                             label=' : ' + '{}'.format(ImpinjInboundPort)),
               flag=wx.ALIGN_CENTER_VERTICAL)
        gbs.Add(hb, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_LEFT)

        iRow += 1
        self.useStaticAddress = wx.RadioButton(self, label='IP:')
        gbs.Add(self.useStaticAddress,
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_CENTER_VERTICAL)
        hb = wx.BoxSizer(wx.HORIZONTAL)
        self.impinjHost = IpAddrCtrl(self, style=wx.TE_PROCESS_TAB)
        hb.Add(self.impinjHost)
        hb.Add(wx.StaticText(self,
                             label=' : ' + '{}'.format(ImpinjInboundPort)),
               flag=wx.ALIGN_CENTER_VERTICAL)

        gbs.Add(hb, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_LEFT)

        self.useHostName.SetValue(True)
        self.useStaticAddress.SetValue(False)

        iRow += 1
        gbs.Add(wx.StaticText(self, label='ANT Reads:'),
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_RIGHT)
        self.antennaReadCount = wx.StaticText(
            self, label='1:0 0% | 2:0 0% | 3:0 0% | 4:0 0%               ')
        gbs.Add(self.antennaReadCount,
                pos=(iRow, 1),
                span=(1, 2),
                flag=wx.ALIGN_LEFT)

        iRow += 1
        gbs.Add(wx.StaticText(self, label='Backup File:'),
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_RIGHT)
        self.backupFile = wx.StaticText(
            self, label='                                                   ')
        gbs.Add(self.backupFile,
                pos=(iRow, 1),
                span=(1, 2),
                flag=wx.ALIGN_LEFT)

        #------------------------------------------------------------------------------------------------
        # CrossMgr configuration.
        #
        gbs = wx.GridBagSizer(4, 4)
        fgs.Add(gbs, flag=wx.EXPAND | wx.ALL, border=4)

        gbs.Add(setFont(bigFont,
                        wx.StaticText(self, label='CrossMgr Configuration:')),
                pos=(0, 0),
                span=(1, 2),
                flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
        gbs.Add(wx.StaticText(self, label='CrossMgr Address:'),
                pos=(1, 0),
                span=(1, 1),
                flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)

        hb = wx.BoxSizer(wx.HORIZONTAL)
        self.crossMgrHost = IpAddrCtrl(self, style=wx.TE_PROCESS_TAB)
        hb.Add(self.crossMgrHost, flag=wx.ALIGN_LEFT)
        hb.Add(wx.StaticText(self, label=' : 53135'),
               flag=wx.ALIGN_CENTER_VERTICAL)
        gbs.Add(hb, pos=(1, 1), span=(1, 1), flag=wx.ALIGN_LEFT)

        #------------------------------------------------------------------------------------------------
        # Add messages
        #
        self.impinjMessagesText = wx.TextCtrl(self,
                                              style=wx.TE_READONLY
                                              | wx.TE_MULTILINE | wx.HSCROLL,
                                              size=(-1, 400))
        fgs.Add(self.impinjMessagesText, flag=wx.EXPAND, proportion=2)
        self.impinjMessages = MessageManager(self.impinjMessagesText)

        self.crossMgrMessagesText = wx.TextCtrl(self,
                                                style=wx.TE_READONLY
                                                | wx.TE_MULTILINE | wx.HSCROLL,
                                                size=(-1, 400))
        fgs.Add(self.crossMgrMessagesText, flag=wx.EXPAND, proportion=2)
        self.crossMgrMessages = MessageManager(self.crossMgrMessagesText)
        self.fgs = fgs

        #------------------------------------------------------------------------------------------------
        # Create a timer to update the messages.
        #
        self.timer = wx.Timer()
        self.timer.Bind(wx.EVT_TIMER, self.updateMessages)
        self.timer.Start(1000, False)

        self.Bind(wx.EVT_CLOSE, self.onCloseWindow)

        self.readOptions()

        self.SetSizer(self.vbs)
        self.start()
Exemplo n.º 5
0
    def __init__(self, parent, id=wx.ID_ANY):
        wx.Panel.__init__(self, parent, id)

        self.SetBackgroundColour(wx.Colour(255, 255, 255))

        ps = wx.BoxSizer(wx.VERTICAL)
        self.splitter = wx.SplitterWindow(self, wx.VERTICAL)
        ps.Add(self.splitter, 1, flag=wx.EXPAND)
        self.SetSizer(ps)

        #---------------------------------------------------------------------------------------------

        self.leftPanel = wx.Panel(self.splitter)
        bs = wx.BoxSizer(wx.VERTICAL)
        self.leftPanel.SetSizer(bs)
        self.leftPanel.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.leftPanel.Bind(wx.EVT_SIZE, self.setWrappedRaceInfo)

        buttonSize = 220
        self.button = RoundButton(self.leftPanel,
                                  size=(buttonSize, buttonSize))
        self.button.SetLabel(FinishText)
        self.button.SetFontToFitLabel()
        self.button.SetForegroundColour(wx.Colour(128, 128, 128))
        self.Bind(wx.EVT_BUTTON, self.onPress, self.button)

        self.clock = Clock(self, size=(190, 190), checkFunc=self.updateClock)
        self.clock.SetBackgroundColour(wx.WHITE)

        self.raceIntro = wx.StaticText(self.leftPanel, label=u'')
        self.raceIntro.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL))

        self.chipTimingOptions = wx.RadioBox(
            self.leftPanel,
            label=_("Chip Timing Options"),
            majorDimension=1,
            choices=Properties.RfidProperties.choices,
            style=wx.RA_SPECIFY_COLS)

        self.Bind(wx.EVT_RADIOBOX, self.onChipTimingOptions,
                  self.chipTimingOptions)

        self.settingsButton = wx.BitmapButton(
            self.leftPanel, bitmap=Utils.GetPngBitmap('settings-icon.png'))
        self.settingsButton.SetToolTip(wx.ToolTip(_('Properties Shortcut')))
        self.settingsButton.Bind(wx.EVT_BUTTON, self.onShowProperties)

        self.startRaceTimeCheckBox = wx.CheckBox(
            self.leftPanel, label=_('Start Race Automatically at Future Time'))

        hsSettings = wx.BoxSizer(wx.HORIZONTAL)
        hsSettings.Add(self.settingsButton, flag=wx.ALIGN_CENTER_VERTICAL)
        hsSettings.Add(self.startRaceTimeCheckBox,
                       flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL,
                       border=12)

        border = 8
        hs = wx.BoxSizer(wx.HORIZONTAL)
        hs.Add(self.button, border=border, flag=wx.LEFT | wx.TOP)
        hs.Add(self.raceIntro,
               1,
               border=border,
               flag=wx.LEFT | wx.TOP | wx.RIGHT | wx.EXPAND)
        bs.Add(hs, border=border, flag=wx.ALL)

        hsClock = wx.BoxSizer(wx.HORIZONTAL)
        hsClock.AddSpacer(26)
        hsClock.Add(self.clock)
        hsClock.Add(hsSettings, border=4, flag=wx.LEFT)
        bs.Add(hsClock, border=4, flag=wx.ALL)

        bs.Add(self.chipTimingOptions, border=border, flag=wx.ALL)

        #---------------------------------------------------------------------------------------------

        self.rightPanel = wx.Panel(self.splitter)
        self.rightPanel.SetBackgroundColour(wx.Colour(255, 255, 255))
        checklistTitle = wx.StaticText(self.rightPanel, label=_('Checklist:'))
        checklistTitle.SetFont(
            wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_NORMAL))
        self.checklist = Checklist.Checklist(self.rightPanel)

        hsSub = wx.BoxSizer(wx.VERTICAL)
        hsSub.Add(checklistTitle, 0, flag=wx.ALL, border=4)
        hsSub.Add(self.checklist,
                  1,
                  flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
                  border=4)
        self.rightPanel.SetSizer(hsSub)

        #---------------------------------------------------------------------------------------------

        self.splitter.SplitVertically(self.leftPanel, self.rightPanel)
        self.splitter.SetMinimumPaneSize(100)
        wx.CallAfter(self.refresh)
        wx.CallAfter(self.splitter.SetSashPosition, 650)
        wx.CallAfter(self.GetSizer().Layout)
Exemplo n.º 6
0
    def __init__(self, parent, id=wx.ID_ANY, title='', size=(200, 200)):
        wx.Frame.__init__(self, parent, id, title, size=size)

        self.SetBackgroundColour(wx.Colour(240, 240, 240))

        self.fname = None
        self.updated = False
        self.firstTime = True
        self.lastUpdateTime = None
        self.comments = []

        self.filehistory = wx.FileHistory(16)
        self.config = wx.Config(appName="StageRaceGC",
                                vendorName="*****@*****.**",
                                style=wx.CONFIG_USE_LOCAL_FILE)
        self.filehistory.Load(self.config)

        inputBox = wx.StaticBox(self, label=_('Input'))
        inputBoxSizer = wx.StaticBoxSizer(inputBox, wx.VERTICAL)
        self.fileBrowse = filebrowse.FileBrowseButtonWithHistory(
            self,
            labelText=_('Excel File'),
            buttonText=('Browse...'),
            startDirectory=os.path.expanduser('~'),
            fileMask=
            'Excel Spreadsheet (*.xlsx; *.xlsm; *.xls)|*.xlsx; *.xlsml; *.xls',
            size=(400, -1),
            history=lambda: [
                self.filehistory.GetHistoryFile(i)
                for i in xrange(self.filehistory.GetCount())
            ],
            changeCallback=self.doChangeCallback,
        )
        inputBoxSizer.Add(self.fileBrowse,
                          0,
                          flag=wx.EXPAND | wx.ALL,
                          border=4)

        horizontalControlSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.updateButton = RoundButton(self, size=(96, 96))
        self.updateButton.SetLabel(_('Update'))
        self.updateButton.SetFontToFitLabel()
        self.updateButton.SetForegroundColour(wx.Colour(0, 100, 0))
        self.updateButton.Bind(wx.EVT_BUTTON, self.doUpdate)
        horizontalControlSizer.Add(self.updateButton, flag=wx.ALL, border=4)

        horizontalControlSizer.AddSpacer(48)

        vs = wx.BoxSizer(wx.VERTICAL)
        self.tutorialButton = wx.Button(self, label=_('Help/Tutorial...'))
        self.tutorialButton.Bind(wx.EVT_BUTTON, self.onTutorial)
        vs.Add(self.tutorialButton, flag=wx.ALL, border=4)
        branding = wx.adv.HyperlinkCtrl(
            self,
            id=wx.ID_ANY,
            label=u"Powered by CrossMgr",
            url=u"http://www.sites.google.com/site/crossmgrsoftware/")
        vs.Add(branding, flag=wx.ALL, border=4)
        horizontalControlSizer.Add(vs)

        self.openExcel = wx.Button(self, label=_('Open Excel File...'))
        self.openExcel.Bind(wx.EVT_BUTTON, self.onOpenExcel)

        horizontalControlSizer.AddSpacer(48)
        horizontalControlSizer.Add(self.openExcel,
                                   flag=wx.ALIGN_RIGHT | wx.ALL,
                                   border=4)

        inputBoxSizer.Add(horizontalControlSizer, flag=wx.EXPAND)

        self.stageList = ListMixCtrl(self, style=wx.LC_REPORT, size=(-1, 160))
        self.stageList.InsertColumn(0, "Sheet")
        self.stageList.InsertColumn(1, "Bibs", wx.LIST_FORMAT_RIGHT)
        self.stageList.InsertColumn(2, "Errors/Warnings")
        self.stageList.setResizeColumn(2)

        bookStyle = (flatnotebook.FNB_NO_X_BUTTON
                     | flatnotebook.FNB_FF2
                     | flatnotebook.FNB_NODRAG
                     | flatnotebook.FNB_DROPDOWN_TABS_LIST
                     | flatnotebook.FNB_NO_NAV_BUTTONS
                     | flatnotebook.FNB_BOTTOM)
        self.notebook = flatnotebook.FlatNotebook(self,
                                                  1000,
                                                  agwStyle=bookStyle)
        self.notebook.SetBackgroundColour(wx.WHITE)

        self.saveAsExcelButton = wx.Button(self, label=u'Save as Excel')
        self.saveAsExcelButton.Bind(wx.EVT_BUTTON, self.saveAsExcel)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(inputBoxSizer, flag=wx.EXPAND | wx.ALL, border=4)
        mainSizer.Add(self.stageList, flag=wx.EXPAND | wx.ALL, border=4)
        mainSizer.Add(self.notebook, 1, flag=wx.EXPAND | wx.ALL, border=4)
        mainSizer.Add(self.saveAsExcelButton, flag=wx.ALL, border=4)

        self.SetSizer(mainSizer)
Exemplo n.º 7
0
    def __init__(self, parent, id=wx.ID_ANY, title='', size=(200, 200)):
        wx.Frame.__init__(self, parent, id, title, size=size)

        self.config = wx.Config(
            appName="CrossMgrAlien",
            vendorName="SmartCyclingSolutions",
            #style=wx.CONFIG_USE_LOCAL_FILE
        )

        self.SetBackgroundColour(wx.Colour(232, 232, 232))

        self.LightGreen = wx.Colour(153, 255, 153)
        self.LightRed = wx.Colour(255, 153, 153)

        font = self.GetFont()
        bigFont = wx.Font(font.GetPointSize() * 1.5, font.GetFamily(),
                          font.GetStyle(), wx.FONTWEIGHT_BOLD)
        titleFont = wx.Font(bigFont.GetPointSize() * 2.2, bigFont.GetFamily(),
                            bigFont.GetStyle(), bigFont.GetWeight())

        self.vbs = wx.BoxSizer(wx.VERTICAL)

        bs = wx.BoxSizer(wx.HORIZONTAL)

        self.reset = RoundButton(self, wx.ID_ANY, 'Reset', size=(80, 80))
        self.reset.SetBackgroundColour(wx.WHITE)
        self.reset.SetForegroundColour(wx.Colour(0, 128, 128))
        self.reset.SetFontToFitLabel(
        )  # Use the button's default font, but change the font size to fit the label.
        self.reset.Bind(wx.EVT_BUTTON, self.doReset)
        self.reset.Refresh()
        bs.Add(self.reset, border=8, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        bs.Add(setFont(titleFont,
                       wx.StaticText(self, wx.ID_ANY, 'CrossMgrAlien')),
               border=8,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        bs.AddStretchSpacer()
        bitmap = wx.Bitmap(clipboard_xpm)
        self.copyToClipboard = wx.BitmapButton(self, wx.ID_ANY, bitmap)
        self.copyToClipboard.SetToolTip(
            wx.ToolTip('Copy Configuration and Logs to Clipboard...'))
        self.copyToClipboard.Bind(wx.EVT_BUTTON, self.doCopyToClipboard)
        bs.Add(self.copyToClipboard,
               border=32,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        self.tStart = datetime.datetime.now()
        bs.Add(setFont(
            bigFont,
            wx.StaticText(
                self, wx.ID_ANY,
                'Last Reset: {}'.format(self.tStart.strftime('%H:%M:%S')))),
               border=10,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        self.runningTime = setFont(bigFont,
                                   wx.StaticText(self, wx.ID_ANY, '00:00:00'))
        bs.Add(self.runningTime,
               border=20,
               flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL)
        bs.Add(setFont(bigFont, wx.StaticText(self, wx.ID_ANY, ' / ')),
               flag=wx.ALIGN_CENTER_VERTICAL)
        self.time = setFont(bigFont, wx.StaticText(self, wx.ID_ANY,
                                                   '00:00:00'))
        bs.Add(self.time, flag=wx.ALIGN_CENTER_VERTICAL)

        self.vbs.Add(bs, flag=wx.ALL | wx.EXPAND, border=4)

        fgs = wx.FlexGridSizer(rows=0, cols=2, vgap=4, hgap=4)
        fgs.AddGrowableRow(1)
        fgs.AddGrowableCol(0)
        fgs.AddGrowableCol(1)
        fgs.SetFlexibleDirection(wx.BOTH)

        self.vbs.Add(fgs, flag=wx.EXPAND, proportion=5)

        #------------------------------------------------------------------------------------------------
        # Alien configuration.
        #
        gbs = wx.GridBagSizer(4, 4)
        fgs.Add(gbs, flag=wx.EXPAND | wx.ALL, border=4)

        iRow = 0
        hs = wx.BoxSizer(wx.HORIZONTAL)
        hs.Add(setFont(bigFont,
                       wx.StaticText(self, wx.ID_ANY, 'Alien Configuration:')),
               flag=wx.ALIGN_CENTER_VERTICAL)
        self.autoDetectButton = wx.Button(self, wx.ID_ANY, 'Auto Detect')
        self.autoDetectButton.Bind(wx.EVT_BUTTON, self.doAutoDetect)
        hs.Add(self.autoDetectButton,
               flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT,
               border=6)

        self.advancedButton = wx.Button(self, wx.ID_ANY, 'Advanced...')
        self.advancedButton.Bind(wx.EVT_BUTTON, self.doAdvanced)
        hs.Add(self.advancedButton, flag=wx.LEFT, border=6)

        gbs.Add(hs, pos=(iRow, 0), span=(1, 2), flag=wx.ALIGN_LEFT)
        iRow += 1

        gbs.Add(wx.StaticText(self, wx.ID_ANY, 'Antennas:'),
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM)

        gs = wx.GridSizer(rows=0, cols=4, hgap=2, vgap=2)
        self.antennas = []
        for i in range(4):
            gs.Add(wx.StaticText(self, wx.ID_ANY, '{}'.format(i)),
                   flag=wx.ALIGN_CENTER)
        for i in range(4):
            cb = wx.CheckBox(self, wx.ID_ANY, '')
            if i < 2:
                cb.SetValue(True)
            cb.Bind(wx.EVT_CHECKBOX, lambda x: self.getAntennaStr())
            gs.Add(cb, flag=wx.ALIGN_CENTER)
            self.antennas.append(cb)

        gbs.Add(gs, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL)

        iRow += 1

        gbs.Add(wx.StaticText(self, wx.ID_ANY, 'Notify Address:'),
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)

        hb = wx.BoxSizer(wx.HORIZONTAL)
        ips = Utils.GetAllIps()
        self.notifyHost = wx.Choice(self, choices=ips)
        hb.Add(self.notifyHost)
        hb.Add(wx.StaticText(self, label=' : {}'.format(NotifyPort)),
               flag=wx.ALIGN_CENTER_VERTICAL)
        gbs.Add(hb, pos=(iRow, 1), span=(1, 1))

        iRow += 1
        self.listenForHeartbeat = wx.CheckBox(
            self,
            label='Listen for Alien Heartbeat on Port: {}'.format(
                HeartbeatPort),
            style=wx.ALIGN_LEFT)
        self.listenForHeartbeat.SetValue(True)
        gbs.Add(self.listenForHeartbeat, pos=(iRow, 0), span=(1, 2))

        iRow += 1
        gbs.Add(wx.StaticText(self, label='Alien Cmd Address:'),
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        hb = wx.BoxSizer(wx.HORIZONTAL)
        self.cmdHost = IpAddrCtrl(self, wx.ID_ANY, style=wx.TE_PROCESS_TAB)

        hb.Add(self.cmdHost)
        hb.Add(wx.StaticText(self, label=' : '), flag=wx.ALIGN_CENTER_VERTICAL)
        self.cmdPort = intctrl.IntCtrl(self, size=(50, -1), min=0, max=999999)
        hb.Add(self.cmdPort, flag=wx.ALIGN_CENTER_VERTICAL)
        gbs.Add(hb, pos=(iRow, 1), span=(1, 1), flag=wx.ALIGN_LEFT)

        iRow += 1
        gbs.Add(wx.StaticText(self, label='Backup File:'),
                pos=(iRow, 0),
                span=(1, 1),
                flag=wx.ALIGN_RIGHT)
        self.backupFile = wx.StaticText(self, label='')
        gbs.Add(self.backupFile,
                pos=(iRow, 1),
                span=(1, 1),
                flag=wx.ALIGN_LEFT)

        #------------------------------------------------------------------------------------------------
        # CrossMgr configuration.
        #
        gbs = wx.GridBagSizer(4, 4)
        fgs.Add(gbs, flag=wx.EXPAND | wx.ALL, border=4)

        gbs.Add(setFont(bigFont,
                        wx.StaticText(self, label='CrossMgr Configuration:')),
                pos=(0, 0),
                span=(1, 2),
                flag=wx.ALIGN_LEFT)
        gbs.Add(wx.StaticText(self, label='CrossMgr Address:'),
                pos=(1, 0),
                span=(1, 1),
                flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)

        hb = wx.BoxSizer(wx.HORIZONTAL)
        self.crossMgrHost = IpAddrCtrl(self, style=wx.TE_PROCESS_TAB)
        hb.Add(self.crossMgrHost, flag=wx.ALIGN_LEFT)
        hb.Add(wx.StaticText(self, label=' : 53135'),
               flag=wx.ALIGN_CENTER_VERTICAL)
        gbs.Add(hb, pos=(1, 1), span=(1, 1), flag=wx.ALIGN_LEFT)

        #------------------------------------------------------------------------------------------------
        # Add messages
        #
        self.alienMessagesText = wx.TextCtrl(self,
                                             style=wx.TE_READONLY
                                             | wx.TE_MULTILINE | wx.HSCROLL,
                                             size=(-1, 400))
        fgs.Add(self.alienMessagesText, flag=wx.EXPAND, proportion=2)
        self.alienMessages = MessageManager(self.alienMessagesText)

        self.crossMgrMessagesText = wx.TextCtrl(self,
                                                style=wx.TE_READONLY
                                                | wx.TE_MULTILINE | wx.HSCROLL,
                                                size=(-1, 400))
        fgs.Add(self.crossMgrMessagesText, flag=wx.EXPAND, proportion=2)
        self.crossMgrMessages = MessageManager(self.crossMgrMessagesText)
        self.fgs = fgs

        #------------------------------------------------------------------------------------------------
        # Create a timer to update the messages.
        #
        self.timer = wx.Timer()
        self.timer.Bind(wx.EVT_TIMER, self.updateMessages)
        self.timer.Start(1000, False)

        self.Bind(wx.EVT_CLOSE, self.onCloseWindow)

        self.readOptions()

        self.SetSizer(self.vbs)
        self.start()
Exemplo n.º 8
0
    def __init__(self, parent, id=wx.ID_ANY, title='', size=(200, 200)):
        wx.Frame.__init__(self, parent, id, title, size=size)

        self.SetBackgroundColour(wx.Colour(240, 240, 240))

        self.fname = None
        self.updated = False
        self.firstTime = True
        self.lastUpdateTime = None
        self.sources = []
        self.errors = []

        self.filehistory = wx.FileHistory(16)

        dataDir = Utils.getHomeDir()
        configFileName = os.path.join(dataDir, 'CallupSeedingMgr.cfg')
        self.config = wx.Config(appName="CallupSeedingMgr",
                                vendorName="SmartCyclingSolutions",
                                localFilename=configFileName)

        self.filehistory.Load(self.config)

        ID_MENU_UPDATE = wx.NewIdRef()
        ID_MENU_HELP = wx.NewIdRef()
        self.menuBar = wx.MenuBar(wx.MB_DOCKABLE)
        if 'WXMAC' in wx.Platform:
            self.appleMenu = self.menuBar.OSXGetAppleMenu()
            self.appleMenu.SetTitle("CallupSeedingMgr")

            self.appleMenu.Insert(0, wx.ID_ABOUT, "&About")

            self.Bind(wx.EVT_MENU, self.OnAboutBox, id=wx.ID_ABOUT)

            self.editMenu = wx.Menu()
            self.editMenu.Append(
                wx.MenuItem(self.editMenu, ID_MENU_UPDATE, "&Update"))

            self.Bind(wx.EVT_MENU, self.doUpdate, id=ID_MENU_UPDATE)
            self.menuBar.Append(self.editMenu, "&Edit")

            self.helpMenu = wx.Menu()
            self.helpMenu.Append(
                wx.MenuItem(self.helpMenu, ID_MENU_HELP, "&Help"))

            self.menuBar.Append(self.helpMenu, "&Help")
            self.Bind(wx.EVT_MENU, self.onTutorial, id=ID_MENU_HELP)

        else:
            self.fileMenu = wx.Menu()
            self.fileMenu.Append(
                wx.MenuItem(self.fileMenu, ID_MENU_UPDATE, "&Update"))
            self.fileMenu.Append(wx.ID_EXIT)
            self.Bind(wx.EVT_MENU, self.doUpdate, id=ID_MENU_UPDATE)
            self.Bind(wx.EVT_MENU, self.onClose, id=wx.ID_EXIT)
            self.menuBar.Append(self.fileMenu, "&File")
            self.helpMenu = wx.Menu()
            self.helpMenu.Insert(0, wx.ID_ABOUT, "&About")
            self.helpMenu.Insert(1, ID_MENU_HELP, "&Help")
            self.Bind(wx.EVT_MENU, self.OnAboutBox, id=wx.ID_ABOUT)
            self.Bind(wx.EVT_MENU, self.onTutorial, id=ID_MENU_HELP)
            self.menuBar.Append(self.helpMenu, "&Help")

        self.SetMenuBar(self.menuBar)

        inputBox = wx.StaticBox(self, label=_('Input'))
        inputBoxSizer = wx.StaticBoxSizer(inputBox, wx.VERTICAL)
        self.fileBrowse = filebrowse.FileBrowseButtonWithHistory(
            self,
            labelText=_('Excel File'),
            buttonText=('Browse...'),
            startDirectory=os.path.expanduser('~'),
            fileMask=
            'Excel Spreadsheet (*.xlsx; *.xlsm; *.xls)|*.xlsx; *.xlsml; *.xls',
            size=(400, -1),
            history=lambda: [
                self.filehistory.GetHistoryFile(i)
                for i in range(self.filehistory.GetCount())
            ],
            changeCallback=self.doChangeCallback,
        )
        inputBoxSizer.Add(self.fileBrowse,
                          0,
                          flag=wx.EXPAND | wx.ALL,
                          border=4)

        horizontalControlSizer = wx.BoxSizer(wx.HORIZONTAL)

        #-------------------------------------------------------------------------------------------
        verticalControlSizer = wx.BoxSizer(wx.VERTICAL)

        self.useUciIdCB = wx.CheckBox(self,
                                      label=_("Use UCI ID (assume no errors)"))
        self.useUciIdCB.SetValue(True)
        verticalControlSizer.Add(self.useUciIdCB, flag=wx.ALL, border=4)

        self.useLicenseCB = wx.CheckBox(
            self, label=_("Use License (assume no errors)"))
        self.useLicenseCB.SetValue(True)
        verticalControlSizer.Add(self.useLicenseCB, flag=wx.ALL, border=4)

        self.soundalikeCB = wx.CheckBox(
            self, label=_("Match misspelled names with Sound-Alike"))
        self.soundalikeCB.SetValue(True)
        verticalControlSizer.Add(self.soundalikeCB, flag=wx.ALL, border=4)

        self.callupSeedingRB = wx.RadioBox(
            self,
            style=wx.RA_SPECIFY_COLS,
            majorDimension=1,
            label=_("Sequence"),
            choices=[
                _("Callups: Highest ranked FIRST (Cyclo-cross, MTB)"),
                _("Seeding: Highest ranked LAST (Time Trials)"),
            ],
        )
        verticalControlSizer.Add(self.callupSeedingRB,
                                 flag=wx.EXPAND | wx.ALL,
                                 border=4)
        verticalControlSizer.Add(wx.StaticText(
            self,
            label=_('Riders with no criteria will be sequenced randomly.')),
                                 flag=wx.ALL,
                                 border=4)

        horizontalControlSizer.Add(verticalControlSizer, flag=wx.EXPAND)

        self.updateButton = RoundButton(self, size=(96, 96))
        self.updateButton.SetLabel(_('Update'))
        self.updateButton.SetFontToFitLabel()
        self.updateButton.SetForegroundColour(wx.Colour(0, 100, 0))
        self.updateButton.Bind(wx.EVT_BUTTON, self.doUpdate)
        horizontalControlSizer.Add(self.updateButton, flag=wx.ALL, border=4)

        horizontalControlSizer.AddSpacer(48)

        vs = wx.BoxSizer(wx.VERTICAL)
        self.tutorialButton = wx.Button(self, label=_('Help/Tutorial...'))
        self.tutorialButton.Bind(wx.EVT_BUTTON, self.onTutorial)
        vs.Add(self.tutorialButton, flag=wx.ALL, border=4)
        branding = wx.adv.HyperlinkCtrl(
            self,
            id=wx.ID_ANY,
            label=u"Powered by CrossMgr",
            url=u"http://www.sites.google.com/site/crossmgrsoftware/")
        vs.Add(branding, flag=wx.ALL, border=4)
        horizontalControlSizer.Add(vs)

        inputBoxSizer.Add(horizontalControlSizer, flag=wx.EXPAND)

        self.sourceList = wx.ListCtrl(self, style=wx.LC_REPORT, size=(-1, 100))
        inputBoxSizer.Add(self.sourceList, flag=wx.ALL | wx.EXPAND, border=4)
        self.sourceList.InsertColumn(0, "Sheet")
        self.sourceList.InsertColumn(1, "Data Columns and Derived Information")
        self.sourceList.InsertColumn(2, "Key Fields")
        self.sourceList.InsertColumn(3, "Rows", wx.LIST_FORMAT_RIGHT)
        self.sourceList.InsertColumn(4, "Errors/Warnings",
                                     wx.LIST_FORMAT_RIGHT)
        self.sourceList.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onItemSelected)

        instructions = [
            _('Drag-and-Drop the row numbers on the Left to change the sequence.'
              ),
            _('Click on Points or Position cells for details.'),
            _('Orange Cells: Multiple Matches.  Click on the cell to see what you need to fix in the spreadsheet.'
              ),
            _('Yellow Cells: Soundalike Matches.  Click on the cell to validate if the names are matched correctly.'
              ),
        ]

        self.grid = ReorderableGrid(self)
        self.grid.CreateGrid(0, 1)
        self.grid.SetColLabelValue(0, u'')
        self.grid.EnableDragRowSize(False)
        self.grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.onGridCellClick)
        #self.grid.Bind( wx.EVT_MOTION, self.onMouseOver )

        outputBox = wx.StaticBox(self, label=_('Output'))
        outputBoxSizer = wx.StaticBoxSizer(outputBox, wx.VERTICAL)

        hs = wx.BoxSizer(wx.HORIZONTAL)
        self.excludeUnrankedCB = wx.CheckBox(
            self, label=_("Exclude riders with no ranking info"))
        hs.Add(self.excludeUnrankedCB,
               flag=wx.ALL | wx.ALIGN_CENTRE_VERTICAL,
               border=4)
        hs.AddSpacer(24)
        hs.Add(wx.StaticText(self, label=_("Output:")),
               flag=wx.ALL | wx.ALIGN_CENTRE_VERTICAL,
               border=4)
        self.topRiders = wx.Choice(self,
                                   choices=[
                                       _('All Riders'),
                                       _('Top 5'),
                                       _('Top 10'),
                                       _('Top 15'),
                                       _('Top 20'),
                                       _('Top 25')
                                   ])
        self.topRiders.SetSelection(0)
        hs.Add(self.topRiders, flag=wx.ALIGN_CENTRE_VERTICAL)

        self.saveAsExcel = wx.Button(self, label=_('Save as Excel...'))
        self.saveAsExcel.Bind(wx.EVT_BUTTON, self.doSaveAsExcel)
        hs.AddSpacer(48)
        hs.Add(self.saveAsExcel, flag=wx.ALL, border=4)

        outputBoxSizer.Add(hs)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(inputBoxSizer, flag=wx.EXPAND | wx.ALL, border=4)
        for i, instruction in enumerate(instructions):
            flag = wx.LEFT | wx.RIGHT
            if i == len(instructions) - 1:
                flag |= wx.BOTTOM
            mainSizer.Add(wx.StaticText(self, label=instruction),
                          flag=flag,
                          border=8)
        mainSizer.Add(self.grid, 1, flag=wx.EXPAND | wx.ALL, border=4)
        mainSizer.Add(outputBoxSizer, flag=wx.EXPAND | wx.ALL, border=4)

        self.SetSizer(mainSizer)