示例#1
0
    def __init__(self, parent):
        self.us_to_jp_map = {}
        self.monster_data = {}
        wx.Panel.__init__(self, parent)
        grid = wx.GridBagSizer(hgap=5, vgap=10)

        config = wx.ConfigBase.Get()
        host = config.Read("host") or socket.gethostbyname(socket.gethostname())

        start_instructions = wx.StaticText(self, label="Just the first time, you need to add the HTTPS certificate to your iOS/Android device. To do this, go to your wifi settings and set up a manual HTTP proxy. Set the server to '%s' and the port to 8080. Then visit http://mitm.it in Safari/Chrome, click the link for your device, and install the configuration profile when asked. After this is done, turn off the HTTP proxy." % host)
        start_instructions.Wrap(580)
        grid.Add(start_instructions, pos=(0,0))

        dns_instructions = wx.StaticText(self, label="To synchronize your box with padherder, enter your padherder username and password in Settings. Then go to your wifi settings and change your DNS server to '%s'. Then press the home button. If you switch to the DNS Proxy Log tab, you should see a bunch of log lines. Make sure Puzzle and Dragons is completely closed, and re-open it. Once you get in game, close PAD completely again and restore your DNS settings." % host)
        dns_instructions.Wrap(580)
        grid.Add(dns_instructions, pos=(1,0))

        status_label = wx.StaticText(self, label="Status:")
        grid.Add(status_label, pos=(2,0))

        self.status_ctrl = wx.TextCtrl(self, wx.ID_ANY, size=(400,300),
                          style = wx.TE_MULTILINE|wx.TE_READONLY)
        self.Bind(custom_events.EVT_STATUS_EVENT, self.onStatusEvent)
        if not config.Read("username"):
            self.status_ctrl.AppendText("You need to set your padherder username in Settings\n")
        if not config.Read("password"):
            self.status_ctrl.AppendText("You need to set your padherder password in Settings\n")

        grid.Add(self.status_ctrl, pos=(3,0), span=(1,2))

        if is_out_of_date(self):
            updateCtrl = HyperLinkCtrl(self, wx.ID_ANY, label="An updated version is available", URL="https://github.com/jgoldshlag/padherder_proxy")
            grid.Add(updateCtrl, pos=(4,0), span=(1,2))

        self.SetSizer(grid)
示例#2
0
    def __init__(self, parent, info):
        title = _("About") + " " + info.Name
        wx.Dialog.__init__(self, parent, title=title)
        self.info = info

        if parent and parent.GetIcon():
            self.SetIcon(parent.GetIcon())

        image = None
        if self.info.Icon:
            bitmap = wx.BitmapFromIcon(self.info.Icon)
            image = wx.StaticBitmap(self, bitmap=bitmap)

        name = wx.StaticText(self, label="%s %s" % (info.Name, info.Version))
        description = wx.StaticText(self, label=info.Description)
        description.Wrap(400)
        copyright = wx.StaticText(self, label=info.Copyright)
        url = HyperLinkCtrl(self, label=info.WebSite[0], URL=info.WebSite[1])

        font = name.GetClassDefaultAttributes().font
        font.SetWeight(wx.FONTWEIGHT_BOLD)
        font.SetPointSize(18)
        name.SetFont(font)

        credits = wx.Button(self, id=wx.ID_ABOUT, label=_("C&redits"))
        license = wx.Button(self, label=_("&License"))
        close = wx.Button(self, id=wx.ID_CANCEL, label=_("&Close"))

        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        btnSizer.Add(credits, flag=wx.CENTER | wx.LEFT | wx.RIGHT, border=5)
        btnSizer.Add(license, flag=wx.CENTER | wx.RIGHT, border=5)
        btnSizer.Add(close, flag=wx.CENTER | wx.RIGHT, border=5)

        sizer = wx.BoxSizer(wx.VERTICAL)
        if image:
            sizer.Add(image, flag=wx.CENTER | wx.TOP | wx.BOTTOM, border=5)
        sizer.Add(name, flag=wx.CENTER | wx.BOTTOM, border=10)
        sizer.Add(description, flag=wx.CENTER | wx.BOTTOM, border=10)
        sizer.Add(copyright, flag=wx.CENTER | wx.BOTTOM, border=10)
        sizer.Add(url, flag=wx.CENTER | wx.BOTTOM, border=15)
        sizer.Add(btnSizer, flag=wx.CENTER | wx.BOTTOM, border=5)

        container = wx.BoxSizer(wx.VERTICAL)
        container.Add(sizer, flag=wx.ALL, border=10)
        self.SetSizer(container)
        self.Layout()
        self.Fit()
        self.Centre()
        self.Show(True)
        self.SetEscapeId(close.GetId())

        credits.Bind(wx.EVT_BUTTON, self.on_credits)
        license.Bind(wx.EVT_BUTTON, self.on_license)
        close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy())
示例#3
0
文件: about.py 项目: ssv1982/nuxhash
    def __init__(self, parent, *args, **kwargs):
        wx.Panel.__init__(self, parent, *args, **kwargs)
        h_sizer = wx.BoxSizer(orient=wx.HORIZONTAL)
        self.SetSizer(h_sizer)
        v_sizer = wx.BoxSizer(orient=wx.VERTICAL)
        h_sizer.Add(v_sizer, wx.SizerFlags().Proportion(1.0)
                                            .Align(wx.ALIGN_CENTER))

        with open(LOGO_PATH, 'rb') as f:
            logo = wx.Image(f, type=wx.BITMAP_TYPE_PNG)
        v_sizer.Add(wx.StaticBitmap(self, bitmap=wx.Bitmap(logo)),
                    wx.SizerFlags().Align(wx.ALIGN_CENTER))

        v_sizer.AddSpacer(15)

        appName = wx.StaticText(self, label='nuxhash %s' % __version__,
                                style=wx.ALIGN_CENTER)
        appName.SetFont(self.GetFont().Scale(2.0))
        v_sizer.Add(appName, wx.SizerFlags().Expand())

        v_sizer.AddSpacer(15)

        v_sizer.Add(wx.StaticText(self, label='A NiceHash client for Linux.',
                                  style=wx.ALIGN_CENTER),
                    wx.SizerFlags().Expand())

        v_sizer.AddSpacer(15)

        copyright = wx.StaticText(self, label='Copyright © 2018\nRyan Young',
                                  style=wx.ALIGN_CENTER)
        copyright.SetFont(self.GetFont().Scale(0.8))
        v_sizer.Add(copyright, wx.SizerFlags().Expand())

        v_sizer.AddSpacer(30)

        links = wx.BoxSizer(orient=wx.HORIZONTAL)
        links.Add(HyperLinkCtrl(self, label='Website', URL=WEBSITE))
        links.AddSpacer(30)
        links.Add(HyperLinkCtrl(self, label='License', URL=LICENSE))
        v_sizer.Add(links, wx.SizerFlags().Align(wx.ALIGN_CENTER))
