コード例 #1
0
    def __init__(self, parent):
        wx.Dialog.__init__(self, parent=parent, title="About")

        bitmapIcon = wx.StaticBitmap(self, bitmap=load_bitmap('icon'))
        textAbout = wx.StaticText(self, label="A simple spectrum analyser for "
                                  "scanning\n with a RTL-SDR compatible USB "
                                  "device", style=wx.ALIGN_CENTRE)
        textLink = HyperlinkCtrl(self, wx.ID_ANY,
                                 label="http://eartoearoak.com/software/rtlsdr-scanner",
                                 url="http://eartoearoak.com/software/rtlsdr-scanner")
        textVersion = wx.StaticText(self,
                                    label='v' + '.'.join([str(x) for x in VERSION]))
        buttonOk = wx.Button(self, wx.ID_OK)

        grid = wx.GridBagSizer(10, 10)
        grid.Add(bitmapIcon, pos=(0, 0), span=(3, 1),
                 flag=wx.ALIGN_LEFT | wx.ALL, border=10)
        grid.Add(textAbout, pos=(0, 1), span=(1, 2),
                 flag=wx.ALIGN_CENTRE | wx.ALL, border=10)
        grid.Add(textLink, pos=(1, 1), span=(1, 2),
                 flag=wx.ALIGN_CENTRE | wx.ALL, border=10)
        grid.Add(textVersion, pos=(2, 1), span=(1, 2),
                 flag=wx.ALIGN_CENTRE | wx.ALL, border=10)
        grid.Add(buttonOk, pos=(3, 2),
                 flag=wx.ALIGN_RIGHT | wx.ALL, border=10)

        self.SetSizerAndFit(grid)
        self.Centre()
コード例 #2
0
    def __init__(self,
                 message: str,
                 label: str = None,
                 url: str = None,
                 **kwargs) -> None:
        super(HyperlinkDialog, self).__init__(parent=None, **kwargs)
        pane = self.GetContentsPane()

        text_ctrl = StaticText(pane, label=message)
        text_ctrl.SetFocus()
        text_ctrl.SetSizerProps(align="center")

        if url is not None:
            if label is None:
                label = url
            hyperlink = HyperlinkCtrl(pane, label=label, url=url)
            hyperlink.Bind(EVT_HYPERLINK, self.on_hyperlink)

        button_ok = Button(pane, label="OK")
        button_ok.Bind(EVT_BUTTON, self.on_ok)
        button_ok.SetSizerProps(align="center", border=(["top"], 10))

        self.SetIcon(
            Icon(ArtProvider.GetBitmap(ART_INFORMATION, ART_MESSAGE_BOX)))
        self.Fit()
        self.Centre()
コード例 #3
0
    def __init__(self, thisPanel, log, api):
        self.logger = log
        self.api = api
        self.thisPanel = thisPanel
        self.rawPanel = RawPanel(thisPanel, wx.ID_ANY)
        self.dataPanel = None
        ## Box for simple queries
        self.ModelViewsBox = wx.StaticBox(self.thisPanel, wx.ID_ANY,
                                          "Model Views")
        self.ModelViewsList = SimpleQueryListCtrlPanel(self.ModelViewsBox,
                                                       self.logger, self.api,
                                                       self)
        self.filter = wx.SearchCtrl(self.ModelViewsBox,
                                    style=wx.TE_PROCESS_ENTER)
        self.filter.ShowCancelButton(True)
        self.filter.Bind(wx.EVT_TEXT, self.OnSearch)
        self.filter.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN,
                         lambda e: self.filter.SetValue(''))
        self.filter.Bind(wx.EVT_TEXT_ENTER, self.OnSearch)
        self.icons8 = HyperlinkCtrl(self.ModelViewsBox,
                                    wx.ID_ANY,
                                    label="Icons provided by Icons8",
                                    url="https://icons8.com")

        self.dataPanel = AppTreeView(self.rawPanel, self.logger, self.api)
        viewBox1 = wx.BoxSizer()
        viewBox1.Add(self.dataPanel, 1, wx.EXPAND | wx.ALL, 5)
        self.rawPanel.SetSizer(viewBox1)
        self.rawPanel.Show()
        self.rawPanel.SendSizeEvent()

        self.resetMainPanel()
        wx.EndBusyCursor()
