def doGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # the list box # Translators: This is the label of the list appearing on List of Words dialog. wordsListDialog = _("Words and its occurrences") self.wordsListBox = sHelper.addLabeledControl(wordsListDialog, wx.ListBox, id = wx.ID_ANY, choices=self.wdsList, style = wx.LB_SINGLE, size = (700,580)) if self.wordsListBox.GetCount(): self.wordsListBox.SetSelection(0) # Buttons if len(wordList)is not 0: bHelper= guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: This is a label of a button appearing on List of Words dialog. showButton = bHelper.addButton(self, id = wx.ID_ANY, label=_("&Show occurrences")) showButton.SetDefault() sHelper.addItem(bHelper) bHelper = sHelper.addDialogDismissButtons(guiHelper.ButtonHelper(wx.HORIZONTAL)) closeButton = bHelper.addButton(self, id = wx.ID_CLOSE, label = _("&Close")) if len(wordList)is 0: closeButton.SetDefault() mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # Events closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) self.SetEscapeId(wx.ID_CLOSE) else: mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # Events showButton.Bind(wx.EVT_BUTTON, self.onOkButton) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) self.SetEscapeId(wx.ID_CLOSE)
def _buildGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) mainHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) timerHelper = guiHelper.BoxSizerHelper(self, orientation=wx.HORIZONTAL) feedbackHelper = guiHelper.BoxSizerHelper(self, orientation=wx.HORIZONTAL) self._timerValueCtrl = timerHelper.addLabeledControl("", wx.TextCtrl) # Translators: time unit radio group label self._timeUnitCTRL = timerHelper.addItem( wx.RadioBox(self, label=_("Time unit"), choices=getTimeUnits(), majorDimension=1, style=wx.RA_SPECIFY_ROWS)) mainHelper.addItem(timerHelper) # Translators: type of watch combobox label self._operationModeCTRL = mainHelper.addLabeledControl( _("Type of watch"), wx.Choice, id=wx.ID_ANY, choices=getOperationModes()) timerActions = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: start button self._startButton = timerActions.addButton(self, label=_("start")) self._pauseButton = timerActions.addButton(self, label=PAUSE) # Translators: stop button self._stopButton = timerActions.addButton(self, label=_("stop")) mainHelper.addItem(timerActions) # Translators: report progress with sound checkbox label self._reportWithSoundCheckbox = feedbackHelper.addItem( wx.CheckBox(self, id=wx.ID_ANY, label=_("Report progress with sound"))) # Translators: report progress with speech checkbox label self._reportWithSpeechCheckbox = feedbackHelper.addItem( wx.CheckBox(self, id=wx.ID_ANY, label=_("Report progress with speech"))) mainHelper.addItem(feedbackHelper) dialogActions = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: close button self._closeButton = dialogActions.addButton(self, label=_("Close"), id=wx.ID_CANCEL) mainHelper.addItem(dialogActions) self._statusBar = wx.StatusBar(self, id=wx.ID_ANY) self._statusBar.SetStatusText(getStatus()) mainHelper.addItem(self._statusBar, flag=wx.EXPAND) self._setInitialValues() self._refreshUI() mainSizer.Add(mainHelper.sizer, border=10, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) self.CentreOnScreen()
def doGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # the list box # Translators: This is the label of the list appearing # on Active Windows List Display dialog. windowsListLabelText = _("Current &applications") + ":" self.windowsListBox = sHelper.addLabeledControl( windowsListLabelText, wx.ListBox, id=wx.ID_ANY, choices=self.windowNamesList, style=wx.LB_SINGLE, size=(700, 280)) if self.windowsListBox.GetCount(): self.windowsListBox.SetSelection(0) # Buttons bHelper = guiHelper.ButtonHelper(wx.HORIZONTAL) switchToButton = bHelper.addButton( parent=self, # Translators: This is a label of a button appearing # on active windows list display dialog. label=_("&Switch to")) switchToButton.SetDefault() destroyButton = bHelper.addButton( parent=self, # Translators: This is a label of a button appearing # on active windows list display dialog. label=_("&Destroy")) destroyAllButton = bHelper.addButton( parent=self, # Translators: This is a label of a button appearing # on active windows list display dialog. label=_("Destro&y all")) sHelper.addItem(bHelper) bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) closeButton = bHelper.addButton( self, id=wx.ID_CLOSE, label=NVDAString("&Close")) mainSizer.Add( sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # Events switchToButton.Bind(wx.EVT_BUTTON, self.onSwitchToButton) destroyButton.Bind(wx.EVT_BUTTON, self.onDestroyButton) destroyAllButton.Bind(wx.EVT_BUTTON, self.onDestroyAllButton) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) self.windowsListBox.Bind(wx.EVT_KEY_DOWN, self.onKeydown) self.Bind(wx.EVT_ACTIVATE, self.onActivate) self.SetEscapeId(wx.ID_CLOSE)
def makeSettings(self, settingsSizer): # init self.modifiedKeyLabels = _addonConfigManager .getRedefinedKeyLabels() self.basicLocalizedKeyLabels = _addonConfigManager.getBasicLocalizedKeyLabels() self.localizedLabel2KeyName = dict((name, code) for code, name in self.basicLocalizedKeyLabels.items()) self.localizedLabels = [x for x in self.localizedLabel2KeyName] self.localizedLabels.sort() # gui sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer) # Translators: The label for the list box # in KeyboardKeyRenaming Dialog to select a key label. keyLabelsListlabelText = _("NVDA defined key labels:") self.keyLabelsList = sHelper.addLabeledControl( keyLabelsListlabelText, wx.ListBox, id=wx.ID_ANY, name="NVDAKeyLabels", choices=self.localizedLabels) self.keyLabelsList.SetSelection(0) # Translators: The label for the modified Label Box . modifiedLabelText = _("Modified label:") self.modifiedLabelBox_id = wx.NewIdRef() self.modifiedLabelBox = sHelper.addLabeledControl( modifiedLabelText, wx.TextCtrl, id=self.modifiedLabelBox_id) keyName = self.localizedLabel2KeyName[self.localizedLabels[0]] if keyName in self.modifiedKeyLabels: self.modifiedLabelBox.SetValue(self.modifiedKeyLabels[keyName]) else: self.modifiedLabelBox.Disable() # buttons bHelper = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: the button to redefine the selected key label. editButton = bHelper.addButton(self, label=_("&Modify")) # Translators: the button to remove the label of replacement. self.removeButton = bHelper.addButton(self, label=_("&Remove")) # Translators: the button to remove all the labels of replacement. labelText = _("R&emove all") self.removeAllButton = bHelper.addButton(self, label=labelText) sHelper.addItem(bHelper) bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) # events self.keyLabelsList.Bind(wx.EVT_LISTBOX, self.onSelect) self.keyLabelsList.Bind(wx.EVT_SET_FOCUS, self.onFocus) editButton.Bind(wx.EVT_BUTTON, self.onModifyLabel) self.removeButton.Bind(wx.EVT_BUTTON, self.onRemoveLabel) self.removeAllButton.Bind(wx.EVT_BUTTON, self.onRemoveAllLabels) self.keyLabelsList.Bind(wx.EVT_KEY_DOWN, self.onKeydown) self.modifiedLabelBox.Bind(wx.EVT_KEY_DOWN, self.onKeydown) self.modifiedLabelBox.Bind(wx.EVT_SET_FOCUS, self.onFocus)
def __init__(self, parent, destPath, version): self.destPath=destPath self.version = version storeUpdatesDirWritable=os.path.isdir(storeUpdatesDir) and os.access(storeUpdatesDir, os.W_OK) # Translators: The title of the dialog asking the user to Install an NVDA update. super(UpdateAskInstallDialog, self).__init__(parent, title=_("NVDA Update")) mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: A message indicating that an updated version of NVDA is ready to be installed. sHelper.addItem(wx.StaticText(self, label=_("NVDA version {version} is ready to be installed.\n").format(version=version))) bHelper = sHelper.addDialogDismissButtons(guiHelper.ButtonHelper(wx.HORIZONTAL)) # Translators: The label of a button to install an NVDA update. installButton = bHelper.addButton(self, wx.ID_OK, label=_("&Install update")) installButton.Bind(wx.EVT_BUTTON, self.onInstallButton) installButton.SetFocus() if storeUpdatesDirWritable: # Translators: The label of a button to postpone an NVDA update. postponeButton = bHelper.addButton(self, wx.ID_CLOSE, label=_("&Postpone update")) postponeButton.Bind(wx.EVT_BUTTON, self.onPostponeButton) self.EscapeId = wx.ID_CLOSE else: self.EscapeId = wx.ID_OK mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.Sizer = mainSizer mainSizer.Fit(self) self.CentreOnScreen()
def __init__(self, parent): CHANGES = self.changesLog() # Translators: The title of the check updates dialog. super(checkUpdatesDialog, self).__init__(parent, title=_("New Version Notification")) mainSizer = wx.BoxSizer(wx.VERTICAL) sizerHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: Message displayed when updates are available. sizerHelper.addItem(wx.StaticText(self, label=CHANGES)) bHelper = sizerHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) # Translators: The label of a button. label = _("Proceed to &download page") self.upgradeButton = bHelper.addButton(self, label=label) self.upgradeButton.Bind(wx.EVT_BUTTON, self.onUpgrade) closeButton = bHelper.addButton(self, wx.ID_CLOSE, label=translate("&Close")) closeButton.Bind(wx.EVT_BUTTON, self.onClose) self.Bind(wx.EVT_CLOSE, lambda evt: self.onClose) self.EscapeId = wx.ID_CLOSE mainSizer.Add(sizerHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.Sizer = mainSizer mainSizer.Fit(self) self.CentreOnScreen() wx.CallAfter(self.Show)
def makeSettings(self, settingsSizer): global rulesDialogOpen rulesDialogOpen = True reloadRules() self.rules = rules[:] sHelper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer) # Rules table rulesText = _("&Rules") self.rulesList = sHelper.addLabeledControl( rulesText, nvdaControls.AutoWidthColumnListCtrl, autoSizeColumn=2, itemTextCallable=self.getItemTextForList, style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_VIRTUAL) # Translators: The label for a column in symbols list used to identify a symbol. self.rulesList.InsertColumn(0, _("Pattern"), width=self.scaleSize(150)) self.rulesList.InsertColumn(1, _("Status")) self.rulesList.InsertColumn(2, _("Type")) self.rulesList.InsertColumn(3, _("Effect")) self.rulesList.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.onListItemFocused) self.rulesList.ItemCount = len(self.rules) # Buttons bHelper = sHelper.addItem( guiHelper.ButtonHelper(orientation=wx.HORIZONTAL)) self.moveUpButton = bHelper.addButton(self, label=_("Move &up")) self.moveDownButton = bHelper.addButton(self, label=_("Move &down")) self.addAudioButton = bHelper.addButton(self, label=_("Add &audio rule")) self.addAudioButton.Bind(wx.EVT_BUTTON, self.OnAddClick) self.editButton = bHelper.addButton(self, label=_("Edi&t")) self.editButton.Bind(wx.EVT_BUTTON, self.OnEditClick) self.removeButton = bHelper.addButton(self, label=_("Re&move rule")) self.removeButton.Bind(wx.EVT_BUTTON, self.OnRemoveClick)
def doGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # the text control tcLabel = sHelper.addItem( wx.StaticText(self, label=self.informationLabel)) self.tc = sHelper.addItem( wx.TextCtrl(self, id=wx.ID_ANY, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH, size=(1000, 600))) self.tc.AppendText(self.information) self.tc.SetInsertionPoint(0) # the buttons bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) # Translators: label of copy to clipboard button copyToClipboardButton = bHelper.addButton( self, id=wx.ID_ANY, label=_("Co&py to Clipboard")) closeButton = bHelper.addButton(self, id=wx.ID_CLOSE, label=NVDAString("&Close")) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # events copyToClipboardButton.Bind(wx.EVT_BUTTON, self.onCopyToClipboardButton) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) self.tc.SetFocus() self.SetEscapeId(wx.ID_CLOSE)
def doGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # the text control sHelper.addItem(wx.StaticText(self, label=self.waitMessage)) # the buttons bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) interruptButton = bHelper.addButton( self, id=wx.ID_ANY, # Translators: label of interrupt to clipboard button. label=_("&interrupt")) cancelButton = bHelper.addButton(self, id=wx.ID_CANCEL, label=_("&Cancel")) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) cancelButton.SetFocus() # the events cancelButton.Bind(wx.EVT_BUTTON, self.onCancelButton) interruptButton.Bind(wx.EVT_BUTTON, self.onInterruptButton) self.Bind(wx.EVT_CLOSE, self.onClose) self.SetEscapeId(wx.ID_CANCEL) self.Bind(wx.EVT_ACTIVATE, self.onActivate)
def __init__(self, parent, addonUpdateInfo, auto=True): # Translators: The title of the add-on updates dialog. super(AddonUpdatesDialog, self).__init__(parent, title=_("NVDA Add-on Updates")) mainSizer = wx.BoxSizer(wx.VERTICAL) addonsSizerHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) self.addonUpdateInfo = addonUpdateInfo self.auto = auto if addonUpdateInfo: entriesSizer = wx.BoxSizer(wx.VERTICAL) self.addonsList = AutoWidthColumnCheckListCtrl(self, -1, style=wx.LC_REPORT | wx.LC_SINGLE_SEL, size=(550, 350)) self.addonsList.Bind(wx.EVT_CHECKLISTBOX, self.onAddonsChecked) self.addonsList.InsertColumn(0, translate("Package"), width=150) # Translators: The label for a column in add-ons list used to identify add-on's running status (example: status is running). self.addonsList.InsertColumn(1, _("Current version"), width=50) # Translators: The label for a column in add-ons list used to identify add-on's version (example: version is 0.3). self.addonsList.InsertColumn(2, _("New version"), width=50) entriesSizer.Add(self.addonsList, proportion=8) for entry in sorted(addonUpdateInfo.keys()): addon = addonUpdateInfo[entry] self.addonsList.Append( (addon['summary'], addon['curVersion'], addon['version'])) self.addonsList.CheckItem(self.addonsList.GetItemCount() - 1) self.addonsList.Select(0) self.addonsList.SetItemState(0, wx.LIST_STATE_FOCUSED, wx.LIST_STATE_FOCUSED) addonsSizerHelper.addItem(entriesSizer) else: # Translators: Message displayed when no add-on updates are available. addonsSizerHelper.addItem( wx.StaticText(self, label=_("No add-on update available."))) bHelper = addonsSizerHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) if addonUpdateInfo: # Translators: The label of a button to update add-ons. label = _("&Update add-ons") self.updateButton = bHelper.addButton(self, label=label) self.updateButton.Bind(wx.EVT_BUTTON, self.onUpdate) closeButton = bHelper.addButton(self, wx.ID_CLOSE, label=translate("&Close")) closeButton.Bind(wx.EVT_BUTTON, self.onClose) self.Bind(wx.EVT_CLOSE, lambda evt: self.onClose) self.EscapeId = wx.ID_CLOSE mainSizer.Add(addonsSizerHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.Sizer = mainSizer mainSizer.Fit(self) self.Center(wx.BOTH | wx.CENTER_ON_SCREEN) wx.CallAfter(self.Show)
def doGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: This is a label for a edit box in Minute Timer Dialog # to show remaining duration. remainingDurationLabel = _("Remaining duration:") self.remainingDurationEdit = sHelper.addLabeledControl( remainingDurationLabel, wx.TextCtrl) self.remainingDurationEdit.Value = str( _curMinuteTimer.getRemainingTime()) # the buttons bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) # Translators: The label for a button # in Minute Timer dialog to stop minute timer. stopButton = bHelper.addButton(self, label=_("&Stop")) closeButton = bHelper.addButton(self, id=wx.ID_CLOSE, label=NVDAString("&Close")) closeButton.SetDefault() mainSizer.Add(sHelper.sizer, border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # events self.remainingDurationEdit.Bind(wx.EVT_SET_FOCUS, self.onFocus) stopButton.Bind(wx.EVT_BUTTON, self.onStopButton) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) self.SetEscapeId(wx.ID_CLOSE) # start monitoring self.monitorRemainingTime()
def __init__(self, parent: wx.Window) -> None: """Layout of dialog box elements to show. @param parent: parent top level window @type parent: wx.Window """ # Translators: The title of the dialog which appears when the user enables or disables the default gestures super(AddonsReloadDialog, self).__init__(parent, title=_("Gestures Configuration Change")) mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: The message displayed when addon gestures has been changed. sHelper.addItem(wx.StaticText(self, label=_("NVDA add-ons must be reloaded for the new gestures to take effect."))) if not config.conf[addonName]['gestures']: # Translators: The warning is displayed before switching on default addon gestures sHelper.addItem(wx.StaticText(self, label=_("Warning! Using the feature to set the maximum volume level may damage your hearing."))) bHelper = sHelper.addDialogDismissButtons(guiHelper.ButtonHelper(wx.HORIZONTAL)) # Translators: The label for a button in the dialog which appears when the user changed addon's default gestures reloadNowButton = bHelper.addButton(self, label=_("Reload &now")) reloadNowButton.Bind(wx.EVT_BUTTON, self.onReloadNowButton) reloadNowButton.SetFocus() # Translators: The label for a button in the dialog which appears when the user changed addon's default gestures reloadLaterButton = bHelper.addButton(self, wx.ID_CLOSE, label=_("Reload &later")) reloadLaterButton.Bind(wx.EVT_BUTTON, lambda evt: self.Close()) self.Bind(wx.EVT_CLOSE, lambda evt: self.Destroy()) self.EscapeId = wx.ID_CLOSE mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.Sizer = mainSizer mainSizer.Fit(self) self.CentreOnScreen()
def doGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) self.deviceNames = getDeviceNames() from synthDriverHandler import _audioOutputDevice self.curOutputDevice = _audioOutputDevice # Translators: temporary output device text # on Temporary audio output device manager dialog. labelText = _( "Current temporary audio device: %s") % (_temporaryOutputDevice if _temporaryOutputDevice else _("None")) self.currentTemporaryOutputDeviceTextCtrl = sHelper.addItem(wx.StaticText( self, label=labelText) ) # Translators: This is the label for a listbox # on Temporary audio device manager dialog. labelText = _("Select a &device:") deviceNames = getDeviceNames() self.audioDevicesListBox = sHelper.addLabeledControl( labelText, nvdaControls.CustomCheckListBox, choices=deviceNames) self.audioDevicesListBox.SetStringSelection(self.curOutputDevice) from ..settings import _addonConfigManager devicesForCycle = _addonConfigManager.getAudioDevicesForCycle() for device in deviceNames: index = deviceNames.index(device) if device in devicesForCycle: self.audioDevicesListBox.Check(index) # the buttons bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) setButton = bHelper.addButton( self, # Translators: This is a label of a button appearing # on Temporary audio device manager dialog. label=_("&Set as temporary audio device")) setButton.SetDefault() quitTemporaryAudioDeviceButton = bHelper.addButton( self, # Translators: This is a label of a button appearing # on Temporary audio device manager dialog. label=_("&leave up the temporary audio device")) closeButton = bHelper.addButton( self, id=wx.ID_CLOSE, label=NVDAString("&Close")) mainSizer.Add(sHelper.sizer, border=10, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # the events self.audioDevicesListBox.Bind(wx.EVT_LISTBOX, self.onSelectDevice) setButton.Bind(wx.EVT_BUTTON, self.onSetButton) quitTemporaryAudioDeviceButton.Bind(wx.EVT_BUTTON, self.onQuitTemporaryAudioDevice) closeButton.Bind(wx.EVT_BUTTON, self.onClose) self.SetEscapeId(wx.ID_CLOSE) self.audioDevicesListBox.SetFocus() if not _temporaryOutputDevice: quitTemporaryAudioDeviceButton.Disable()
def doGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # the list box # Translators: this is the label of the list appearing # in NVDA - System tray icons 's list dialog. labelText = _("&Icons") + ":" self.iconsList = sHelper.addLabeledControl(labelText, wx.ListBox, id=wx.ID_ANY, style=wx.LB_SINGLE, size=(700, 280)) self.iconsList.AppendItems(self.getIconsList()) if self.iconsList.Count: self.iconsList.Select(0) # the buttons bHelper = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: this is a button appearing # in NVDA - System tray icons 's list dialog. rightClickButton = bHelper.addButton(self, label=_("&Right click")) rightClickButton.SetDefault() # Translators: this is a button appearing # in NVDA - System tray icons 's list dialog. leftClickButton = bHelper.addButton(self, label=_("&Left click")) # Translators: this is a button appearing # in NVDA - System tray icons 's list dialog. doubleLeftClickButton = bHelper.addButton( self, label=_("Dou&ble left click")) sHelper.addItem(bHelper) bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) closeButton = bHelper.addButton(self, id=wx.ID_CLOSE, label=NVDAString("&Close")) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # the events rightClickButton.Bind(wx.EVT_BUTTON, self.onRightMouseButton) leftClickButton.Bind(wx.EVT_BUTTON, self.onLeftClick) doubleLeftClickButton.Bind(wx.EVT_BUTTON, self.onDoubleLeftClick) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) self.SetEscapeId(wx.ID_CLOSE) self.iconsList.SetFocus()
def __init__(self, parent, updateInfo, auto): # Translators: The title of the dialog informing the user about an NVDA update. super(UpdateResultDialog, self).__init__(parent, title=_("NVDA Update")) self.updateInfo = updateInfo mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) if updateInfo: self.isInstalled = config.isInstalledCopy() if isPendingUpdate() and state["pendingUpdateVersion"] == updateInfo["version"]: # Translators: A message indicating that an updated version of NVDA has been downloaded # and is pending to be installed. message = _("NVDA version {version} has been downloaded and is pending installation.").format(**updateInfo) else: # Translators: A message indicating that an updated version of NVDA is available. # {version} will be replaced with the version; e.g. 2011.3. message = _("NVDA version {version} is available.").format(**updateInfo) else: # Translators: A message indicating that no update to NVDA is available. message = _("No update available.") sHelper.addItem(wx.StaticText(self, label=message)) bHelper = sHelper.addDialogDismissButtons(guiHelper.ButtonHelper(wx.HORIZONTAL)) if updateInfo: if isPendingUpdate() and state["pendingUpdateVersion"] == updateInfo["version"]: # Translators: The label of a button to install a pending NVDA update. # {version} will be replaced with the version; e.g. 2011.3. installPendingButton = bHelper.addButton(self, label=_("&Install NVDA {version}").format(**updateInfo)) installPendingButton.Bind(wx.EVT_BUTTON, self.onInstallButton) # Translators: The label of a button to re-download a pending NVDA update. label = _("Re-&download update") else: # Translators: The label of a button to download an NVDA update. label = _("&Download update") downloadButton = bHelper.addButton(self, label=label) downloadButton.Bind(wx.EVT_BUTTON, self.onDownloadButton) if auto and (not isPendingUpdate() or state["pendingUpdateVersion"] != updateInfo["version"]): # Translators: The label of a button to remind the user later about performing some action. remindMeButton = bHelper.addButton(self, label=_("Remind me &later")) remindMeButton.Bind(wx.EVT_BUTTON, self.onLaterButton) remindMeButton.SetFocus() # Translators: The label of a button to close a dialog. closeButton = bHelper.addButton(self, wx.ID_CLOSE, label=_("&Close")) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Close()) self.Bind(wx.EVT_CLOSE, lambda evt: self.Destroy()) self.EscapeId = wx.ID_CLOSE mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.Sizer = mainSizer mainSizer.Fit(self) self.CentreOnScreen() self.Show()
def __init__(self, parent): super(NewLanguageAddingDialog,self).__init__(parent, title=_("New language adding")) import languageHandler self.mainSizer=wx.BoxSizer(wx.VERTICAL) self.sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.HORIZONTAL) exist_languages = os.listdir(os.path.join(base_path, 'locale')) self.languageNames = languageHandler.getAvailableLanguages()[:-1] self.languageNames = [x for x in self.languageNames if not x[0] in exist_languages] languageChoices = [x[1] for x in self.languageNames] print(languageChoices) # Translators: The label for a setting in general settings to select NVDA's interface language (once selected, NVDA must be restarted; the option user default means the user's Windows language will be used). languageLabelText = _("&Language:") self.languageList=self.sHelper.addLabeledControl(languageLabelText, wx.Choice, choices=languageChoices) self.languageIndex = self.languageList.Selection = 0 languageListSize = self.languageList.GetSize() self.certainLanguageList = self.sHelper.addItem(wx.Choice(self, size=languageListSize)) #self.certainLanguageList=self.sHelper.addLabeledControl(languageLabelText, wx.Choice, choices=[], size=languageListSize) self.certainLanguageList.Hide() self.certainButton = self.sHelper.addItem(wx.Button(self, label=_("&Select"))) self.certainButton.Bind(wx.EVT_BUTTON, self.OnCertainClick) self.certainLanguage = None self.uncertainButton = self.sHelper.addItem(wx.Button(self, label=_("&Unselect"))) self.uncertainButton.Bind(wx.EVT_BUTTON, self.OnUncertainClick) self.uncertainButton.Hide() #bHelper = sHelper.addItem(guiHelper.ButtonHelper(orientation=wx.HORIZONTAL)) self.bHelper = guiHelper.ButtonHelper(orientation=wx.HORIZONTAL) # Add button self.unicodeDicButton = self.bHelper.addButton(self, label=_("unicode dictionary")) self.mathRuleButton = self.bHelper.addButton(self, label=_("math rule")) self.OkButton = self.bHelper.addButton(self, label=_("OK"), id=wx.ID_OK) # Bind button self.unicodeDicButton.Bind(wx.EVT_BUTTON, self.OnUnicodeDicClick) self.mathRuleButton.Bind(wx.EVT_BUTTON, self.OnMathRuleClick) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) # Hide button self.unicodeDicButton.Disable() self.mathRuleButton.Disable() self.OkButton.Disable() self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.mainSizer.Add(self.sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.mainSizer.Add(self.bHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.mainSizer.Fit(self) self.SetSizer(self.mainSizer)
def makeSettings(self, settingsSizer): sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer) # Translators: The label for symbols list in symbol pronunciation dialog. mathrulesText = _("&Mathrules") try: #NVDA version >= 2019.2 syntax with autoSizeColumn keyword self.mathrulesList = sHelper.addLabeledControl(mathrulesText, nvdaControls.AutoWidthColumnListCtrl, autoSizeColumn=0, style=wx.LC_REPORT | wx.LC_SINGLE_SEL) except TypeError: #NVDA version <= 2019.1.1 syntax with autoSizeColumnIndex keyword self.mathrulesList = sHelper.addLabeledControl(mathrulesText, nvdaControls.AutoWidthColumnListCtrl, autoSizeColumnIndex=0, style=wx.LC_REPORT | wx.LC_SINGLE_SEL) # Translators: The label for a column in symbols list used to identify a symbol. self.mathrulesList.InsertColumn(0, _("Rule")) self.mathrulesList.InsertColumn(1, _("Description")) self.refresh() self.mathrulesList.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.onListItemFocused) # Used to ensure that event handlers call Skip(). Not calling skip can cause focus problems for controls. More # generally the advice on the wx documentation is: "In general, it is recommended to skip all non-command events # to allow the default handling to take place. The command events are, however, normally not skipped as usually # a single command such as a button click or menu item selection must only be processed by one handler." def skipEventAndCall(handler): def wrapWithEventSkip(event): if event: event.Skip() return handler() return wrapWithEventSkip bHelper = sHelper.addItem(guiHelper.ButtonHelper(orientation=wx.HORIZONTAL)) # Translators: The label for a button to edit math rule. self.editButton = bHelper.addButton(self, label=_("&Edit")) self.editButton.Disable() # Translators: The label for a button to example math rule. self.exampleButton = bHelper.addButton(self, label=_("E&xample")) self.exampleButton.Disable() # Translators: The label for a button to recover default value. recoverDefaultButton = bHelper.addButton(self, label=_("&Recover default")) # Translators: The label for a button to import math.rule. importButton = bHelper.addButton(self, label=_("&Import")) # Translators: The label for a button to export math.rule. exportButton = bHelper.addButton(self, label=_("Exp&ort")) self.editButton.Bind(wx.EVT_BUTTON, self.OnEditClick) self.exampleButton.Bind(wx.EVT_BUTTON, self.OnExampleClick) recoverDefaultButton.Bind(wx.EVT_BUTTON, self.OnRecoverDefaultClick) importButton.Bind(wx.EVT_BUTTON, self.OnImportClick) exportButton.Bind(wx.EVT_BUTTON, self.OnExportClick)
def __init__(self, parent): # Translators: The title of the articles dialog. super(ArticlesDialog, self).__init__(parent, title="{feedTitle} ({feedNumber})".format( feedTitle=parent.stringSel, feedNumber=parent.feed.getNumberOfArticles())) mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: The label of the articles list in the articles dialog. articlesText = _("List of articles") articlesChoices = [ re.sub(TAG_REGEXP, '', parent.feed.getArticleTitle(index)) for index in range(parent.feed.getNumberOfArticles()) ] if config.conf["readFeeds"]["showArticlesDate"]: for index, choice in enumerate(articlesChoices): date = parent.feed.getArticleDate(index).split(" +")[0] articlesChoices[index] = f"{choice} - {date}" self.articlesList = sHelper.addLabeledControl(articlesText, wx.ListBox, choices=articlesChoices) self.articlesList.Selection = 0 self.articlesList.Bind(wx.EVT_CHOICE, self.onArticlesListChoice) buttonHelper = guiHelper.ButtonHelper(wx.VERTICAL) # Translators: The label of a button to open the selected article of a feed. self.articleButton = wx.Button( self, label=_("Open &web page of selected article.")) self.articleButton.Bind(wx.EVT_BUTTON, self.onArticlesListChoice) self.AffirmativeId = self.articleButton.Id self.articleButton.SetDefault() buttonHelper.addButton(self.articleButton) # Translators: The label of a button to show information of a feed article. self.infoButton = wx.Button(self, label=_("&About article...")) self.infoButton.Bind(wx.EVT_BUTTON, self.onArticlesListInfo) buttonHelper.addButton(self.infoButton) closeButton = sHelper.addDialogDismissButtons( wx.Button(self, wx.ID_CLOSE, label=translate("&Close"))) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Close()) self.Bind(wx.EVT_CLOSE, self.onClose) self.EscapeId = wx.ID_CLOSE mainSizer.Add(buttonHelper.sizer) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.Sizer = mainSizer self.CentreOnScreen()
def __init__(self, parent, updateInfo, auto): # Translators: The title of the dialog informing the user about an NVDA update. super(UpdateResultDialog, self).__init__(parent, title=_("NVDA Update")) self.updateInfo = updateInfo mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) if updateInfo: self.isInstalled = config.isInstalledCopy() self.urls = updateInfo["launcherUrl"].split(" ") self.fileHash = updateInfo.get("launcherHash") # Translators: A message indicating that an updated version of NVDA is available. # {version} will be replaced with the version; e.g. 2011.3. message = _("NVDA version {version} is available.").format( **updateInfo) else: # Translators: A message indicating that no update to NVDA is available. message = _("No update available.") sHelper.addItem(wx.StaticText(self, label=message)) bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) if updateInfo: if self.isInstalled: # Translators: The label of a button to download and install an NVDA update. label = _("Download and &install update") else: # Translators: The label of a button to download an NVDA update. label = _("&Download update") downloadButton = bHelper.addButton(self, label=label) downloadButton.Bind(wx.EVT_BUTTON, self.onDownloadButton) if auto: # Translators: The label of a button to remind the user later about performing some action. remindMeButton = bHelper.addButton(self, label=_("Remind me &later")) remindMeButton.Bind(wx.EVT_BUTTON, self.onLaterButton) remindMeButton.SetFocus() # Translators: The label of a button to close a dialog. closeButton = bHelper.addButton(self, wx.ID_CLOSE, label=_("&Close")) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Close()) self.Bind(wx.EVT_CLOSE, lambda evt: self.Destroy()) self.EscapeId = wx.ID_CLOSE mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.Sizer = mainSizer mainSizer.Fit(self) self.Center(wx.BOTH | wx.CENTER_ON_SCREEN) self.Show()
def makeSettings(self, settingsSizer): sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer) # Translators: The label for the list box of dictionary entries in speech dictionary dialog. entriesLabelText = __("&Dictionary entries") self.dictList = sHelper.addLabeledControl(entriesLabelText, wx.ListCtrl, style=wx.LC_REPORT | wx.LC_SINGLE_SEL) # Translators: The label for a column in dictionary entries list used to identify comments for the entry. self.dictList.InsertColumn(0, __("Comment"), width=150) # Translators: The label for a column in dictionary entries list used to identify pattern (original word or a pattern). self.dictList.InsertColumn(1, __("Pattern"), width=150) # Translators: The label for a column in dictionary entries list and in a list of symbols from symbol pronunciation dialog used to identify replacement for a pattern or a symbol self.dictList.InsertColumn(2, __("Replacement"), width=150) # Translators: The label for a column in dictionary entries list used to identify whether the entry is case sensitive or not. self.dictList.InsertColumn(3, __("case"), width=50) # Translators: The label for a column in dictionary entries list used to identify whether the entry is a regular expression, matches whole words, or matches anywhere. self.dictList.InsertColumn(4, __("Type"), width=50) self.offOn = (__("off"), __("on")) for entry in self.tempSpeechDict: self.dictList.Append( (entry.comment, entry.pattern, entry.replacement, self.offOn[int(entry.caseSensitive)], EnhancedDictionaryDialog.TYPE_LABELS[entry.type])) self.editingIndex = -1 bHelper = guiHelper.ButtonHelper(orientation=wx.HORIZONTAL) bHelper.addButton( parent=self, # Translators: The label for a button in speech dictionaries dialog to add new entries. label=__("&Add")).Bind(wx.EVT_BUTTON, self.OnAddClick) bHelper.addButton( parent=self, # Translators: The label for a button in speech dictionaries dialog to edit existing entries. label=__("&Edit")).Bind(wx.EVT_BUTTON, self.OnEditClick) bHelper.addButton( parent=self, # Translators: The label for a button in speech dictionaries dialog to remove existing entries. label=__("&Remove")).Bind(wx.EVT_BUTTON, self.OnRemoveClick) # name of the default profile is always set to None on NVDA if (self._profile.name): bHelper.addButton( parent=self, # Translators: The label for the import entries from default profile dictionary label=_( "&import entries from default profile dictionary")).Bind( wx.EVT_BUTTON, self.onImportEntriesClick) sHelper.addItem(bHelper)
def makeSettings(self, settingsSizer): sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer) bHelper = guiHelper.ButtonHelper(orientation=wx.HORIZONTAL) resetButtonID = wx.NewId() # Translators: The label for a button in the Emoticons dictionary dialog. bHelper.addButton(self, resetButtonID, _("Rese&t"), wx.DefaultPosition) exportButtonID = wx.NewId() # Translators: The label for a button in the Emoticons dictionary dialog. bHelper.addButton(self, exportButtonID, _("Save and e&xport dictionary"), wx.DefaultPosition) sHelper.addItem(bHelper) super(EmDicDialog, self).makeSettings(settingsSizer) self.Bind(wx.EVT_BUTTON, self.OnResetClick, id=resetButtonID) self.Bind(wx.EVT_BUTTON, self.OnExportClick, id=exportButtonID)
def doGui(self): (lastDuration, lastAnnounce, lastDelayBeforeEndDuration ) = _addonConfigManager.getLastMinuteTimerDatas() mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # the minute timer value self.minuteTimerDurationEdit = sHelper.addLabeledControl( # Translators: This is a label for a setting # in MinuteTimer (an edit box to define the timer delay). _("Enter the minute timer &duration (in minutes):"), wx.TextCtrl) self.minuteTimerDurationEdit.Value = str(lastDuration) # Translators: This is a label for a setting in MinuteTimer # (an edit box to define the text to be spoken at then end of duration). announceLabel = _( "Enter the &announce to be spoken at the end of duration:") self.announceEdit = sHelper.addLabeledControl(announceLabel, wx.TextCtrl) self.announceEdit.Value = lastAnnounce self.delayBeforeEndDurationList = [str(x) for x in range(11)] self.delayBeforeEndDurationLB = sHelper.addLabeledControl( # Translators: This is a label for a setting in MinuteTimer dialog. _("Delay to be alerted before ending (in minutes):"), wx.Choice, choices=self.delayBeforeEndDurationList) self.delayBeforeEndDurationLB.SetSelection( self.delayBeforeEndDurationList.index( str(lastDelayBeforeEndDuration))) # buttons bHelper = guiHelper.ButtonHelper(orientation=wx.HORIZONTAL) # Translators: The label for a button # in Minute Timer Launch dialog to display ring options dialog. ringOptionsButton = bHelper.addButton(self, label=_("Ring's &Options")) sHelper.addItem(bHelper) bHelper = sHelper.addDialogDismissButtons( gui.guiHelper.ButtonHelper(wx.HORIZONTAL)) okButton = bHelper.addButton(self, wx.ID_OK) okButton.SetDefault() cancelButton = bHelper.addButton(self, wx.ID_CANCEL) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # events ringOptionsButton.Bind(wx.EVT_BUTTON, self.onRingOptionsButton) okButton.Bind(wx.EVT_BUTTON, self.onOk) cancelButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) self.SetEscapeId(wx.ID_CANCEL) self.minuteTimerDurationEdit.SetFocus()
def makeSettings(self, settingsSizer): sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer) bHelper = guiHelper.ButtonHelper(orientation=wx.HORIZONTAL) bHelper.addButton( parent=self, # Translators: The label for a button in the Emoticons dictionary dialog. label=_("Rese&t")).Bind(wx.EVT_BUTTON, self.OnResetClick) bHelper.addButton( parent=self, # Translators: The label for a button in the Emoticons dictionary dialog. label=_("Save and e&xport dictionary")).Bind( wx.EVT_BUTTON, self.OnExportClick) sHelper.addItem(bHelper) super(EmDicDialog, self).makeSettings(settingsSizer)
def doGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) self.messageTextCtrl = sHelper.addItem(wx.StaticText( self, label=self.staticTextLabel % self.timeToLive) ) bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) okButton = bHelper.addButton(self, wx.ID_OK, label=_("&Accept")) okButton .SetDefault() bHelper.addButton(self, wx.ID_CANCEL) mainSizer.Add(sHelper.sizer, border=10, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer)
def doGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # the list box # Translators: This is the label of the list appearing on List of Words dialog. showOccursDialog = _("Lines containing our word") self.windowsListBox =sHelper.addLabeledControl(showOccursDialog, wx.ListBox, id = wx.ID_ANY, choices = lns1, style = wx.LB_SINGLE, size = (700,580)) if self.windowsListBox.GetCount(): self.windowsListBox.SetSelection(0) # Buttons bHelper= guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: This is a label of a button appearing on List of Words dialog. okButton = bHelper.addButton(self, id = wx.ID_ANY, label=_("&Ok")) okButton.SetDefault() sHelper.addItem(bHelper) bHelper = sHelper.addDialogDismissButtons(guiHelper.ButtonHelper(wx.HORIZONTAL)) closeButton= bHelper.addButton(self, id = wx.ID_CLOSE, label = _("&Close")) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # Events okButton.Bind(wx.EVT_BUTTON,self.onOkButton) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) self.SetEscapeId(wx.ID_CLOSE)
def doGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # the last used symbols list # Translators: a label appearing on Last used complex symbols dialog. symbolsListLabelText = _("&Symbols:") self.symbolsListBox_ID = wx.NewIdRef() self.symbolsListBox = sHelper.addLabeledControl( symbolsListLabelText, wx.ListBox, id=self.symbolsListBox_ID, name="Symbols", choices=[desc for (desc, symbol) in self.lastUsedSymbols], style=wx.LB_SINGLE | wx.LB_ALWAYS_SB, size=(948, 130)) if self.symbolsListBox.GetCount(): self.symbolsListBox.SetSelection(0) # Buttons # Buttons are in a horizontal row bHelper = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: This is a label of a button appearing # on Last Used Complex Symbols Dialog. copyButton = bHelper.addButton(self, label=_("&Copy to clipboard")) # Translators: This is a label of a button appearing # on Last Used Complex Symbols Dialog. pasteButton = bHelper.addButton(self, label=_("&Past")) pasteButton.SetDefault() # Translators: This is a label of a button appearing # on last Used Symbols dialog. cleanButton = bHelper.addButton(self, label=_("&Delete all")) sHelper.addItem(bHelper) bHelper = sHelper.addDialogDismissButtons( gui.guiHelper.ButtonHelper(wx.HORIZONTAL)) closeButton = bHelper.addButton(self, id=wx.ID_CLOSE, label=NVDAString("&Close")) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # Events copyButton.Bind(wx.EVT_BUTTON, self.onCopyButton) pasteButton.Bind(wx.EVT_BUTTON, self.onPasteButton) cleanButton.Bind(wx.EVT_BUTTON, self.onCleanButton) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) self.SetEscapeId(wx.ID_CLOSE)
def doGui(self): self.initList() self.docList = sorted([doc for doc in self.docToScript]) choice = [] for doc in self.docList: script = self.docToScript[doc] identifier = self.scriptToIdentifier[script] source, main = inputCore.getDisplayTextForGestureIdentifier(identifier.lower()) choice.append("%s: %s" % (doc, main)) from gui import guiHelper mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: This is the label of the list # appearing on Shell Scripts List Dialog. labelText = _("scripts:") self.scriptsListBox = sHelper.addLabeledControl( labelText, wx.ListBox, id=wx.ID_ANY, choices=choice, style=wx.LB_SINGLE, size=(700, 280)) if self.scriptsListBox.GetCount(): self.scriptsListBox.SetSelection(0) # Buttons bHelper = sHelper.addDialogDismissButtons(guiHelper.ButtonHelper(wx.HORIZONTAL)) # Translators: This is a label of a button # appearing on Shell Scripts List Dialog. runScriptButton = bHelper.addButton( self, id=wx.ID_ANY, label=_("&Run script")) runScriptButton.SetDefault() closeButton = bHelper.addButton( self, id=wx.ID_CLOSE, label=NVDAString("&Close")) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # Events runScriptButton.Bind(wx.EVT_BUTTON, self.onRunScriptButton) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) self.SetEscapeId(wx.ID_CLOSE)
def __init__(self, parent, fileName): # Translators: The title of the Notes dialog. super(NotesDialog, self).__init__(parent, title=_("Notes")) self.fileName = fileName mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = gui.guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: The label of a list box in the Notes dialog. notesLabel = _("&Bookmarks") self.bookmarks = getSavedBookmarks() positions = sorted(self.bookmarks) self.pos = positions[0] firstNoteBody = self.bookmarks[self.pos].body notesChoices = [] for pos in positions: notesChoices.append("{position} - {title}".format( position=pos, title=self.bookmarks[pos].title)) self.notesListBox = sHelper.addLabeledControl(notesLabel, wx.ListBox, choices=notesChoices) self.notesListBox.Selection = 0 self.notesListBox.Bind(wx.EVT_LISTBOX, self.onNotesChange) # Translators: The label of an edit box in the Notes dialog. noteLabel = _("Not&e:") noteLabeledCtrl = gui.guiHelper.LabeledControlHelper( self, noteLabel, wx.TextCtrl, style=wx.TE_MULTILINE) self.noteEdit = noteLabeledCtrl.control self.noteEdit.SetMaxLength(1024) self.noteEdit.Value = firstNoteBody bHelper = sHelper.addItem( guiHelper.ButtonHelper(orientation=wx.HORIZONTAL)) # Translators: The label for a button in the Notes dialog. self.saveButton = bHelper.addButton(self, label=_("&Save note")) self.Bind(wx.EVT_BUTTON, self.onSave, self.saveButton) # Translators: The label for a button in the Notes dialog. self.deleteButton = bHelper.addButton(self, label=_("&Delete...")) self.deleteButton.Bind(wx.EVT_BUTTON, self.onDelete) sHelper.addDialogDismissButtons( self.CreateButtonSizer(wx.OK | wx.CANCEL)) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) mainSizer.Add(sHelper.sizer, border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.Sizer = mainSizer mainSizer.Fit(self) self.notesListBox.SetFocus() self.CentreOnScreen()
def makeSettings(self, settingsSizer): filterSizer = wx.BoxSizer(wx.HORIZONTAL) # Translators: The label of a text field to search for gestures in the Input Gestures dialog. from ..utils.NVDAStrings import NVDAString_pgettext labelText = NVDAString_pgettext("inputGestures", "&Filter by:") filterLabel = wx.StaticText(self, label=labelText) self.filterCtrl = filterCtrl = wx.TextCtrl(self) filterSizer.Add(filterLabel, flag=wx.ALIGN_CENTER_VERTICAL) filterSizer.AddSpacer(guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_HORIZONTAL) filterSizer.Add(filterCtrl, proportion=1) settingsSizer.Add(filterSizer, flag=wx.EXPAND) settingsSizer.AddSpacer(5) filterCtrl.Bind(wx.EVT_TEXT, self.onFilterChange, filterCtrl) self.gesturesVM = _InputGesturesViewModel() tree = self.tree = _GesturesTree(self, self.gesturesVM) tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.onTreeSelect) settingsSizer.Add(tree, proportion=1, flag=wx.EXPAND) settingsSizer.AddSpacer(guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_VERTICAL) bHelper = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: The label of a button to run the script in the Input Gestures dialog. self.executeScriptButton = bHelper.addButton(self, label=_("&Execute the script")) self.executeScriptButton.Bind(wx.EVT_BUTTON, self.onExecuteScriptButton) self.executeScriptButton.Disable() self.bindHelpEvent(getHelpObj("hdr205"), self.executeScriptButton) # Translators: The label of a button to add a gesture in the Input Gestures dialog. self.addButton = bHelper.addButton(self, label=NVDAString("&Add")) self.addButton.Bind(wx.EVT_BUTTON, self.onAdd) self.addButton.Disable() # Translators: The label of a button to remove a gesture in the Input Gestures dialog. self.removeButton = bHelper.addButton(self, label=NVDAString("&Remove")) self.removeButton.Bind(wx.EVT_BUTTON, self.onRemove) self.removeButton.Disable() bHelper.sizer.AddStretchSpacer() # Translators: The label of a button to reset all gestures in the Input Gestures dialog. resetButton = wx.Button(self, label=NVDAString("Reset to factory &defaults")) bHelper.sizer.Add(resetButton) resetButton.Bind(wx.EVT_BUTTON, self.onReset) settingsSizer.Add(bHelper.sizer, flag=wx.EXPAND) self.tree.Bind(wx.EVT_WINDOW_DESTROY, self._onDestroyTree) self.tree.Bind(wx.EVT_TREE_KEY_DOWN, self.onKeyDown)
def doGui(self): mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: This is the label for a listbox # on Addons activation dialog. labelText = _("Check to activate:") self.addonsListBox = sHelper.addLabeledControl( labelText, nvdaControls.CustomCheckListBox, choices=[]) # the buttons bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) checkAllButton = bHelper.addButton( self, # Translators: This is a label of a button appearing # on Addons activation dialog label=_("&Check all")) uncheckAllButton = bHelper.addButton( self, # Translators: This is a label of a button appearing # on Addons activation dialog. label=_("&Uncheck all")) saveAndRestartNVDAButton = bHelper.addButton( self, # Translators: This is a label of a button appearing # on Addons activation dialog. label=_("&Save and restart NVDA")) saveAndRestartNVDAButton.SetDefault() cancelButton = bHelper.addButton( self, id=wx.ID_CANCEL, ) mainSizer.Add(sHelper.sizer, border=10, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) # the events checkAllButton.Bind(wx.EVT_BUTTON, self.onCheckAll) uncheckAllButton.Bind(wx.EVT_BUTTON, self.onUncheckAll) saveAndRestartNVDAButton.Bind(wx.EVT_BUTTON, self.onSaveAndRestartNVDA) cancelButton.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy()) self.SetEscapeId(wx.ID_CANCEL) self.addonsListBox.SetFocus() self.refreshAddonsList()