示例#4
0
文件: ghelp.py 项目: yantongw/grass
    def _pageInfo(self):
        """Info page"""
        # get version and web site
        vInfo = grass.version()
        if not vInfo:
            sys.stderr.write(_("Unable to get GRASS version\n"))

        infoTxt = ScrolledPanel(self.aboutNotebook)
        infoTxt.SetBackgroundColour('WHITE')
        infoTxt.SetupScrolling()
        infoSizer = wx.BoxSizer(wx.VERTICAL)
        infoGridSizer = wx.GridBagSizer(vgap=5, hgap=5)
        logo = os.path.join(globalvar.ICONDIR, "grass-64x64.png")
        logoBitmap = wx.StaticBitmap(
            infoTxt, wx.ID_ANY, wx.Bitmap(name=logo, type=wx.BITMAP_TYPE_PNG))
        infoSizer.Add(logoBitmap,
                      proportion=0,
                      flag=wx.ALL | wx.ALIGN_CENTER,
                      border=20)

        infoLabel = 'GRASS GIS %s' % vInfo.get('version', _('unknown version'))
        if 'x86_64' in vInfo.get('build_platform', ''):
            infoLabel += ' (64bit)'
        info = StaticText(parent=infoTxt,
                          id=wx.ID_ANY,
                          label=infoLabel + os.linesep)
        info.SetFont(wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        info.SetForegroundColour(wx.Colour(35, 142, 35))
        infoSizer.Add(info,
                      proportion=0,
                      flag=wx.BOTTOM | wx.ALIGN_CENTER,
                      border=1)

        team = StaticText(parent=infoTxt, label=_grassDevTeam(1999) + '\n')
        infoSizer.Add(team,
                      proportion=0,
                      flag=wx.BOTTOM | wx.ALIGN_CENTER,
                      border=1)

        row = 0
        infoGridSizer.Add(StaticText(parent=infoTxt,
                                     id=wx.ID_ANY,
                                     label=_('Official GRASS site:')),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)

        infoGridSizer.Add(HyperLinkCtrl(parent=infoTxt,
                                        id=wx.ID_ANY,
                                        label='https://grass.osgeo.org'),
                          pos=(row, 1),
                          flag=wx.ALIGN_LEFT)

        row += 2
        infoGridSizer.Add(StaticText(parent=infoTxt,
                                     id=wx.ID_ANY,
                                     label='%s:' % _('Code Revision')),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)

        infoGridSizer.Add(HyperLinkCtrl(
            parent=infoTxt,
            id=wx.ID_ANY,
            label=vInfo.get('revision', '?'),
            URL='https://github.com/OSGeo/grass.git'),
                          pos=(row, 1),
                          flag=wx.ALIGN_LEFT)

        row += 1
        infoGridSizer.Add(StaticText(parent=infoTxt,
                                     id=wx.ID_ANY,
                                     label='%s:' % _('Build Date')),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)

        infoGridSizer.Add(StaticText(parent=infoTxt,
                                     id=wx.ID_ANY,
                                     label=vInfo.get('build_date', '?')),
                          pos=(row, 1),
                          flag=wx.ALIGN_LEFT)

        # show only basic info
        # row += 1
        # infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
        #                                        label = '%s:' % _('GIS Library Revision')),
        #                   pos = (row, 0),
        #                   flag = wx.ALIGN_RIGHT)

        # infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
        #                                        label = vInfo['libgis_revision'] + ' (' +
        #                                        vInfo['libgis_date'].split(' ')[0] + ')'),
        #                   pos = (row, 1),
        #                   flag = wx.ALIGN_LEFT)

        row += 2
        infoGridSizer.Add(StaticText(parent=infoTxt,
                                     id=wx.ID_ANY,
                                     label='Python:'),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)

        infoGridSizer.Add(StaticText(parent=infoTxt,
                                     id=wx.ID_ANY,
                                     label=platform.python_version()),
                          pos=(row, 1),
                          flag=wx.ALIGN_LEFT)

        row += 1
        infoGridSizer.Add(StaticText(parent=infoTxt,
                                     id=wx.ID_ANY,
                                     label='wxPython:'),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)

        infoGridSizer.Add(StaticText(parent=infoTxt,
                                     id=wx.ID_ANY,
                                     label=wx.__version__),
                          pos=(row, 1),
                          flag=wx.ALIGN_LEFT)

        infoGridSizer.AddGrowableCol(0)
        infoGridSizer.AddGrowableCol(1)
        infoSizer.Add(infoGridSizer, proportion=1, flag=wx.EXPAND)

        row += 2
        infoGridSizer.Add(StaticText(parent=infoTxt,
                                     id=wx.ID_ANY,
                                     label="%s:" % _('Language')),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)
        self.langUsed = grass.gisenv().get('LANG', None)
        if not self.langUsed:
            import locale
            loc = locale.getdefaultlocale()
            if loc == (None, None):
                self.langUsed = _('unknown')
            else:
                self.langUsed = u'%s.%s' % (loc[0], loc[1])
        infoGridSizer.Add(StaticText(parent=infoTxt,
                                     id=wx.ID_ANY,
                                     label=self.langUsed),
                          pos=(row, 1),
                          flag=wx.ALIGN_LEFT)

        infoTxt.SetSizer(infoSizer)
        infoSizer.Fit(infoTxt)

        return infoTxt
示例#5
0
    def Build(self):

        # Build the header
        Header = wx.BoxSizer(wx.HORIZONTAL)
        if self.icon1:
            Header.Add(wx.StaticBitmap(self, bitmap=self.icon1), 0)
        else:
            Header.Add((64, 64))
        Header.Add((20, 1), 1)
        if self.short_name:
            Label = wx.StaticText(self, label=self.short_name)
            of = Label.GetFont()
            Font = wx.Font(int(of.GetPointSize() * 2), of.GetFamily(),
                           wx.NORMAL, wx.FONTWEIGHT_BOLD)
            Label.SetFont(Font)
            Header.Add(Label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        else:
            Header.Add((1, 1), 1)
        Header.Add((20, 1), 1)
        if self.icon2:
            Header.Add(wx.StaticBitmap(self, bitmap=self.icon2), 0)
        else:
            Header.Add((64, 64))
        width = Header.MinSize[0]

        # Now the rest;
        MainSizer = wx.BoxSizer(wx.VERTICAL)

        MainSizer.Add(Header, 0, wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, 5)

        if self.long_name:
            Label = wx.StaticText(self, label=self.long_name)
            of = Label.GetFont()
            Font = wx.Font(int(of.GetPointSize() * 1.5), of.GetFamily(),
                           wx.NORMAL, wx.NORMAL)
            Label.SetFont(Font)
            MainSizer.Add(Label, 0,
                          wx.TOP | wx.RIGHT | wx.LEFT | wx.ALIGN_CENTER, 5)
            width = max(width, Label.Size[0])

        if self.version:
            Label = wx.StaticText(self, label="version: " + self.version)
            #of = Label.GetFont()
            #Font = wx.Font(int(of.GetPointSize() * 1.5), of.GetFamily(), wx.NORMAL, wx.NORMAL)
            # Label.SetFont(Font)
            MainSizer.Add(Label, 0, wx.BOTTOM | wx.ALIGN_CENTER, 5)

        if self.description:
            Label = wx.StaticText(self, label=self.description)
            # of = Label.GetFont()
            # Font = wx.Font(int(of.GetPointSize() * 1.5), of.GetFamily(), wx.NORMAL, wx.NORMAL)
            # Label.SetFont(Font)

            Label.Wrap(max(250, int(0.9 * width)))
            MainSizer.Add(Label, 0, wx.ALL | wx.ALIGN_CENTER, 5)

        if self.licence:
            Label = wx.StaticText(self, label="License:")
            of = Label.GetFont()
            Font = wx.Font(of.GetPointSize(), of.GetFamily(), wx.NORMAL,
                           wx.BOLD)
            Label.SetFont(Font)
            MainSizer.Add(Label, 0, wx.ALL | wx.ALIGN_LEFT, 5)
            Label = wx.StaticText(self, label=self.licence)
            Label.Wrap(max(250, int(0.9 * width)))
            MainSizer.Add(Label, 0, wx.ALL | wx.ALIGN_CENTER, 2)

        if self.developers:
            Label = wx.StaticText(self, label="Developed by:")
            of = Label.GetFont()
            Font = wx.Font(of.GetPointSize(), of.GetFamily(), wx.NORMAL,
                           wx.BOLD)
            Label.SetFont(Font)
            MainSizer.Add(Label, 0, wx.ALL | wx.ALIGN_LEFT, 5)

            for developer in self.developers:
                Label = wx.StaticText(self, label="          " + developer)
                MainSizer.Add(Label, 0, wx.ALL | wx.ALIGN_LEFT, 0)

        if self.urls:
            Label = wx.StaticText(self, label="For more information:")
            of = Label.GetFont()
            Font = wx.Font(of.GetPointSize(), of.GetFamily(), wx.NORMAL,
                           wx.BOLD)
            Label.SetFont(Font)
            MainSizer.Add(Label, 0, wx.ALL | wx.ALIGN_LEFT, 5)
            for url in self.urls:
                Link = HyperLinkCtrl(self, label=url, URL=url)
                MainSizer.Add(Link, 0, wx.ALL | wx.ALIGN_CENTER, 2)

        MainSizer.Add((1, 5), 1)
        MainSizer.Add(wx.Button(self, id=wx.ID_OK, label="Dismiss"), 0,
                      wx.ALL | wx.ALIGN_RIGHT, 5)
        SpaceSizer = wx.BoxSizer(wx.VERTICAL)
        SpaceSizer.Add(MainSizer, 0, wx.ALL, 10)
        self.SetSizerAndFit(SpaceSizer)
    def __init__(self, parent, title, dirname, filename):
        sys.excepthook = self.exception_hook
        self.dirname = ''
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)

        # A "-1" in the size parameter instructs wxWidgets to use the default size.
        # In this case, we select 200px width and the default height.
        wx.Frame.__init__(self, parent, title=title, size=(1300, 950))
        self.statusbar = self.CreateStatusBar(
        )  # A Statusbar in the bottom of the window

        # Panels
        self.main_panel = MainPanel(self)
        self.entry_panel = EntryPanel(self)

        # Setting up the menu.
        file_menu = wx.Menu()
        file_menu.Append(wx.ID_OPEN)
        file_menu.Append(wx.ID_SAVE)
        file_menu.Append(wx.ID_CONVERT, "Convert for Skill Creator")
        file_menu.Append(wx.ID_ABOUT)
        file_menu.Append(wx.ID_EXIT)

        edit_menu = wx.Menu()
        edit_menu.Append(wx.ID_FIND)
        edit_menu.Append(wx.ID_REPLACE)

        # Creating the menubar.
        menu_bar = wx.MenuBar()
        menu_bar.Append(file_menu,
                        "&File")  # Adding the "filemenu" to the MenuBar
        menu_bar.Append(edit_menu, "&Edit")
        self.SetMenuBar(menu_bar)  # Adding the MenuBar to the Frame content.

        # Publisher
        pub.subscribe(self.open_bdm, 'open_bdm')
        pub.subscribe(self.load_bdm, 'load_bdm')
        pub.subscribe(self.save_bdm, 'save_bdm')
        pub.subscribe(self.set_status_bar, 'set_status_bar')

        # Events.
        self.Bind(wx.EVT_MENU, self.open_bdm, id=wx.ID_OPEN)
        self.Bind(wx.EVT_MENU, self.save_bdm, id=wx.ID_SAVE)
        self.Bind(wx.EVT_MENU, self.on_find, id=wx.ID_FIND)
        self.Bind(wx.EVT_MENU, self.on_replace, id=wx.ID_REPLACE)
        self.Bind(wx.EVT_MENU, self.on_convert, id=wx.ID_CONVERT)
        self.Bind(wx.EVT_MENU, self.on_about, id=wx.ID_ABOUT)
        self.Bind(wx.EVT_MENU, self.on_exit, id=wx.ID_EXIT)
        self.Bind(wx.EVT_MENU, self.main_panel.on_add, id=wx.ID_ADD)
        self.Bind(wx.EVT_MENU, self.main_panel.on_new, id=wx.ID_NEW)
        self.Bind(wx.EVT_MENU, self.main_panel.on_delete, id=wx.ID_DELETE)
        self.Bind(wx.EVT_MENU, self.main_panel.on_copy, id=wx.ID_COPY)
        self.Bind(wx.EVT_MENU, self.main_panel.on_paste, id=wx.ID_PASTE)
        accelerator_table = wx.AcceleratorTable([
            (wx.ACCEL_CTRL, ord('n'), wx.ID_NEW),
            (wx.ACCEL_CTRL, ord('o'), wx.ID_OPEN),
            (wx.ACCEL_CTRL, ord('s'), wx.ID_SAVE),
            (wx.ACCEL_CTRL, ord('f'), wx.ID_FIND),
            (wx.ACCEL_CTRL, ord('h'), wx.ID_REPLACE),
        ])
        self.SetAcceleratorTable(accelerator_table)
        self.SetDropTarget(FileDropTarget(self, "load_bdm"))

        # Name
        self.name = wx.StaticText(self, -1, '(No file loaded)')
        font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                       wx.FONTWEIGHT_BOLD)
        self.name.SetFont(font)

        # Buttons
        open_button = wx.Button(self, wx.ID_OPEN, "Load")
        open_button.Bind(wx.EVT_BUTTON, self.open_bdm)

        save_button = wx.Button(self, wx.ID_SAVE, "Save")
        save_button.Bind(wx.EVT_BUTTON, self.save_bdm)

        hyperlink = HyperLinkCtrl(
            self,
            -1,
            "What do all these things mean?",
            URL="https://docs.google.com/document/d/"
            "18gaAbNCeJyTgizz5IvvXzjWcH9K5Q1wvUHTeWnp8M-E/edit#heading=h.tx82dphejin1"
        )

        # Sizer
        sizer = wx.BoxSizer(wx.VERTICAL)
        button_sizer = wx.BoxSizer()
        button_sizer.Add(open_button)
        button_sizer.AddSpacer(10)
        button_sizer.Add(save_button)
        button_sizer.Add(hyperlink, 0, wx.ALL, 10)

        panel_sizer = wx.BoxSizer()
        panel_sizer.Add(self.main_panel, 1, wx.ALL | wx.EXPAND)
        panel_sizer.Add(self.entry_panel, 3, wx.ALL | wx.EXPAND)

        sizer.Add(self.name, 0, wx.CENTER)
        sizer.Add(button_sizer, 0, wx.ALL, 10)
        sizer.Add(panel_sizer, 1, wx.ALL | wx.EXPAND)

        self.SetBackgroundColour('white')
        self.SetSizer(sizer)
        self.SetAutoLayout(1)

        # Lists
        self.entry_list = self.main_panel.entry_list

        # Dialogs
        self.find = FindDialog(self, self.entry_list, self.entry_panel, -1)
        self.replace = ReplaceDialog(self, self.entry_list, self.entry_panel,
                                     -1)

        sizer.Layout()
        self.Show()

        if filename:
            self.load_bdm(dirname, filename)