コード例 #4
0
 def _get_metadata(self, name, value):
     sizer = wx.BoxSizer(wx.HORIZONTAL)
     sizer.Add(Label(self, label='%s: ' % name))
     if value.split('://')[0] in ['http', 'https']:
         sizer.Add(HyperlinkCtrl(self, -1, label=value, url=value))
     else:
         sizer.Add(Label(self, label=value))
     return sizer
コード例 #5
0
    def __init__(self, thisPanel, log, api):
        self.logger = log
        self.api = api
        self.thisPanel = thisPanel
        self.rawPanel = RawPanel(thisPanel, wx.ID_ANY)
        self.dataPanel = None
        ## Placeholder for when we known how to create an InputListCtrlPanel
        self.inputQueryList = None

        self.inputDrivenQueryBox = wx.StaticBox(self.thisPanel, wx.ID_ANY,
                                                "Input Driven Queries")
        self.inputDrivenQueryList = InputDrivenQueryListCtrlPanel(
            self.inputDrivenQueryBox, self.logger, self.api, self)
        self.inputListRawPanel = RawPanel(self.inputDrivenQueryBox, wx.ID_ANY)

        self.filter = wx.SearchCtrl(self.inputDrivenQueryBox,
                                    style=wx.TE_PROCESS_ENTER)
        self.filter.ShowCancelButton(True)
        self.filter.Bind(wx.EVT_TEXT, self.OnSearch)
        self.filter.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN,
                         lambda e: self.filter.SetValue(''))
        self.filter.Bind(wx.EVT_TEXT_ENTER, self.OnSearch)

        self.filterInputList = wx.SearchCtrl(self.inputDrivenQueryBox,
                                             style=wx.TE_PROCESS_ENTER)
        self.filterInputList.ShowCancelButton(True)
        self.filterInputList.Bind(wx.EVT_TEXT, self.OnInputListSearch)
        self.filterInputList.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN,
                                  lambda e: self.filterInputList.SetValue(''))
        self.filterInputList.Bind(wx.EVT_TEXT_ENTER, self.OnInputListSearch)
        self.icons8 = HyperlinkCtrl(self.inputDrivenQueryBox,
                                    wx.ID_ANY,
                                    label="Icons provided by Icons8",
                                    url="https://icons8.com")

        self.className = wx.TextCtrl(self.inputDrivenQueryBox,
                                     wx.ID_ANY,
                                     '',
                                     size=(110, -1),
                                     style=wx.TE_READONLY | wx.EXPAND
                                     | wx.BORDER_NONE)
        self.attrName = wx.TextCtrl(self.inputDrivenQueryBox,
                                    wx.ID_ANY,
                                    '',
                                    size=(110, -1),
                                    style=wx.TE_READONLY | wx.EXPAND
                                    | wx.BORDER_NONE)

        self.dataPanel = InputDrivenQueryListView(self.rawPanel, self.logger,
                                                  self.api)
        viewBox1 = wx.BoxSizer()
        viewBox1.Add(self.dataPanel, 1, wx.EXPAND | wx.ALL, 5)
        self.rawPanel.SetSizer(viewBox1)
        self.rawPanel.Show()
        self.rawPanel.SendSizeEvent()

        self.resetMainPanel()
        wx.EndBusyCursor()
コード例 #6
0
 def create_syntax_colorization_help(self):
     if self._syntax_colorization_help_exists:
         return
     label = Label(
         self,
         label="Syntax colorization disabled due to missing requirements.")
     link = HyperlinkCtrl(self, -1, label="Get help", url="")
     link.Bind(EVT_HYPERLINK, self.show_help_dialog)
     flags = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT
     syntax_colorization_help_sizer = wx.BoxSizer(wx.VERTICAL)
     syntax_colorization_help_sizer.AddMany([(label, 0, flags),
                                             (link, 0, flags)])
     self.editor_toolbar.add_expanding(syntax_colorization_help_sizer)
     self.Layout()
     self._syntax_colorization_help_exists = True
コード例 #7
0
 def create_widget(self):
     self.widget = HyperlinkCtrl(self.parent.widget, self.id, self.label,
                                 self.url)
