def __init__(self, parent): # Translators: The title of the dialog to create a new configuration profile. super(NewProfileDialog, self).__init__(parent, title=_("New Profile")) mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) sizer = wx.BoxSizer(wx.HORIZONTAL) # Translators: The label of a field to enter the name of a new configuration profile. profileNameText = _("Profile name:") self.profileName = sHelper.addLabeledControl(profileNameText, wx.TextCtrl) # Translators: The label of a radio button to specify that a profile will be used for manual activation # in the new configuration profile dialog. self.triggers = triggers = [(None, _("Manual activation"), True)] triggers.extend(parent.getSimpleTriggers()) self.triggerChoice = sHelper.addItem( wx.RadioBox(self, label=_("Use this profile for:"), choices=[trig[1] for trig in triggers])) self.triggerChoice.Bind(wx.EVT_RADIOBOX, self.onTriggerChoice) self.autoProfileName = "" self.onTriggerChoice(None) sHelper.addItem(self.CreateButtonSizer(wx.OK | wx.CANCEL)) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.Sizer = mainSizer self.profileName.SetFocus() self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
def __init__(self, parent): super(LauncherDialog, self).__init__(parent, title=versionInfo.name) mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: The label of the license text which will be shown when NVDA installation program starts. groupLabel = _("License Agreement") sizer = sHelper.addItem( wx.StaticBoxSizer(wx.StaticBox(self, label=groupLabel), wx.VERTICAL)) licenseTextCtrl = wx.TextCtrl(self, size=(500, 400), style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH) licenseTextCtrl.Value = codecs.open(getDocFilePath( "copying.txt", False), "r", encoding="UTF-8").read() sizer.Add(licenseTextCtrl) # Translators: The label for a checkbox in NvDA installation program to agree to the license agreement. agreeText = _("I &agree") self.licenseAgreeCheckbox = sHelper.addItem( wx.CheckBox(self, label=agreeText)) self.licenseAgreeCheckbox.Value = False self.licenseAgreeCheckbox.Bind(wx.EVT_CHECKBOX, self.onLicenseAgree) sizer = sHelper.addItem(wx.GridSizer(rows=2, cols=2)) self.actionButtons = [] # Translators: The label of the button in NVDA installation program to install NvDA on the user's computer. ctrl = wx.Button(self, label=_("&Install NVDA on this computer")) sizer.Add(ctrl) ctrl.Bind(wx.EVT_BUTTON, lambda evt: self.onAction(evt, mainFrame.onInstallCommand)) self.actionButtons.append(ctrl) # Translators: The label of the button in NVDA installation program to create a portable version of NVDA. ctrl = wx.Button(self, label=_("Create &portable copy")) sizer.Add(ctrl) ctrl.Bind( wx.EVT_BUTTON, lambda evt: self.onAction( evt, mainFrame.onCreatePortableCopyCommand)) self.actionButtons.append(ctrl) # Translators: The label of the button in NVDA installation program to continue using the installation program as a temporary copy of NVDA. ctrl = wx.Button(self, label=_("&Continue running")) sizer.Add(ctrl) ctrl.Bind(wx.EVT_BUTTON, self.onContinueRunning) self.actionButtons.append(ctrl) sizer.Add(wx.Button(self, label=_("E&xit"), id=wx.ID_CANCEL)) # If we bind this on the button, it fails to trigger when the dialog is closed. self.Bind(wx.EVT_BUTTON, self.onExit, id=wx.ID_CANCEL) for ctrl in self.actionButtons: ctrl.Disable() 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)
def __init__(self, parent): inst = ExitDialog._instance() if ExitDialog._instance else None if inst: return # Use a weakref so the instance can die. ExitDialog._instance = weakref.ref(self) # Translators: The title of the dialog to exit NVDA super(ExitDialog, self).__init__(parent, title=_("Exit NVDA")) dialog = self mainSizer = wx.BoxSizer(wx.VERTICAL) contentSizerHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) if globalVars.appArgs.disableAddons: # Translators: A message in the exit Dialog shown when all add-ons are disabled. addonsDisabledText = _( "All add-ons are now disabled. They will be re-enabled on the next restart unless you choose to disable them again." ) contentSizerHelper.addItem( wx.StaticText(self, wx.ID_ANY, label=addonsDisabledText)) # Translators: The label for actions list in the Exit dialog. labelText = _("What would you like to &do?") self.actions = [ # Translators: An option in the combo box to choose exit action. _("Exit"), # Translators: An option in the combo box to choose exit action. _("Restart"), # Translators: An option in the combo box to choose exit action. _("Restart with add-ons disabled"), # Translators: An option in the combo box to choose exit action. _("Restart with debug logging enabled") ] if updateCheck and updateCheck.isPendingUpdate(): # Translators: An option in the combo box to choose exit action. self.actions.append(_("Install pending update")) self.actionsList = contentSizerHelper.addLabeledControl( labelText, wx.Choice, choices=self.actions) self.actionsList.SetSelection(0) contentSizerHelper.addItem(self.CreateButtonSizer(wx.OK | wx.CANCEL)) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL) mainSizer.Add(contentSizerHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.Sizer = mainSizer self.actionsList.SetFocus() self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
def __init__(self, parent): # Translators: The title of the Welcome dialog when user starts NVDA for the first time. super(WelcomeDialog, self).__init__(parent, wx.ID_ANY, _("Welcome to NVDA")) mainSizer=wx.BoxSizer(wx.VERTICAL) # Translators: The header for the Welcome dialog when user starts NVDA for the first time. This is in larger, # bold lettering welcomeTextHeader = wx.StaticText(self, label=_("Welcome to NVDA!")) welcomeTextHeader.SetFont(wx.Font(18, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD)) mainSizer.AddSpacer(guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS) mainSizer.Add(welcomeTextHeader,border=20,flag=wx.EXPAND|wx.LEFT|wx.RIGHT) mainSizer.AddSpacer(guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS) welcomeTextDetail = wx.StaticText(self, wx.ID_ANY, self.WELCOME_MESSAGE_DETAIL) mainSizer.Add(welcomeTextDetail,border=20,flag=wx.EXPAND|wx.LEFT|wx.RIGHT) optionsSizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Options")), wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, sizer=optionsSizer) # Translators: The label of a combobox in the Welcome dialog. kbdLabelText = _("&Keyboard layout:") layouts = keyboardHandler.KeyboardInputGesture.LAYOUTS self.kbdNames = sorted(layouts) kbdChoices = [layouts[layout] for layout in self.kbdNames] self.kbdList = sHelper.addLabeledControl(kbdLabelText, wx.Choice, choices=kbdChoices) try: index = self.kbdNames.index(config.conf["keyboard"]["keyboardLayout"]) self.kbdList.SetSelection(index) except: log.error("Could not set Keyboard layout list to current layout",exc_info=True) # Translators: The label of a checkbox in the Welcome dialog. capsAsNVDAModifierText = _("&Use CapsLock as an NVDA modifier key") self.capsAsNVDAModifierCheckBox = sHelper.addItem(wx.CheckBox(self, label=capsAsNVDAModifierText)) self.capsAsNVDAModifierCheckBox.SetValue(config.conf["keyboard"]["useCapsLockAsNVDAModifierKey"]) # Translators: The label of a checkbox in the Welcome dialog. startAfterLogonText = _("&Automatically start NVDA after I log on to Windows") self.startAfterLogonCheckBox = sHelper.addItem(wx.CheckBox(self, label=startAfterLogonText)) self.startAfterLogonCheckBox.Value = config.getStartAfterLogon() if globalVars.appArgs.secure or config.isAppX or not config.isInstalledCopy(): self.startAfterLogonCheckBox.Disable() # Translators: The label of a checkbox in the Welcome dialog. showWelcomeDialogAtStartupText = _("&Show this dialog when NVDA starts") self.showWelcomeDialogAtStartupCheckBox = sHelper.addItem(wx.CheckBox(self, label=showWelcomeDialogAtStartupText)) self.showWelcomeDialogAtStartupCheckBox.SetValue(config.conf["general"]["showWelcomeDialogAtStartup"]) mainSizer.Add(optionsSizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Add(self.CreateButtonSizer(wx.OK), border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL|wx.ALIGN_RIGHT) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) mainSizer.Fit(self) self.SetSizer(mainSizer) self.kbdList.SetFocus() self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
def makeSettings(self, settingsSizer): sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer) item = self.devMode = sHelper.addItem( # Translators: The label for a settings in the WebAccess settings panel wx.CheckBox(self, label=_("&Developer mode"))) item.SetValue(config.conf["webAccess"]["devMode"]) item = self.disableUserConfig = sHelper.addItem( # Translators: The label for a settings in the WebAccess settings panel wx.CheckBox( self, label= _("Disable all &user WebModules (activate only scratchpad and addons)" ))) item.SetValue(config.conf["webAccess"]["disableUserConfig"]) item = self.writeInAddons = sHelper.addItem( # Translators: The label for a settings in the WebAccess settings panel wx.CheckBox( self, label= _("Write into add-ons' \"webModules\" folder (not recommended)" ))) item.SetValue(config.conf["webAccess"]["writeInAddons"])
def __init__(self, parent): # Translators: The title of the configuration profile triggers dialog. super(TriggersDialog, self).__init__(parent, title=_("Profile Triggers")) mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) processed = set() triggers = self.triggers = [] confTrigs = config.conf.triggersToProfiles # Handle simple triggers. for spec, disp, manualEdit in parent.getSimpleTriggers(): try: profile = confTrigs[spec] except KeyError: profile = None triggers.append(TriggerInfo(spec, disp, profile)) processed.add(spec) # Handle all other triggers. for spec, profile in confTrigs.iteritems(): if spec in processed: continue if spec.startswith("app:"): # Translators: Displayed for a configuration profile trigger for an application. # %s is replaced by the application executable name. disp = _("%s application") % spec[4:] else: continue triggers.append(TriggerInfo(spec, disp, profile)) # Translators: The label of the triggers list in the Configuration Profile Triggers dialog. triggersText = _("Triggers") triggerChoices = [trig.display for trig in triggers] self.triggerList = sHelper.addLabeledControl(triggersText, wx.ListBox, choices=triggerChoices) self.triggerList.Bind(wx.EVT_LISTBOX, self.onTriggerListChoice) self.triggerList.Selection = 0 # Translators: The label of the profile list in the Configuration Profile Triggers dialog. profileText = _("Profile") profileChoices = [ parent.getProfileDisplay(name) for name in parent.profileNames ] self.profileList = sHelper.addLabeledControl(profileText, wx.Choice, choices=profileChoices) self.profileList.Bind(wx.EVT_CHOICE, self.onProfileListChoice) closeButton = sHelper.addDialogDismissButtons( wx.Button(self, wx.ID_CLOSE, label=_("&Close"))) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Close()) self.Bind(wx.EVT_CLOSE, self.onClose) self.AffirmativeId = wx.ID_CLOSE closeButton.SetDefault() self.EscapeId = wx.ID_CLOSE self.onTriggerListChoice(None) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.Sizer = mainSizer self.CentreOnScreen()
def __init__(self, parent): if ProfilesDialog._instance is not None: return ProfilesDialog._instance = self # Translators: The title of the Configuration Profiles dialog. super(ProfilesDialog, self).__init__(parent, title=_("Configuration Profiles")) self.currentAppName = (gui.mainFrame.prevFocus or api.getFocusObject()).appModule.appName self.profileNames = [None] self.profileNames.extend(config.conf.listProfiles()) mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) profilesListGroupSizer = wx.StaticBoxSizer(wx.StaticBox(self), wx.HORIZONTAL) profilesListGroupContents = wx.BoxSizer(wx.HORIZONTAL) #contains the profile list and activation button in vertical arrangement. changeProfilesSizer = wx.BoxSizer(wx.VERTICAL) item = self.profileList = wx.ListBox(self, choices=[ self.getProfileDisplay( name, includeStates=True) for name in self.profileNames ]) item.Bind(wx.EVT_LISTBOX, self.onProfileListChoice) item.Selection = self.profileNames.index(config.conf.profiles[-1].name) changeProfilesSizer.Add(item, proportion=1.0) changeProfilesSizer.AddSpacer(guiHelper.SPACE_BETWEEN_BUTTONS_VERTICAL) self.changeStateButton = wx.Button(self) self.changeStateButton.Bind(wx.EVT_BUTTON, self.onChangeState) self.AffirmativeId = self.changeStateButton.Id self.changeStateButton.SetDefault() changeProfilesSizer.Add(self.changeStateButton) profilesListGroupContents.Add(changeProfilesSizer, flag=wx.EXPAND) profilesListGroupContents.AddSpacer( guiHelper.SPACE_BETWEEN_ASSOCIATED_CONTROL_HORIZONTAL) buttonHelper = guiHelper.ButtonHelper(wx.VERTICAL) # Translators: The label of a button to create a new configuration profile. newButton = buttonHelper.addButton(self, label=_("&New")) newButton.Bind(wx.EVT_BUTTON, self.onNew) # Translators: The label of a button to rename a configuration profile. self.renameButton = buttonHelper.addButton(self, label=_("&Rename")) self.renameButton.Bind(wx.EVT_BUTTON, self.onRename) # Translators: The label of a button to delete a configuration profile. self.deleteButton = buttonHelper.addButton(self, label=_("&Delete")) self.deleteButton.Bind(wx.EVT_BUTTON, self.onDelete) profilesListGroupContents.Add(buttonHelper.sizer) profilesListGroupSizer.Add(profilesListGroupContents, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) sHelper.addItem(profilesListGroupSizer) # Translators: The label of a button to manage triggers # in the Configuration Profiles dialog. # See the Configuration Profiles section of the User Guide for details. triggersButton = wx.Button(self, label=_("&Triggers...")) triggersButton.Bind(wx.EVT_BUTTON, self.onTriggers) # Translators: The label of a checkbox in the Configuration Profiles dialog. self.disableTriggersToggle = wx.CheckBox( self, label=_("Temporarily d&isable all triggers")) self.disableTriggersToggle.Value = not config.conf.profileTriggersEnabled sHelper.addItem( guiHelper.associateElements(triggersButton, self.disableTriggersToggle)) # Translators: The label of a button to close a dialog. closeButton = wx.Button(self, wx.ID_CLOSE, label=_("&Close")) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Close()) sHelper.addDialogDismissButtons(closeButton) self.Bind(wx.EVT_CLOSE, self.onClose) self.EscapeId = wx.ID_CLOSE if globalVars.appArgs.secure: for item in newButton, triggersButton, self.renameButton, self.deleteButton: item.Disable() self.onProfileListChoice(None) mainSizer.Add(sHelper.sizer, flag=wx.ALL, border=guiHelper.BORDER_FOR_DIALOGS) mainSizer.Fit(self) self.Sizer = mainSizer self.profileList.SetFocus() self.CentreOnScreen()
def makeSettings(self, settingsSizer): sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer) # Translators: The label for the list of categories in a multi category settings dialog. categoriesLabelText = _("&Categories:") categoriesLabel = wx.StaticText(self, label=categoriesLabelText) # since the categories list and the container both expand in height, the y # portion is essentially a "min" height. # These sizes are set manually so that the initial proportions within the dialog look correct. If these sizes are # not given, then I believe the proportion arguments (as given to the gridBagSizer.AddGrowableColumn) are used # to set their relative sizes. We want the proportion argument to be used for resizing, but not the initial size. catListDim = (150, 10) catListDim = self.scaleSize(catListDim) initialScaledWidth = self.scaleSize(self.INITIAL_SIZE[0]) spaceForBorderWidth = self.scaleSize(20) catListWidth = catListDim[0] containerDim = (initialScaledWidth - catListWidth - spaceForBorderWidth, self.scaleSize(10)) self.catListCtrl = nvdaControls.AutoWidthColumnListCtrl( self, autoSizeColumnIndex=0, size=catListDim, style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_NO_HEADER) # This list consists of only one column. # The provided column header is just a placeholder, as it is hidden due to the wx.LC_NO_HEADER style flag. self.catListCtrl.InsertColumn(0, categoriesLabelText) # Put the settings panel in a scrolledPanel, we don't know how large the settings panels might grow. If they exceed # the maximum size, its important all items can be accessed visually. # Save the ID for the panel, this panel will have its name changed when the categories are changed. This name is # exposed via the IAccessibleName property. global NvdaSettingsCategoryPanelId NvdaSettingsCategoryPanelId = wx.NewId() self.container = scrolledpanel.ScrolledPanel( parent=self, id=NvdaSettingsCategoryPanelId, style=wx.TAB_TRAVERSAL | wx.BORDER_THEME, size=containerDim) # Th min size is reset so that they can be reduced to below their "size" constraint. self.container.SetMinSize((1, 1)) self.catListCtrl.SetMinSize((1, 1)) self.containerSizer = wx.BoxSizer(wx.VERTICAL) self.container.SetSizer(self.containerSizer) for cls in self.categoryClasses: if not issubclass(cls, SettingsPanel): raise RuntimeError( "Invalid category class %s provided in %s.categoryClasses" % (cls.__name__, self.__class__.__name__)) # It's important here that the listItems are added to catListCtrl in the same order that they exist in categoryClasses. # the ListItem index / Id is used to index categoryClasses, and used as the key in catIdToInstanceMap self.catListCtrl.Append((cls.title, )) # populate the GUI with the initial category initialCatIndex = 0 if not self.initialCategory else self.categoryClasses.index( self.initialCategory) self._doCategoryChange(initialCatIndex) self.catListCtrl.Select(initialCatIndex) # we must focus the initial category in the category list. self.catListCtrl.Focus(initialCatIndex) self.setPostInitFocus = self.container.SetFocus if self.initialCategory else self.catListCtrl.SetFocus self.gridBagSizer = gridBagSizer = wx.GridBagSizer( hgap=guiHelper.SPACE_BETWEEN_BUTTONS_HORIZONTAL, vgap=guiHelper.SPACE_BETWEEN_BUTTONS_VERTICAL) # add the label, the categories list, and the settings panel to a 2 by 2 grid. # The label should span two columns, so that the start of the categories list # and the start of the settings panel are at the same vertical position. gridBagSizer.Add(categoriesLabel, pos=(0, 0), span=(1, 2)) gridBagSizer.Add(self.catListCtrl, pos=(1, 0), flag=wx.EXPAND) gridBagSizer.Add(self.container, pos=(1, 1), flag=wx.EXPAND) # Make the row with the listCtrl and settings panel grow vertically. gridBagSizer.AddGrowableRow(1) # Make the columns with the listCtrl and settings panel grow horizontally if the dialog is resized. # They should grow 1:3, since the settings panel is much more important, and already wider # than the listCtrl. gridBagSizer.AddGrowableCol(0, proportion=1) gridBagSizer.AddGrowableCol(1, proportion=3) sHelper.sizer.Add(gridBagSizer, flag=wx.EXPAND, proportion=1) self.container.Layout() self.catListCtrl.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.onCategoryChange) self.Bind(wx.EVT_CHAR_HOOK, self.onCharHook) self.Bind(EVT_RW_LAYOUT_NEEDED, self._onPanelLayoutChanged)
def __init__(self, parent, NVDAVersion=CURRENT_NVDA_VERSION): if IncompatibleAddonsDialog._instance() is not None: raise RuntimeError( "Attempting to open multiple IncompatibleAddonsDialog instances" ) IncompatibleAddonsDialog._instance = weakref.ref(self) self.unknownCompatibilityAddonsList = list( addonHandler.getAddonsWithoutKnownCompatibility(NVDAVersion)) if not len(self.unknownCompatibilityAddonsList) > 0: raise RuntimeError("No unknown compat addons.") # Translators: The title of the Incompatible Addons Dialog wx.Dialog.__init__(self, parent, title=_("Incompatible Add-ons")) DpiScalingHelperMixin.__init__(self, self.GetHandle()) self.NVDAVersion = NVDAVersion mainSizer = wx.BoxSizer(wx.VERTICAL) settingsSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer) maxControlWidth = 550 # Translators: The title of the Incompatible Addons Dialog introText = _( "The compatibility of the following add-ons is not known, they have not been tested against NVDA version {}. " "Please use the checkboxes to indicate add-ons that should remain available.\n\n" "Warning: Untested add-ons may cause instability while using NVDA. " "Please contact the add-on author for further assistance.").format( "%s.%s.%s" % NVDAVersion) AddonSelectionIntroLabel = wx.StaticText(self, label=introText) AddonSelectionIntroLabel.Wrap(self.scaleSize(maxControlWidth)) sHelper.addItem(AddonSelectionIntroLabel) # Translators: the label for the addons list in the addon selection dialog. entriesLabel = _("Untested add-ons") self.addonsList = sHelper.addLabeledControl( entriesLabel, nvdaControls.AutoWidthColumnCheckListCtrl, style=wx.LC_REPORT | wx.LC_SINGLE_SEL, size=self.scaleSize((maxControlWidth, 350))) # Translators: The label for a column in add-ons list used to check / uncheck whether the add-on is manually set compatible self.addonsList.InsertColumn(0, _("Available"), width=self.scaleSize(70)) # Translators: The label for a column in add-ons list used to identify add-on package name (example: package is OCR). self.addonsList.InsertColumn(1, _("Package"), width=self.scaleSize(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(2, _("Version"), width=self.scaleSize(150)) # Translators: The label for a column in add-ons list used to identify the last version of NVDA # this add-on has been tested with. self.addonsList.InsertColumn(3, _("Last tested NVDA version"), width=self.scaleSize(180)) buttonSizer = guiHelper.ButtonHelper(wx.HORIZONTAL) continueID = wx.ID_OK # Translators: The continue button on a NVDA dialog. This button will accept any changes and dismiss the dialog. button = buttonSizer.addButton(self, label=_("Continue"), id=continueID) sHelper.addDialogDismissButtons(buttonSizer) mainSizer.Add(settingsSizer, border=20, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) self.SetAffirmativeId(continueID) self.SetEscapeId(continueID) button.Bind(wx.EVT_BUTTON, self.onContinue) self.refreshAddonsList() self.addonsList.SetFocus() self.CentreOnScreen()
def __init__(self, parent, title, message, userConfirmationMessage=None, errorDialog=False, showAddonInfoFunction=None): wx.Dialog.__init__(self, parent, title=title) DpiScalingHelperMixin.__init__(self, self.GetHandle()) iconID = wx.ART_WARNING if not errorDialog else wx.ART_ERROR icon = wx.ArtProvider.GetIcon(iconID, client=wx.ART_MESSAGE_BOX) self.SetIcon(icon) mainSizer = wx.BoxSizer(wx.VERTICAL) contentsSizer = guiHelper.BoxSizerHelper(parent=self, orientation=wx.VERTICAL) text = wx.StaticText(self, label=message) text.Wrap(self.scaleSize(self.GetSize().Width)) contentsSizer.addItem(text) if userConfirmationMessage: confirmedCheckbox = wx.CheckBox(parent=self, label=userConfirmationMessage) contentsSizer.addItem(confirmedCheckbox) confirmedCheckbox.Bind(wx.EVT_CHECKBOX, self._toggleEnabledStateOfAffirmativeAction) self.confirmedCheckbox = confirmedCheckbox buttonHelper = guiHelper.ButtonHelper(wx.HORIZONTAL) if showAddonInfoFunction: addonInfoButton = buttonHelper.addButton( self, # Translators: A button in the addon installation warning / blocked dialog which shows # more information about the addon label=_("&About add-on...")) addonInfoButton.Bind(wx.EVT_BUTTON, lambda evt: showAddonInfoFunction()) if errorDialog: okButton = buttonHelper.addButton( self, id=wx.ID_OK, # Translators: A button in the addon installation blocked dialog which will dismiss the dialog. label=_("OK")) okButton.SetDefault() okButton.Bind(wx.EVT_BUTTON, lambda evt: self.EndModal(wx.OK)) else: yesButton = buttonHelper.addButton( self, id=wx.ID_YES, # Translators: A button in the addon installation warning dialog which allows the user to agree to installing # the add-on label=_("Yes")) yesButton.SetDefault() yesButton.Bind(wx.EVT_BUTTON, lambda evt: self.EndModal(wx.YES)) if userConfirmationMessage: yesButton.Disable() self.yesButton = yesButton noButton = buttonHelper.addButton( self, id=wx.ID_NO, # Translators: A button in the addon installation warning dialog which allows the user to decide not to # install the add-on label=_("No")) noButton.Bind(wx.EVT_BUTTON, lambda evt: self.EndModal(wx.NO)) contentsSizer.addDialogDismissButtons(buttonHelper) mainSizer.Add(contentsSizer.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer)
def __init__(self, parent): if AddonsDialog._instance() is not None: return # #7077: _instance must not be kept alive once the dialog is closed or there can be issues # when add-ons manager reopens or another add-on is installed remotely. AddonsDialog._instance = weakref.ref(self) # Translators: The title of the Addons Dialog title = _("Add-ons Manager") wx.Dialog.__init__(self, parent, title=title) DpiScalingHelperMixin.__init__(self, self.GetHandle()) mainSizer = wx.BoxSizer(wx.VERTICAL) firstTextSizer = wx.BoxSizer(wx.VERTICAL) listAndButtonsSizerHelper = guiHelper.BoxSizerHelper( self, sizer=wx.BoxSizer(wx.HORIZONTAL)) if globalVars.appArgs.disableAddons: # Translators: A message in the add-ons manager shown when all add-ons are disabled. label = _( "All add-ons are currently disabled. To enable add-ons you must restart NVDA." ) firstTextSizer.Add(wx.StaticText(self, label=label)) # Translators: the label for the installed addons list in the addons manager. entriesLabel = _("Installed Add-ons") firstTextSizer.Add(wx.StaticText(self, label=entriesLabel)) mainSizer.Add(firstTextSizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.TOP | wx.LEFT | wx.RIGHT) self.addonsList = listAndButtonsSizerHelper.addItem( nvdaControls.AutoWidthColumnListCtrl( parent=self, style=wx.LC_REPORT | wx.LC_SINGLE_SEL, size=self.scaleSize((550, 350)))) # Translators: The label for a column in add-ons list used to identify add-on package name (example: package is OCR). self.addonsList.InsertColumn(0, _("Package"), width=self.scaleSize(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, _("Status"), width=self.scaleSize(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, _("Version"), width=self.scaleSize(50)) # Translators: The label for a column in add-ons list used to identify add-on's author (example: author is NV Access). self.addonsList.InsertColumn(3, _("Author"), width=self.scaleSize(300)) self.addonsList.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.onListItemSelected) # this is the group of buttons that affects the currently selected addon entryButtonsHelper = guiHelper.ButtonHelper(wx.VERTICAL) # Translators: The label for a button in Add-ons Manager dialog to show information about the selected add-on. self.aboutButton = entryButtonsHelper.addButton( self, label=_("&About add-on...")) self.aboutButton.Disable() self.aboutButton.Bind(wx.EVT_BUTTON, self.onAbout) # Translators: The label for a button in Add-ons Manager dialog to show the help for the selected add-on. self.helpButton = entryButtonsHelper.addButton(self, label=_("Add-on &help")) self.helpButton.Disable() self.helpButton.Bind(wx.EVT_BUTTON, self.onHelp) # Translators: The label for a button in Add-ons Manager dialog to enable or disable the selected add-on. self.enableDisableButton = entryButtonsHelper.addButton( self, label=_("&Disable add-on")) self.enableDisableButton.Disable() self.enableDisableButton.Bind(wx.EVT_BUTTON, self.onEnableDisable) # Translators: The label for a button to remove either: # Remove the selected add-on in Add-ons Manager dialog. # Remove a speech dictionary entry. self.removeButton = entryButtonsHelper.addButton(self, label=_("&Remove")) self.removeButton.Disable() self.removeButton.Bind(wx.EVT_BUTTON, self.onRemoveClick) listAndButtonsSizerHelper.addItem(entryButtonsHelper.sizer) mainSizer.Add(listAndButtonsSizerHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) # the following buttons are more general and apply regardless of the current selection. generalActions = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: The label of a button in Add-ons Manager to open the Add-ons website and get more add-ons. self.getAddonsButton = generalActions.addButton( self, label=_("&Get add-ons...")) self.getAddonsButton.Bind(wx.EVT_BUTTON, self.onGetAddonsClick) # Translators: The label for a button in Add-ons Manager dialog to install an add-on. self.addButton = generalActions.addButton(self, label=_("&Install...")) self.addButton.Bind(wx.EVT_BUTTON, self.onAddClick) # Translators: The label of a button in the Add-ons Manager to open the list of incompatible add-ons. self.incompatAddonsButton = generalActions.addButton( self, label=_("&Manage incompatible add-ons...")) self.incompatAddonsButton.Bind(wx.EVT_BUTTON, self.onIncompatAddonsShowClick) mainSizer.Add(generalActions.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.LEFT | wx.RIGHT) mainSizer.Add(wx.StaticLine(self), border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.TOP | wx.BOTTOM | wx.EXPAND) # Translators: The label of a button to close the Addons dialog. closeButton = wx.Button(self, label=_("&Close"), id=wx.ID_CLOSE) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Close()) mainSizer.Add(closeButton, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.CENTER | wx.ALIGN_RIGHT) self.Bind(wx.EVT_CLOSE, self.onClose) self.EscapeId = wx.ID_CLOSE mainSizer.Fit(self) self.SetSizer(mainSizer) self.refreshAddonsList() self.addonsList.SetFocus() self.CentreOnScreen()