示例#7
0
    def _InitUI(self, use_scale_and_cmap=True):
        """Builds this panel.
"""
        #		-- Panel
        #		--
        panel = wx.Panel(self, -1, style=wx.BORDER_THEME)
        self.fPanelSizer = panel_sizer = wx.FlexGridSizer(8, 2, 6, 4)
        panel_sizer.SetFlexibleDirection(wx.HORIZONTAL)
        panel.SetSizer(panel_sizer)

        self.fRangeFields = []
        for name in ('Minimum Value:', 'Maximum Value:'):
            label = wx.StaticText(panel,
                                  wx.ID_ANY,
                                  label=name,
                                  style=wx.ALIGN_RIGHT)
            field = wx.TextCtrl(panel, wx.ID_ANY, value='NaN', size=(200, -1))
            field.Bind(wx.EVT_KILL_FOCUS, self._OnFocusOut)
            field.Bind(wx.EVT_SET_FOCUS, self._OnFocusIn)
            self.fRangeFields.append(field)

            panel_sizer.Add(label, 0,
                            wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
            panel_sizer.Add(
                field, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                0)
        #end for name

        self.fCustomFormatLabel = wx.StaticText(panel,
                                                wx.ID_ANY,
                                                label='Custom Format:',
                                                style=wx.ALIGN_RIGHT)
        self.fCustomFormatField = wx.TextCtrl(panel,
                                              wx.ID_ANY,
                                              value='g'
                                              #size = ( 200, -1 )
                                              )
        self.fCustomFormatField.Bind(wx.EVT_KILL_FOCUS, self._OnCustomFocusOut)
        self.fCustomFormatField.Bind(wx.EVT_SET_FOCUS, self._OnFocusIn)
        panel_sizer.Add(self.fCustomFormatLabel, 0,
                        wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        panel_sizer.Add(self.fCustomFormatField, 0,
                        wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                        0)

        self.fPrecisionDigitsLabel = wx.StaticText(panel,
                                                   wx.ID_ANY,
                                                   label='Precision Digits:',
                                                   style=wx.ALIGN_RIGHT)
        self.fPrecisionDigitsCtrl = wx.SpinCtrl(
            panel,
            wx.ID_ANY,
            min=1,
            max=4,
            initial=DEFAULT_precisionDigits,
            style=wx.SP_ARROW_KEYS)
        self.fPrecisionDigitsCtrl.Bind(wx.EVT_SPINCTRL,
                                       self._OnPrecisionDigits)
        panel_sizer.Add(self.fPrecisionDigitsLabel, 0,
                        wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        panel_sizer.Add(self.fPrecisionDigitsCtrl, 0,
                        wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                        0)

        label = wx.StaticText(panel,
                              wx.ID_ANY,
                              label='Precision Mode:',
                              style=wx.ALIGN_RIGHT)
        self.fPrecisionModeCtrl = wx.ComboBox(panel,
                                              wx.ID_ANY,
                                              DEFAULT_precisionMode,
                                              choices=MODE_OPTIONS,
                                              style=wx.CB_READONLY)
        self.fPrecisionModeCtrl.Bind(wx.EVT_COMBOBOX, self._OnPrecisionMode)
        panel_sizer.Add(label, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        panel_sizer.Add(self.fPrecisionModeCtrl, 0,
                        wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                        0)

        label = wx.StaticText(panel,
                              wx.ID_ANY,
                              label='Scale Type:',
                              style=wx.ALIGN_RIGHT)
        self.fScaleTypeCtrl = wx.ComboBox(panel,
                                          wx.ID_ANY,
                                          DEFAULT_scaleType,
                                          choices=SCALE_TYPES,
                                          style=wx.CB_READONLY)
        self.fScaleTypeCtrl.Bind(wx.EVT_COMBOBOX, self._OnScaleType)
        panel_sizer.Add(label, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        panel_sizer.Add(self.fScaleTypeCtrl, 0,
                        wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                        0)
        if not use_scale_and_cmap:
            self.fScaleTypeCtrl.Enable(False)

#		-- Colormap is embedded in second column
        cmap_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.fColormapButton = wx.Button(panel, label='X' * 16)
        self.fColormapButton.Bind(wx.EVT_BUTTON, self._OnColormapButton)

        cmap_bitmap = \
            self.fBitmapFunc( 'cmap_' + DEFAULT_colormap ) \
     if self.fBitmapFunc else \
     wx.EmptyBitmap( 8 ,8 )
        self.fColormapBitmap = wx.StaticBitmap(panel, bitmap=cmap_bitmap)
        cmap_sizer.Add(self.fColormapButton, 1,
                       wx.ALIGN_LEFT | wx.EXPAND | wx.RIGHT, 4)
        cmap_sizer.Add(self.fColormapBitmap, 0,
                       wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0)

        label = wx.StaticText(panel,
                              wx.ID_ANY,
                              label='Colormap:',
                              style=wx.ALIGN_RIGHT)
        panel_sizer.Add(label, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        panel_sizer.Add(cmap_sizer, 0,
                        wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                        0)
        if not use_scale_and_cmap:
            self.fColormapButton.Enable(False)

#		-- Panel button
#		--
        reset_button = wx.Button(panel, label='&Reset')
        reset_button.Bind(wx.EVT_BUTTON, self._OnReset)

        panel_sizer.Add(wx.StaticText(panel, wx.ID_ANY, label=''), 0,
                        wx.ALIGN_RIGHT, 0)
        panel_sizer.Add(reset_button, 0, wx.ALIGN_CENTER, 0)

        #		-- Info message
        #		--
        message = wx.StaticText(
            self,
            wx.ID_ANY,
            'Non-numeric values are interpreted as "NaN".\n' +
            '"NaN" specifies that the calculated range value should be used.',
            style=wx.ALIGN_LEFT)

        #               -- Help message with link
        #               --
        help_sizer = wx.BoxSizer(wx.HORIZONTAL)
        help_message = wx.StaticText(self,
                                     wx.ID_ANY,
                                     'Custom formats are described at ',
                                     style=wx.ALIGN_LEFT)
        help_sizer.Add(help_message, 0, wx.ALIGN_LEFT | wx.LEFT, 6)
        link = HyperLinkCtrl(self,
                             wx.ID_ANY,
                             label='at this link',
                             URL=CUSTOM_FORMAT_URL)
        link.SetFont(link.GetFont().Bold())
        help_sizer.Add(link, 0, wx.ALIGN_LEFT, 0)

        #			-- Lay out
        #			--
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)

        sizer.Add(panel, 1, wx.ALIGN_LEFT | wx.ALIGN_TOP | wx.ALL | wx.EXPAND,
                  6)
        sizer.Add(
            message, 0,
            wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_TOP | wx.ALL | wx.EXPAND, 6)
        sizer.Add(help_sizer, 0,
                  wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_TOP | wx.EXPAND, 0)
        #sizer.AddStretchSpacer()
        self.Fit()
示例#8
0
    def __init__(self, parent, title, dirname, filename):
        sys.excepthook = self.exception_hook
        self.dirname = ''
        self.bcs = None
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)

        # A "-1" in the size parameter instructs wxWidgets to use the default size.
        # In this case, we select 200px width and the default height.
        wx.Frame.__init__(self, parent, title=title, size=(1300, 900))
        self.statusbar = self.CreateStatusBar(
        )  # A Statusbar in the bottom of the window

        # Panels
        self.main_panel = MainPanel(self)
        self.side_panel = SidePanel(self)

        # Setting up the menu.
        file_menu = wx.Menu()
        file_menu.Append(wx.ID_OPEN)
        file_menu.Append(wx.ID_SAVE)
        file_menu.Append(wx.ID_ABOUT)
        file_menu.Append(wx.ID_EXIT)

        edit_menu = wx.Menu()
        edit_menu.Append(wx.ID_FIND)
        edit_menu.Append(wx.ID_REPLACE)

        # Creating the menubar.
        menu_bar = wx.MenuBar()
        menu_bar.Append(file_menu,
                        "&File")  # Adding the "filemenu" to the MenuBar
        menu_bar.Append(edit_menu, "&Edit")
        self.SetMenuBar(menu_bar)  # Adding the MenuBar to the Frame content.

        # Publisher
        pub.subscribe(self.open_bcs, 'open_bcs')
        pub.subscribe(self.load_bcs, 'load_bcs')
        pub.subscribe(self.save_bcs, 'save_bcs')
        pub.subscribe(self.load_part_sets, 'load_part_sets')
        pub.subscribe(self.load_parts, 'load_parts')
        pub.subscribe(self.load_color_selectors, 'load_color_selectors')
        pub.subscribe(self.load_physics, 'load_physics')
        pub.subscribe(self.load_part_colors, 'load_part_colors')
        pub.subscribe(self.load_colors, 'load_colors')
        pub.subscribe(self.load_bodies, 'load_bodies')
        pub.subscribe(self.load_bone_scales, 'load_bone_scales')
        pub.subscribe(self.load_skeletons, 'load_skeletons')
        pub.subscribe(self.load_bones, 'load_bones')
        pub.subscribe(self.set_status_bar, 'set_status_bar')
        pub.subscribe(self.reindex_part_sets, 'reindex_part_sets')
        pub.subscribe(self.reindex_part_colors, 'reindex_part_colors')
        pub.subscribe(self.reindex_bodies, 'reindex_bodies')
        pub.subscribe(self.reindex_skeletons, 'reindex_skeletons')
        pub.subscribe(self.change_add_text, 'change_add_text')
        pub.subscribe(self.enable_add_copy, 'enable_add_copy')

        # Events.
        self.Bind(wx.EVT_MENU, self.open_bcs, id=wx.ID_OPEN)
        self.Bind(wx.EVT_MENU, self.save_bcs, id=wx.ID_SAVE)
        self.Bind(wx.EVT_MENU, self.on_find, id=wx.ID_FIND)
        self.Bind(wx.EVT_MENU, self.on_replace, id=wx.ID_REPLACE)
        self.Bind(wx.EVT_MENU, self.on_about, id=wx.ID_ABOUT)
        self.Bind(wx.EVT_MENU, self.on_exit, id=wx.ID_EXIT)
        accelerator_table = wx.AcceleratorTable([
            (wx.ACCEL_CTRL, ord('o'), wx.ID_OPEN),
            (wx.ACCEL_CTRL, ord('s'), wx.ID_SAVE),
            (wx.ACCEL_CTRL, ord('f'), wx.ID_FIND),
            (wx.ACCEL_CTRL, ord('h'), wx.ID_REPLACE),
        ])
        self.SetAcceleratorTable(accelerator_table)
        self.SetDropTarget(FileDropTarget(self, "load_bcs"))

        # Name
        self.name = wx.StaticText(self, -1, '(No file loaded)')
        font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                       wx.FONTWEIGHT_BOLD)
        self.name.SetFont(font)

        # Buttons
        open_button = wx.Button(self, wx.ID_OPEN, "Load", size=(80, -1))
        open_button.Bind(wx.EVT_BUTTON, self.open_bcs)

        self.save_button = wx.Button(self, wx.ID_SAVE, "Save", size=(80, -1))
        self.save_button.Disable()
        self.save_button.Bind(wx.EVT_BUTTON, self.save_bcs)

        self.add_button = wx.Button(self,
                                    wx.ID_ADD,
                                    "Add Part Set",
                                    size=(100, -1))
        self.add_button.Disable()
        self.add_button.Bind(wx.EVT_BUTTON, self.on_add)

        self.add_copy_button = wx.Button(self,
                                         wx.ID_ADD,
                                         "Add Part Set Copy",
                                         size=(120, -1))
        self.add_copy_button.Disable()
        self.add_copy_button.Bind(wx.EVT_BUTTON,
                                  partial(self.on_add, paste=True))

        hyperlink = HyperLinkCtrl(
            self,
            -1,
            "What do all these things mean?",
            URL="https://docs.google.com/document/d/"
            "1df8_Zs3g0YindDNees_CSrWVpMBtwWGrFf2FE8JruUk/edit?usp=sharing")

        # Race/Gender
        self.gender = wx.ComboBox(self,
                                  choices=["Male", "Female"],
                                  style=wx.CB_READONLY,
                                  size=(80, -1))
        self.gender.Disable()

        self.race = wx.ComboBox(self,
                                choices=[
                                    "Human", "Saiyan", "Namekian", "Frieza",
                                    "Majin", "Android (?)"
                                ],
                                style=wx.CB_READONLY,
                                size=(80, -1))
        self.race.Disable()

        # Sizer
        sizer = wx.BoxSizer(wx.VERTICAL)
        button_sizer = wx.BoxSizer()
        button_sizer.Add(open_button, 0, wx.LEFT, 10)
        button_sizer.Add(self.save_button, 0, wx.LEFT, 10)
        button_sizer.Add(self.add_button, 0, wx.LEFT, 10)
        button_sizer.Add(self.add_copy_button, 0, wx.LEFT, 10)
        button_sizer.Add(hyperlink, 0, wx.LEFT | wx.BOTTOM, 10)

        header_sizer = wx.BoxSizer()
        header_sizer.Add(self.gender, 0, wx.LEFT, 10)
        header_sizer.Add(self.race, 0, wx.LEFT, 10)

        panel_sizer = wx.BoxSizer()
        panel_sizer.Add(self.main_panel, 1, wx.ALL | wx.EXPAND)
        panel_sizer.Add(self.side_panel, 2, wx.ALL | wx.EXPAND)

        sizer.Add(self.name, 0, wx.CENTER)
        sizer.Add(button_sizer, 0, wx.ALL)
        sizer.Add(header_sizer, 0, wx.TOP, 10)
        sizer.Add(panel_sizer, 1, wx.ALL | wx.EXPAND)

        self.SetBackgroundColour('white')
        self.SetSizer(sizer)
        self.SetAutoLayout(1)

        # Lists
        self.part_set_list = self.main_panel.pages["Part Sets"].entry_list
        self.part_color_list = self.main_panel.pages["Part Colors"].entry_list
        self.body_list = self.main_panel.pages["Bodies"].entry_list
        self.skeleton_list = self.main_panel.pages["Skeletons"].entry_list

        color_db.image_list = wx.ImageList(16, 16)
        self.part_set_list.SetImageList(color_db.image_list)
        self.part_color_list.SetImageList(color_db.image_list)

        # Dialogs
        self.find = FindDialog(self, self.main_panel)
        self.replace = ReplaceDialog(self, self.main_panel)

        sizer.Layout()
        self.Show()

        if filename:
            self.load_bcs(dirname, filename)
示例#9
0
    def __init__(self,
                 parent,
                 size=(650, 460),
                 title=_('About GRASS GIS'),
                 **kwargs):
        wx.Frame.__init__(self,
                          parent=parent,
                          id=wx.ID_ANY,
                          title=title,
                          size=size,
                          **kwargs)

        panel = wx.Panel(parent=self, id=wx.ID_ANY)

        # icon
        self.SetIcon(
            wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'),
                    wx.BITMAP_TYPE_ICO))

        # get version and web site
        vInfo = grass.version()

        infoTxt = ScrolledPanel(parent=panel)
        infoTxt.SetupScrolling()
        infoSizer = wx.BoxSizer(wx.VERTICAL)
        infoGridSizer = wx.GridBagSizer(vgap=5, hgap=5)
        logo = os.path.join(globalvar.ETCDIR, "gui", "icons",
                            "grass-64x64.png")
        logoBitmap = wx.StaticBitmap(parent=infoTxt,
                                     id=wx.ID_ANY,
                                     bitmap=wx.Bitmap(name=logo,
                                                      type=wx.BITMAP_TYPE_PNG))
        infoSizer.Add(item=logoBitmap,
                      proportion=0,
                      flag=wx.ALL | wx.ALIGN_CENTER,
                      border=20)

        info = wx.StaticText(parent=infoTxt,
                             id=wx.ID_ANY,
                             label='GRASS GIS ' + vInfo['version'] + '\n\n')
        info.SetFont(wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        info.SetForegroundColour(wx.Colour(35, 142, 35))
        infoSizer.Add(item=info,
                      proportion=0,
                      flag=wx.BOTTOM | wx.ALIGN_CENTER,
                      border=1)

        row = 0
        infoGridSizer.Add(item=wx.StaticText(parent=infoTxt,
                                             id=wx.ID_ANY,
                                             label=_('Official GRASS site:')),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)

        infoGridSizer.Add(item=HyperLinkCtrl(parent=infoTxt,
                                             id=wx.ID_ANY,
                                             label='http://grass.osgeo.org'),
                          pos=(row, 1),
                          flag=wx.ALIGN_LEFT)

        row += 2
        infoGridSizer.Add(item=wx.StaticText(parent=infoTxt,
                                             id=wx.ID_ANY,
                                             label='%s:' % _('SVN Revision')),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)

        infoGridSizer.Add(item=wx.StaticText(parent=infoTxt,
                                             id=wx.ID_ANY,
                                             label=vInfo['revision']),
                          pos=(row, 1),
                          flag=wx.ALIGN_LEFT)

        row += 1
        infoGridSizer.Add(item=wx.StaticText(parent=infoTxt,
                                             id=wx.ID_ANY,
                                             label='%s:' %
                                             _('GIS Library Revision')),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)

        infoGridSizer.Add(
            item=wx.StaticText(parent=infoTxt,
                               id=wx.ID_ANY,
                               label=vInfo['libgis_revision'] + ' (' +
                               vInfo['libgis_date'].split(' ')[0] + ')'),
            pos=(row, 1),
            flag=wx.ALIGN_LEFT)

        row += 2
        infoGridSizer.Add(item=wx.StaticText(parent=infoTxt,
                                             id=wx.ID_ANY,
                                             label='Python:'),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)

        infoGridSizer.Add(item=wx.StaticText(parent=infoTxt,
                                             id=wx.ID_ANY,
                                             label=platform.python_version()),
                          pos=(row, 1),
                          flag=wx.ALIGN_LEFT)

        row += 1
        infoGridSizer.Add(item=wx.StaticText(parent=infoTxt,
                                             id=wx.ID_ANY,
                                             label='wxPython:'),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)

        infoGridSizer.Add(item=wx.StaticText(parent=infoTxt,
                                             id=wx.ID_ANY,
                                             label=wx.__version__),
                          pos=(row, 1),
                          flag=wx.ALIGN_LEFT)
        infoGridSizer.AddGrowableCol(0)
        infoGridSizer.AddGrowableCol(1)

        infoSizer.Add(item=infoGridSizer,
                      proportion=1,
                      flag=wx.EXPAND | wx.ALIGN_CENTER
                      | wx.ALIGN_CENTER_VERTICAL)

        row += 2
        infoGridSizer.Add(item=wx.StaticText(parent=infoTxt,
                                             id=wx.ID_ANY,
                                             label="%s:" % _('Language')),
                          pos=(row, 0),
                          flag=wx.ALIGN_RIGHT)
        lang = grass.gisenv().get('LANG', None)
        if not lang:
            import locale
            loc = locale.getdefaultlocale()
            if loc == (None, None):
                lang = _('unknown')
            else:
                lang = u'%s.%s' % (loc[0], loc[1])
        infoGridSizer.Add(item=wx.StaticText(parent=infoTxt,
                                             id=wx.ID_ANY,
                                             label=lang),
                          pos=(row, 1),
                          flag=wx.ALIGN_LEFT)

        # create a flat notebook for displaying information about GRASS
        aboutNotebook = GNotebook(panel,
                                  style=globalvar.FNPageStyle
                                  | FN.FNB_NO_X_BUTTON)
        aboutNotebook.SetTabAreaColour(globalvar.FNPageColor)

        for title, win in ((_("Info"), infoTxt), (_("Copyright"),
                                                  self._pageCopyright()),
                           (_("License"), self._pageLicense()),
                           (_("Authors"),
                            self._pageCredit()), (_("Contributors"),
                                                  self._pageContributors()),
                           (_("Extra contributors"),
                            self._pageContributors(extra=True)),
                           (_("Translators"), self._pageTranslators())):
            aboutNotebook.AddPage(page=win, text=title)
        wx.CallAfter(aboutNotebook.SetSelection, 0)

        # buttons
        btnClose = wx.Button(parent=panel, id=wx.ID_CLOSE)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        btnSizer.Add(item=btnClose,
                     proportion=0,
                     flag=wx.ALL | wx.ALIGN_RIGHT,
                     border=5)
        # bindings
        btnClose.Bind(wx.EVT_BUTTON, self.OnCloseWindow)

        infoTxt.SetSizer(infoSizer)
        infoSizer.Fit(infoTxt)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(item=aboutNotebook,
                  proportion=1,
                  flag=wx.EXPAND | wx.ALL,
                  border=1)
        sizer.Add(item=btnSizer,
                  proportion=0,
                  flag=wx.ALL | wx.ALIGN_RIGHT,
                  border=1)
        panel.SetSizer(sizer)

        self.Layout()
        self.SetMinSize((400, 400))
示例#10
0
    def __init__(self, parent, *args, frame=None, **kwargs):
        wx.Panel.__init__(self, parent, *args, **kwargs)
        self._Settings = None
        pub.subscribe(self._OnSettings, 'data.settings')

        sizer = wx.BoxSizer(orient=wx.VERTICAL)
        self.SetSizer(sizer)

        def add_divider(sizer):
            sizer.Add(wx.StaticLine(self), wx.SizerFlags().Expand())

        def add_valign(sizer, window, sizerflags=wx.SizerFlags()):
            sizer.Add(window, sizerflags.Align(wx.ALIGN_CENTER_VERTICAL))

        def two_col_sizer(rows):
            sizer = wx.FlexGridSizer(rows, 2, main.PADDING_PX, main.PADDING_PX)
            sizer.AddGrowableCol(1)
            return sizer

        # Add basic setting controls.
        basicForm = wx.Window(self)
        sizer.Add(basicForm, wx.SizerFlags().Border(wx.ALL, main.PADDING_PX)
                                            .Expand())
        basicSizer = two_col_sizer(3)
        basicForm.SetSizer(basicSizer)

        add_valign(basicSizer, wx.StaticText(basicForm, label='Wallet address'))
        self._Wallet = AddressCtrl(basicForm, size=(-1, -1))
        self.Bind(wx.EVT_TEXT, self.OnControlChange, self._Wallet)
        add_valign(basicSizer, self._Wallet, wx.SizerFlags().Expand())

        add_valign(basicSizer, wx.StaticText(basicForm, label='Worker name'))
        self._Worker = wx.TextCtrl(basicForm, size=(200, -1))
        self.Bind(wx.EVT_TEXT, self.OnControlChange, self._Worker)
        add_valign(basicSizer, self._Worker)

        add_valign(basicSizer, wx.StaticText(basicForm, label='Region'))
        self._Region = ChoiceByValue(
                basicForm, choices=REGIONS,
                fallbackChoice=settings.DEFAULT_SETTINGS['nicehash']['region'])
        self.Bind(wx.EVT_CHOICE, self.OnControlChange, self._Region)
        add_valign(basicSizer, self._Region)

        # Add API key controls.
        apiCollapsible = wx.CollapsiblePane(
                self, label='API Keys', style=wx.CP_NO_TLW_RESIZE)
        self.Bind(
                wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChange, apiCollapsible)
        sizer.Add(apiCollapsible, wx.SizerFlags().Border(wx.ALL, main.PADDING_PX)
                                                 .Expand())
        apiPane = apiCollapsible.GetPane()
        apiPaneSizer = wx.BoxSizer(orient=wx.VERTICAL)
        apiPane.SetSizer(apiPaneSizer)
        apiForm = wx.Window(apiPane)
        apiPaneSizer.Add(apiForm, wx.SizerFlags().Expand())
        apiFormSizer = two_col_sizer(3)
        apiForm.SetSizer(apiFormSizer)

        add_valign(apiFormSizer, wx.StaticText(apiForm, label='Organization ID'))
        self._Organization = wx.TextCtrl(apiForm, size=(-1, -1))
        self.Bind(wx.EVT_TEXT, self.OnControlChange, self._Organization)
        add_valign(apiFormSizer, self._Organization, wx.SizerFlags().Expand())

        add_valign(apiFormSizer, wx.StaticText(apiForm, label='API Key Code'))
        self._ApiKey = wx.TextCtrl(
                apiForm, size=(-1, -1), style=wx.TE_PASSWORD)
        self.Bind(wx.EVT_TEXT, self.OnControlChange, self._ApiKey)
        add_valign(apiFormSizer, self._ApiKey, wx.SizerFlags().Expand())

        add_valign(apiFormSizer,
                   wx.StaticText(apiForm, label='API Secret Key Code'))
        self._ApiSecret = wx.TextCtrl(
                apiForm, size=(-1, -1), style=wx.TE_PASSWORD)
        self.Bind(wx.EVT_TEXT, self.OnControlChange, self._ApiSecret)
        add_valign(apiFormSizer, self._ApiSecret, wx.SizerFlags().Expand())

        apiPaneSizer.AddSpacer(main.PADDING_PX)

        apiLink = HyperLinkCtrl(
                apiPane, label='(Get keys here)',
                URL='https://www.nicehash.com/my/settings/keys')
        apiPaneSizer.Add(apiLink, wx.SizerFlags().Expand())

        add_divider(sizer)

        # Add advanced setting controls.
        advancedForm = wx.Window(self)
        sizer.Add(advancedForm, wx.SizerFlags().Border(wx.ALL, main.PADDING_PX)
                                               .Expand())
        advancedSizer = two_col_sizer(3)
        advancedForm.SetSizer(advancedSizer)

        add_valign(advancedSizer,
                   wx.StaticText(advancedForm, label='Update interval (secs)'))
        self._Interval = wx.SpinCtrl(advancedForm, size=(125, -1),
                                     min=10, max=300, initial=60)
        self.Bind(wx.EVT_SPINCTRL, self.OnControlChange, self._Interval)
        add_valign(advancedSizer, self._Interval)

        add_valign(advancedSizer,
                   wx.StaticText(advancedForm,
                                 label='Profitability switch threshold (%)'))
        self._Threshold = wx.SpinCtrl(advancedForm, size=(125, -1),
                                      min=1, max=50, initial=10)
        self.Bind(wx.EVT_SPINCTRL, self.OnControlChange, self._Threshold)
        add_valign(advancedSizer, self._Threshold)

        add_valign(advancedSizer,
                   wx.StaticText(advancedForm, label='Display units'))
        self._Units = ChoiceByValue(
                advancedForm, choices=UNITS,
                fallbackChoice=settings.DEFAULT_SETTINGS['gui']['units'])
        self.Bind(wx.EVT_CHOICE, self.OnControlChange, self._Units)
        add_valign(advancedSizer, self._Units)

        sizer.AddStretchSpacer()

        # Add revert/save controls.
        saveForm = wx.Window(self)
        sizer.Add(saveForm, wx.SizerFlags().Border(wx.ALL, main.PADDING_PX)
                                           .Right())
        saveSizer = wx.BoxSizer(orient=wx.HORIZONTAL)
        saveForm.SetSizer(saveSizer)

        self._Revert = wx.Button(saveForm, id=wx.ID_REVERT_TO_SAVED)
        self.Bind(wx.EVT_BUTTON, self.OnRevert, self._Revert)
        saveSizer.Add(self._Revert)

        saveSizer.AddSpacer(main.PADDING_PX)

        self._Save = wx.Button(saveForm, id=wx.ID_APPLY)
        self.Bind(wx.EVT_BUTTON, self.OnSave, self._Save)
        saveSizer.Add(self._Save)