コード例 #8
0
 def _add_help_dialog(self, sizer):
     # DEBUG wxPhoenix
     sizer.Add(HyperlinkCtrl(self, wx.ID_ANY, '', 'Need help?'))
     self.Bind(EVT_HYPERLINK, self.OnHelp)
コード例 #9
0
 def create_widget(self):
     self.widget = HyperlinkCtrl(self.parent_window.widget, wx.ID_ANY, self.label, self.url, style=self.style)
コード例 #10
0
    def __init__(self, parent, settings):
        self.settings = settings
        self.index = 0

        wx.Dialog.__init__(self, parent=parent, title="Preferences")

        self.colours = get_colours()
        self.winFunc = settings.winFunc
        self.background = settings.background

        self.checkSaved = wx.CheckBox(self, wx.ID_ANY, "Save warning")
        self.checkSaved.SetValue(settings.saveWarn)
        self.checkBackup = wx.CheckBox(self, wx.ID_ANY, "Backup")
        self.checkBackup.SetValue(settings.backup)
        self.checkBackup.SetToolTip('Backup data after crash')
        self.checkAlert = wx.CheckBox(self, wx.ID_ANY, "Level alert (dB)")
        self.checkAlert.SetValue(settings.alert)
        self.checkAlert.SetToolTip('Play alert when level exceeded')
        self.Bind(wx.EVT_CHECKBOX, self.__on_alert, self.checkAlert)
        self.spinLevel = wx.SpinCtrl(self, wx.ID_ANY, min=-100, max=20)
        self.spinLevel.SetValue(settings.alertLevel)
        self.spinLevel.Enable(settings.alert)
        self.spinLevel.SetToolTip('Alert threshold')
        textBackground = wx.StaticText(self, label='Background colour')
        self.buttonBackground = wx.Button(self, wx.ID_ANY)
        self.buttonBackground.SetBackgroundColour(self.background)
        self.Bind(wx.EVT_BUTTON, self.__on_background, self.buttonBackground)
        textColour = wx.StaticText(self, label="Colour map")
        self.choiceColour = wx.Choice(self, choices=self.colours)
        self.choiceColour.SetSelection(self.colours.index(settings.colourMap))
        self.Bind(wx.EVT_CHOICE, self.__on_choice, self.choiceColour)
        self.colourBar = PanelColourBar(self, settings.colourMap)
        self.checkPoints = wx.CheckBox(self, wx.ID_ANY, "Limit points")
        self.checkPoints.SetValue(settings.pointsLimit)
        self.checkPoints.SetToolTip('Limit the resolution of plots')
        self.Bind(wx.EVT_CHECKBOX, self.__on_points, self.checkPoints)
        self.spinPoints = wx.SpinCtrl(self, wx.ID_ANY, min=1000, max=100000)
        self.spinPoints.Enable(settings.pointsLimit)
        self.spinPoints.SetValue(settings.pointsMax)
        self.spinPoints.SetToolTip('Maximum number of points to plot_line')
        textDpi = wx.StaticText(self, label='Export DPI')
        self.spinDpi = wx.SpinCtrl(self, wx.ID_ANY, min=72, max=6000)
        self.spinDpi.SetValue(settings.exportDpi)
        self.spinDpi.SetToolTip('DPI of exported images')
        self.checkTune = wx.CheckBox(self, wx.ID_ANY, "Tune SDR#")
        self.checkTune.SetValue(settings.clickTune)
        self.checkTune.SetToolTip('Double click plot_line to tune SDR#')
        textPlugin = HyperlinkCtrl(
            self,
            wx.ID_ANY,
            label="(Requires plugin)",
            url="http://eartoearoak.com/software/sdrsharp-net-remote")

        self.radioAvg = wx.RadioButton(self,
                                       wx.ID_ANY,
                                       'Average Scans',
                                       style=wx.RB_GROUP)
        self.radioAvg.SetToolTip('Average level with each scan')
        self.Bind(wx.EVT_RADIOBUTTON, self.__on_radio, self.radioAvg)
        self.radioRetain = wx.RadioButton(self, wx.ID_ANY,
                                          'Retain previous scans')
        self.radioRetain.SetToolTip('Can be slow')
        self.Bind(wx.EVT_RADIOBUTTON, self.__on_radio, self.radioRetain)
        self.radioRetain.SetValue(settings.retainScans)

        textMaxScans = wx.StaticText(self, label="Max scans")
        self.spinCtrlMaxScans = wx.SpinCtrl(self)
        self.spinCtrlMaxScans.SetRange(1, 5000)
        self.spinCtrlMaxScans.SetValue(settings.retainMax)
        self.spinCtrlMaxScans.SetToolTip('Maximum previous scans'
                                         ' to display')

        textWidth = wx.StaticText(self, label="Line width")
        self.ctrlWidth = NumCtrl(self, integerWidth=2, fractionWidth=1)
        self.ctrlWidth.SetValue(settings.lineWidth)

        self.__on_radio(None)

        sizerButtons = wx.StdDialogButtonSizer()
        buttonOk = wx.Button(self, wx.ID_OK)
        buttonCancel = wx.Button(self, wx.ID_CANCEL)
        sizerButtons.AddButton(buttonOk)
        sizerButtons.AddButton(buttonCancel)
        sizerButtons.Realize()
        self.Bind(wx.EVT_BUTTON, self.__on_ok, buttonOk)

        gengrid = wx.GridBagSizer(10, 10)
        gengrid.Add(self.checkSaved, pos=(0, 0))
        gengrid.Add(self.checkBackup, pos=(1, 0))
        gengrid.Add(self.checkAlert, pos=(2, 0), flag=wx.ALIGN_CENTRE)
        gengrid.Add(self.spinLevel, pos=(2, 1))
        gengrid.Add(textBackground, pos=(3, 0), flag=wx.ALIGN_CENTRE)
        gengrid.Add(self.buttonBackground, pos=(3, 1))
        gengrid.Add(textColour, pos=(4, 0))
        gengrid.Add(self.choiceColour, pos=(4, 1))
        gengrid.Add(self.colourBar, pos=(4, 2))
        gengrid.Add(self.checkPoints, pos=(5, 0))
        gengrid.Add(self.spinPoints, pos=(5, 1))
        gengrid.Add(textDpi, pos=(6, 0))
        gengrid.Add(self.spinDpi, pos=(6, 1))
        gengrid.Add(self.checkTune, pos=(7, 0))
        gengrid.Add(textPlugin, pos=(7, 1))
        genbox = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "General"))
        genbox.Add(gengrid, 0, wx.ALL | wx.ALIGN_CENTRE_VERTICAL, 10)

        congrid = wx.GridBagSizer(10, 10)
        congrid.Add(self.radioAvg, pos=(0, 0))
        congrid.Add(self.radioRetain, pos=(1, 0))
        congrid.Add(textMaxScans, pos=(2, 0), flag=wx.ALIGN_CENTRE_VERTICAL)
        congrid.Add(self.spinCtrlMaxScans, pos=(2, 1))
        conbox = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, "Continuous Scans"), wx.VERTICAL)
        conbox.Add(congrid, 0, wx.ALL | wx.EXPAND, 10)

        plotgrid = wx.GridBagSizer(10, 10)
        plotgrid.Add(textWidth, pos=(0, 0))
        plotgrid.Add(self.ctrlWidth, pos=(0, 1))
        plotbox = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Plot View"),
                                    wx.HORIZONTAL)
        plotbox.Add(plotgrid, 0, wx.ALL | wx.EXPAND, 10)

        grid = wx.GridBagSizer(10, 10)
        grid.Add(genbox, pos=(0, 0), span=(1, 2), flag=wx.EXPAND)
        grid.Add(conbox, pos=(1, 0), span=(1, 2), flag=wx.EXPAND)
        grid.Add(plotbox, pos=(2, 0), span=(1, 2), flag=wx.EXPAND)
        grid.Add(sizerButtons, pos=(3, 1), flag=wx.EXPAND)

        box = wx.BoxSizer()
        box.Add(grid, flag=wx.ALL | wx.ALIGN_CENTRE, border=10)

        self.SetSizerAndFit(box)
コード例 #11
0
 def _add_help_dialog(self, sizer):
     need_help = HyperlinkCtrl(self, wx.ID_ANY, '', 'Need help?')
     need_help.SetBackgroundColour(Colour(self.color_secondary_background))
     need_help.SetForegroundColour(Colour(self.color_secondary_foreground))
     sizer.Add(need_help)
     self.Bind(EVT_HYPERLINK, self.OnHelp)