def onOk(self, evt): action=self.actionsList.GetSelection() # Because Windows Store version of NVDA does not support add-ons yet, add 1 if action is 2 or above if this is such a case. if action >= 2 and config.isAppX: action += 1 if action == 0: safeAppExit() elif action == 1: queueHandler.queueFunction(queueHandler.eventQueue,core.restart) elif action == 2: queueHandler.queueFunction(queueHandler.eventQueue,core.restart,disableAddons=True) elif action == 3: queueHandler.queueFunction(queueHandler.eventQueue,core.restart,debugLogging=True) elif action == 4: if updateCheck: destPath, version, apiVersion, backCompatTo = updateCheck.getPendingUpdate() from addonHandler import getIncompatibleAddons if any(getIncompatibleAddons(currentAPIVersion=apiVersion, backCompatToAPIVersion=backCompatTo)): confirmUpdateDialog = updateCheck.UpdateAskInstallDialog( parent=gui.mainFrame, destPath=destPath, version=version, apiVersion=apiVersion, backCompatTo=backCompatTo ) confirmUpdateDialog.ShowModal() else: updateCheck.executePendingUpdate() self.Destroy()
def onOk(self, evt): action=self.actionsList.GetSelection() # Because Windows Store version of NVDA does not support add-ons yet, add 1 if action is 2 or above if this is such a case. if action >= 2 and config.isAppX: action += 1 if action == 0: wx.GetApp().ExitMainLoop() elif action == 1: queueHandler.queueFunction(queueHandler.eventQueue,core.restart) elif action == 2: queueHandler.queueFunction(queueHandler.eventQueue,core.restart,disableAddons=True) elif action == 3: queueHandler.queueFunction(queueHandler.eventQueue,core.restart,debugLogging=True) elif action == 4: if updateCheck: destPath, version, apiVersion, backCompatTo = updateCheck.getPendingUpdate() from addonHandler import getIncompatibleAddons if any(getIncompatibleAddons(currentAPIVersion=apiVersion, backCompatToAPIVersion=backCompatTo)): confirmUpdateDialog = updateCheck.UpdateAskInstallDialog( parent=gui.mainFrame, destPath=destPath, version=version, apiVersion=apiVersion, backCompatTo=backCompatTo ) confirmUpdateDialog.ShowModal() else: updateCheck.executePendingUpdate() self.Destroy()
def onOk(self, evt): action=self.actionsList.GetSelection() # Because Windows Store version of NVDA does not support add-ons yet, add 1 if action is 2 or above if this is such a case. if action >= 2 and config.isAppX: action += 1 if action == 0: if not core.triggerNVDAExit(): log.error("NVDA already in process of exiting, this indicates a logic error.") return # there's no need to destroy ExitDialog in this instance as triggerNVDAExit will do this elif action == 1: queueHandler.queueFunction(queueHandler.eventQueue,core.restart) elif action == 2: queueHandler.queueFunction(queueHandler.eventQueue,core.restart,disableAddons=True) elif action == 3: queueHandler.queueFunction(queueHandler.eventQueue,core.restart,debugLogging=True) elif action == 4: if updateCheck: destPath, version, apiVersion, backCompatTo = updateCheck.getPendingUpdate() from addonHandler import getIncompatibleAddons if any(getIncompatibleAddons(currentAPIVersion=apiVersion, backCompatToAPIVersion=backCompatTo)): confirmUpdateDialog = updateCheck.UpdateAskInstallDialog( parent=gui.mainFrame, destPath=destPath, version=version, apiVersion=apiVersion, backCompatTo=backCompatTo ) confirmUpdateDialog.ShowModal() else: updateCheck.executePendingUpdate() wx.CallAfter(self.Destroy)
def onExecuteUpdateCommand(self, evt): if updateCheck and updateCheck.isPendingUpdate(): destPath, version, apiVersion, backCompatToAPIVersion = updateCheck.getPendingUpdate() from addonHandler import getIncompatibleAddons if any(getIncompatibleAddons(apiVersion, backCompatToAPIVersion)): confirmUpdateDialog = updateCheck.UpdateAskInstallDialog( parent=gui.mainFrame, destPath=destPath, version=version, apiVersion=apiVersion, backCompatTo=backCompatToAPIVersion ) gui.runScriptModalDialog(confirmUpdateDialog) else: updateCheck.executePendingUpdate()
def onOk(self, evt): action = [ a for a in _ExitAction if a.displayString == self.actionsList.GetStringSelection() ][0] if action == _ExitAction.EXIT: WelcomeDialog.closeInstances() if core.triggerNVDAExit(): # there's no need to destroy ExitDialog in this instance as triggerNVDAExit will do this return else: log.error( "NVDA already in process of exiting, this indicates a logic error." ) return elif action == _ExitAction.RESTART: queueHandler.queueFunction(queueHandler.eventQueue, core.restart) elif action == _ExitAction.RESTART_WITH_ADDONS_DISABLED: queueHandler.queueFunction(queueHandler.eventQueue, core.restart, disableAddons=True) elif action == _ExitAction.RESTART_WITH_DEBUG_LOGGING_ENABLED: queueHandler.queueFunction(queueHandler.eventQueue, core.restart, debugLogging=True) elif action == _ExitAction.INSTALL_PENDING_UPDATE: if updateCheck: destPath, version, apiVersion, backCompatTo = updateCheck.getPendingUpdate( ) from addonHandler import getIncompatibleAddons from gui import mainFrame if any( getIncompatibleAddons( currentAPIVersion=apiVersion, backCompatToAPIVersion=backCompatTo)): confirmUpdateDialog = updateCheck.UpdateAskInstallDialog( parent=mainFrame, destPath=destPath, version=version, apiVersion=apiVersion, backCompatTo=backCompatTo) confirmUpdateDialog.ShowModal() else: updateCheck.executePendingUpdate() wx.CallAfter(self.Destroy)
def __init__(self, parent, APIVersion=addonAPIVersion.CURRENT, APIBackwardsCompatToVersion=addonAPIVersion.BACK_COMPAT_TO): if IncompatibleAddonsDialog._instance() is not None: raise RuntimeError( "Attempting to open multiple IncompatibleAddonsDialog instances" ) IncompatibleAddonsDialog._instance = weakref.ref(self) self._APIVersion = APIVersion self._APIBackwardsCompatToVersion = APIBackwardsCompatToVersion self.unknownCompatibilityAddonsList = list( addonHandler.getIncompatibleAddons( currentAPIVersion=APIVersion, backCompatToAPIVersion=APIBackwardsCompatToVersion)) if not len(self.unknownCompatibilityAddonsList) > 0: # this dialog is not designed to show an empty list. raise RuntimeError("No incompatible addons.") # Translators: The title of the Incompatible Addons Dialog wx.Dialog.__init__(self, parent, title=_("Incompatible Add-ons")) DpiScalingHelperMixin.__init__(self, self.GetHandle()) 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 following add-ons are incompatible with NVDA version {}." " These add-ons can not be enabled." " Please contact the add-on author for further assistance." ).format(addonAPIVersion.formatForGUI(self._APIVersion)) AddonSelectionIntroLabel = wx.StaticText(self, label=introText) AddonSelectionIntroLabel.Wrap(self.scaleSize(maxControlWidth)) sHelper.addItem(AddonSelectionIntroLabel) # Translators: the label for the addons list in the incompatible addons dialog. entriesLabel = _("Incompatible add-ons") self.addonsList = sHelper.addLabeledControl( entriesLabel, nvdaControls.AutoWidthColumnListCtrl, 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 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 provide some explanation about incompatibility self.addonsList.InsertColumn(3, _("Incompatible reason"), width=self.scaleSize(180)) buttonSizer = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: The label for a button in Add-ons Manager dialog to show information about the selected add-on. self.aboutButton = buttonSizer.addButton(self, label=_("&About add-on...")) self.aboutButton.Disable() self.aboutButton.Bind(wx.EVT_BUTTON, self.onAbout) # Translators: The close button on an NVDA dialog. This button will dismiss the dialog. button = buttonSizer.addButton(self, label=_("&Close"), id=wx.ID_CLOSE) self.Bind(wx.EVT_CLOSE, self.onClose) sHelper.addDialogDismissButtons(buttonSizer) mainSizer.Add(settingsSizer, border=20, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) self.SetAffirmativeId(wx.ID_CLOSE) self.SetEscapeId(wx.ID_CLOSE) button.Bind(wx.EVT_BUTTON, self.onClose) self.refreshAddonsList() self.addonsList.SetFocus() self.CentreOnScreen()
def __init__(self, parent, isUpdate): self.isUpdate=isUpdate self.textWrapWidth = 600 # Translators: The title of the Install NVDA dialog. wx.Dialog.__init__(self, parent, title=_("Install NVDA")) DpiScalingHelperMixin.__init__(self, self.GetHandle()) import addonHandler shouldAskAboutAddons = any(addonHandler.getIncompatibleAddons( # the defaults from the installer are ok. We are testing against the running version. )) mainSizer = self.mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = gui.guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: An informational message in the Install NVDA dialog. msg=_("To install NVDA to your hard drive, please press the Continue button.") if self.isUpdate: # Translators: An informational message in the Install NVDA dialog. msg+=" "+_("A previous copy of NVDA has been found on your system. This copy will be updated.") if not os.path.isdir(installer.defaultInstallPath): # Translators: a message in the installer telling the user NVDA is now located in a different place. msg+=" "+_("The installation path for NVDA has changed. it will now be installed in {path}").format(path=installer.defaultInstallPath) if shouldAskAboutAddons: # Translators: A message in the installer to let the user know that some addons are not compatible. msg+=_( "\n\n" "However, your NVDA configuration contains add-ons that are incompatible with this version of NVDA. " "These add-ons will be disabled after installation. If you rely on these add-ons, " "please review the list to decide whether to continue with the installation" ) text = sHelper.addItem(wx.StaticText(self, label=msg)) text.Wrap(self.scaleSize(self.textWrapWidth)) if shouldAskAboutAddons: self.confirmationCheckbox = sHelper.addItem(wx.CheckBox( self, # Translators: A message to confirm that the user understands that addons that have not been reviewed and made # available, will be disabled after installation. label=_("I understand that these incompatible add-ons will be disabled") )) self.confirmationCheckbox.SetFocus() optionsSizer = guiHelper.BoxSizerHelper(self, sizer=sHelper.addItem(wx.StaticBoxSizer( wx.StaticBox( self, # Translators: The label for a group box containing the NVDA installation dialog options. label=_("Options") ), wx.VERTICAL ))) # Translators: The label of a checkbox option in the Install NVDA dialog. startOnLogonText = _("Use NVDA on the Windows &logon screen") self.startOnLogonCheckbox = optionsSizer.addItem(wx.CheckBox(self, label=startOnLogonText)) if globalVars.appArgs.enableStartOnLogon is not None: self.startOnLogonCheckbox.Value = globalVars.appArgs.enableStartOnLogon else: self.startOnLogonCheckbox.Value = config.getStartOnLogonScreen() if self.isUpdate else True shortcutIsPrevInstalled=installer.isDesktopShortcutInstalled() if self.isUpdate and shortcutIsPrevInstalled: # Translators: The label of a checkbox option in the Install NVDA dialog. keepShortCutText = _("&Keep existing desktop shortcut") self.createDesktopShortcutCheckbox = optionsSizer.addItem(wx.CheckBox(self, label=keepShortCutText)) else: # Translators: The label of the option to create a desktop shortcut in the Install NVDA dialog. # If the shortcut key has been changed for this locale, # this change must also be reflected here. createShortcutText = _("Create &desktop icon and shortcut key (control+alt+n)") self.createDesktopShortcutCheckbox = optionsSizer.addItem(wx.CheckBox(self, label=createShortcutText)) self.createDesktopShortcutCheckbox.Value = shortcutIsPrevInstalled if self.isUpdate else True # Translators: The label of a checkbox option in the Install NVDA dialog. createPortableText = _("Copy &portable configuration to current user account") self.copyPortableConfigCheckbox = optionsSizer.addItem(wx.CheckBox(self, label=createPortableText)) self.copyPortableConfigCheckbox.Value = False if globalVars.appArgs.launcher: self.copyPortableConfigCheckbox.Disable() bHelper = sHelper.addDialogDismissButtons(guiHelper.ButtonHelper(wx.HORIZONTAL)) if shouldAskAboutAddons: # Translators: The label of a button to launch the add-on compatibility review dialog. reviewAddonButton = bHelper.addButton(self, label=_("&Review add-ons...")) reviewAddonButton.Bind(wx.EVT_BUTTON, self.onReviewAddons) # Translators: The label of a button to continue with the operation. continueButton = bHelper.addButton(self, label=_("&Continue"), id=wx.ID_OK) continueButton.SetDefault() continueButton.Bind(wx.EVT_BUTTON, self.onInstall) if shouldAskAboutAddons: self.confirmationCheckbox.Bind( wx.EVT_CHECKBOX, lambda evt: continueButton.Enable(not continueButton.Enabled) ) continueButton.Enable(False) bHelper.addButton(self, id=wx.ID_CANCEL) # If we bind this using button.Bind, it fails to trigger when the dialog is closed. self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL) mainSizer.Add(sHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) self.Sizer = mainSizer mainSizer.Fit(self) self.CentreOnScreen()
def __init__(self, parent, destPath, version, apiVersion, backCompatTo): self.destPath = destPath self.version = version self.apiVersion = apiVersion self.backCompatTo = backCompatTo self.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().__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. message = _("NVDA version {version} is ready to be installed.\n" ).format(version=version) showAddonCompat = any( getIncompatibleAddons(currentAPIVersion=self.apiVersion, backCompatToAPIVersion=self.backCompatTo)) if showAddonCompat: message = message + _( # Translators: A message indicating that some add-ons will be disabled # unless reviewed before installation. "\n" "However, your NVDA configuration contains add-ons that are incompatible with this version of NVDA. " "These add-ons will be disabled after installation. If you rely on these add-ons, " "please review the list to decide whether to continue with the installation" ) text = sHelper.addItem(wx.StaticText(self, label=message)) text.Wrap(self.scaleSize(500)) if showAddonCompat: self.confirmationCheckbox = sHelper.addItem( wx.CheckBox( self, # Translators: A message to confirm that the user understands that addons that have not been reviewed and made # available, will be disabled after installation. label= _("I understand that these incompatible add-ons will be disabled" ))) bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) if showAddonCompat: # Translators: The label of a button to review add-ons prior to NVDA update. reviewAddonsButton = bHelper.addButton( self, label=_("&Review add-ons...")) reviewAddonsButton.Bind(wx.EVT_BUTTON, self.onReviewAddonsButton) # 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) if not showAddonCompat: installButton.SetFocus() else: self.confirmationCheckbox.SetFocus() self.confirmationCheckbox.Bind( wx.EVT_CHECKBOX, lambda evt: installButton.Enable(not installButton.Enabled)) installButton.Enable(False) if self.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, updateInfo, auto): # Translators: The title of the dialog informing the user about an NVDA update. super().__init__(parent, title=_("NVDA Update")) self.updateInfo = updateInfo mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) pendingUpdateDetails = getPendingUpdate() canOfferPendingUpdate = isPendingUpdate( ) and pendingUpdateDetails[1] == updateInfo["version"] text = sHelper.addItem(wx.StaticText(self)) bHelper = guiHelper.ButtonHelper(wx.HORIZONTAL) if not updateInfo: # Translators: A message indicating that no update to NVDA is available. message = _("No update available.") elif canOfferPendingUpdate: # 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) self.apiVersion = pendingUpdateDetails[2] self.backCompatTo = pendingUpdateDetails[3] showAddonCompat = any( getIncompatibleAddons( currentAPIVersion=self.apiVersion, backCompatToAPIVersion=self.backCompatTo)) if showAddonCompat: message = message + _( # Translators: A message indicating that some add-ons will be disabled # unless reviewed before installation. "\n\n" "However, your NVDA configuration contains add-ons that are incompatible with this version of NVDA. " "These add-ons will be disabled after installation. If you rely on these add-ons, " "please review the list to decide whether to continue with the installation" ) confirmationCheckbox = sHelper.addItem( wx.CheckBox( self, # Translators: A message to confirm that the user understands that addons that have not been # reviewed and made available, will be disabled after installation. label= _("I understand that these incompatible add-ons will be disabled" ))) confirmationCheckbox.Bind( wx.EVT_CHECKBOX, lambda evt: self.installPendingButton. Enable(not self.installPendingButton.Enabled)) confirmationCheckbox.SetFocus() # Translators: The label of a button to review add-ons prior to NVDA update. reviewAddonsButton = bHelper.addButton( self, label=_("&Review add-ons...")) reviewAddonsButton.Bind(wx.EVT_BUTTON, self.onReviewAddonsButton) self.installPendingButton = bHelper.addButton( self, # Translators: The label of a button to install a pending NVDA update. # {version} will be replaced with the version; e.g. 2011.3. label=_("&Install NVDA {version}").format(**updateInfo)) self.installPendingButton.Bind( wx.EVT_BUTTON, lambda evt: self.onInstallButton(pendingUpdateDetails[0])) self.installPendingButton.Enable(not showAddonCompat) bHelper.addButton( self, # Translators: The label of a button to re-download a pending NVDA update. label=_("Re-&download update")).Bind(wx.EVT_BUTTON, self.onDownloadButton) 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) bHelper.addButton( self, # Translators: The label of a button to download an NVDA update. label=_("&Download update")).Bind(wx.EVT_BUTTON, self.onDownloadButton) if auto: # this prompt was triggered by auto update checker # the user might not want to wait for a download right now, so give the option to be reminded later. # 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() text.SetLabel(message) text.Wrap(self.scaleSize(500)) sHelper.addDialogDismissButtons(bHelper) # 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, APIVersion = addonAPIVersion.CURRENT, APIBackwardsCompatToVersion = addonAPIVersion.BACK_COMPAT_TO ): if IncompatibleAddonsDialog._instance() is not None: raise RuntimeError("Attempting to open multiple IncompatibleAddonsDialog instances") IncompatibleAddonsDialog._instance = weakref.ref(self) self._APIVersion = APIVersion self._APIBackwardsCompatToVersion = APIBackwardsCompatToVersion self.unknownCompatibilityAddonsList = list(addonHandler.getIncompatibleAddons( currentAPIVersion=APIVersion, backCompatToAPIVersion=APIBackwardsCompatToVersion )) if not len(self.unknownCompatibilityAddonsList) > 0: # this dialog is not designed to show an empty list. raise RuntimeError("No incompatible addons.") super().__init__( parent, # Translators: The title of the Incompatible Addons Dialog title=_("Incompatible Add-ons"), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX, ) mainSizer=wx.BoxSizer(wx.VERTICAL) settingsSizer=wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer) maxControlWidth = 550 introText = _( # Translators: The title of the Incompatible Addons Dialog "The following add-ons are incompatible with NVDA version {}." " These add-ons can not be enabled." " Please contact the add-on author for further assistance." ).format(addonAPIVersion.formatForGUI(self._APIVersion)) AddonSelectionIntroLabel=wx.StaticText(self, label=introText) AddonSelectionIntroLabel.Wrap(self.scaleSize(maxControlWidth)) sHelper.addItem(AddonSelectionIntroLabel) # Translators: the label for the addons list in the incompatible addons dialog. entriesLabel=_("Incompatible add-ons") self.addonsList = sHelper.addLabeledControl( entriesLabel, nvdaControls.AutoWidthColumnListCtrl, style=wx.LC_REPORT|wx.LC_SINGLE_SEL, ) # 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 provide some explanation about incompatibility self.addonsList.InsertColumn(3, _("Incompatible reason"), width=self.scaleSize(180)) buttonSizer = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: The label for a button in Add-ons Manager dialog to show information about the selected add-on. self.aboutButton = buttonSizer.addButton(self, label=_("&About add-on...")) self.aboutButton.Disable() self.aboutButton.Bind(wx.EVT_BUTTON, self.onAbout) # Translators: The close button on an NVDA dialog. This button will dismiss the dialog. button = buttonSizer.addButton(self, label=_("&Close"), id=wx.ID_CLOSE) self.Bind(wx.EVT_CLOSE, self.onClose) sHelper.addDialogDismissButtons(buttonSizer, separated=True) mainSizer.Add( settingsSizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL | wx.EXPAND, proportion=1 ) mainSizer.Fit(self) self.SetSizer(mainSizer) self.SetAffirmativeId(wx.ID_CLOSE) self.SetEscapeId(wx.ID_CLOSE) button.Bind(wx.EVT_BUTTON, self.onClose) self.refreshAddonsList() self.SetMinSize(mainSizer.GetMinSize()) # Historical initial size, result of L{self.addonsList} being (550, 350) as of PR #8006. # Setting an initial size on L{self.addonsList} by passing a L{size} argument when # creating the control would also set its minimum size and thus block the dialog from being shrunk. self.SetSize(self.scaleSize((606, 525))) self.CentreOnScreen() self.addonsList.SetFocus()
def __init__( self, parent, APIVersion = addonAPIVersion.CURRENT, APIBackwardsCompatToVersion = addonAPIVersion.BACK_COMPAT_TO ): if IncompatibleAddonsDialog._instance() is not None: raise RuntimeError("Attempting to open multiple IncompatibleAddonsDialog instances") IncompatibleAddonsDialog._instance = weakref.ref(self) self._APIVersion = APIVersion self._APIBackwardsCompatToVersion = APIBackwardsCompatToVersion self.unknownCompatibilityAddonsList = list(addonHandler.getIncompatibleAddons( currentAPIVersion=APIVersion, backCompatToAPIVersion=APIBackwardsCompatToVersion )) if not len(self.unknownCompatibilityAddonsList) > 0: # this dialog is not designed to show an empty list. raise RuntimeError("No incompatible addons.") # Translators: The title of the Incompatible Addons Dialog wx.Dialog.__init__(self, parent, title=_("Incompatible Add-ons")) DpiScalingHelperMixin.__init__(self, self.GetHandle()) 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 following add-ons are incompatible with NVDA version {}." " These add-ons can not be enabled." " Please contact the add-on author for further assistance." ).format(addonAPIVersion.formatForGUI(self._APIVersion)) AddonSelectionIntroLabel=wx.StaticText(self, label=introText) AddonSelectionIntroLabel.Wrap(self.scaleSize(maxControlWidth)) sHelper.addItem(AddonSelectionIntroLabel) # Translators: the label for the addons list in the incompatible addons dialog. entriesLabel=_("Incompatible add-ons") self.addonsList = sHelper.addLabeledControl( entriesLabel, nvdaControls.AutoWidthColumnListCtrl, 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 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 provide some explanation about incompatibility self.addonsList.InsertColumn(3, _("Incompatible reason"), width=self.scaleSize(180)) buttonSizer = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: The label for a button in Add-ons Manager dialog to show information about the selected add-on. self.aboutButton = buttonSizer.addButton(self, label=_("&About add-on...")) self.aboutButton.Disable() self.aboutButton.Bind(wx.EVT_BUTTON, self.onAbout) # Translators: The close button on an NVDA dialog. This button will dismiss the dialog. button = buttonSizer.addButton(self, label=_("&Close"), id=wx.ID_CLOSE) self.Bind(wx.EVT_CLOSE, self.onClose) sHelper.addDialogDismissButtons(buttonSizer) mainSizer.Add(settingsSizer, border=20, flag=wx.ALL) mainSizer.Fit(self) self.SetSizer(mainSizer) self.SetAffirmativeId(wx.ID_CLOSE) self.SetEscapeId(wx.ID_CLOSE) button.Bind(wx.EVT_BUTTON, self.onClose) self.refreshAddonsList() self.addonsList.SetFocus() self.CentreOnScreen()
def __init__(self, parent, destPath, version, apiVersion, backCompatTo): self.destPath = destPath self.version = version self.apiVersion = apiVersion self.backCompatTo = backCompatTo self.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. wx.Dialog.__init__(self, parent, title=_("NVDA Update")) DpiScalingHelperMixin.__init__(self, self.GetHandle()) 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. message = _("NVDA version {version} is ready to be installed.\n").format(version=version) showAddonCompat = any(getIncompatibleAddons( currentAPIVersion=self.apiVersion, backCompatToAPIVersion=self.backCompatTo )) if showAddonCompat: # Translators: A message indicating that some add-ons will be disabled unless reviewed before installation. message = message + _( "\n" "However, your NVDA configuration contains add-ons that are incompatible with this version of NVDA. " "These add-ons will be disabled after installation. If you rely on these add-ons, " "please review the list to decide whether to continue with the installation" ) text = sHelper.addItem(wx.StaticText(self, label=message)) text.Wrap(self.scaleSize(500)) if showAddonCompat: self.confirmationCheckbox = sHelper.addItem(wx.CheckBox( self, # Translators: A message to confirm that the user understands that addons that have not been reviewed and made # available, will be disabled after installation. label=_("I understand that these incompatible add-ons will be disabled") )) bHelper = sHelper.addDialogDismissButtons(guiHelper.ButtonHelper(wx.HORIZONTAL)) if showAddonCompat: # Translators: The label of a button to review add-ons prior to NVDA update. reviewAddonsButton = bHelper.addButton(self, label=_("&Review add-ons...")) reviewAddonsButton.Bind(wx.EVT_BUTTON, self.onReviewAddonsButton) # 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) if not showAddonCompat: installButton.SetFocus() else: self.confirmationCheckbox.SetFocus() self.confirmationCheckbox.Bind( wx.EVT_CHECKBOX, lambda evt: installButton.Enable(not installButton.Enabled) ) installButton.Enable(False) if self.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, updateInfo, auto): # Translators: The title of the dialog informing the user about an NVDA update. wx.Dialog.__init__(self, parent, title=_("NVDA Update")) DpiScalingHelperMixin.__init__(self, self.GetHandle()) self.updateInfo = updateInfo mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) pendingUpdateDetails = getPendingUpdate() canOfferPendingUpdate = isPendingUpdate() and pendingUpdateDetails[1] == updateInfo["version"] text = sHelper.addItem(wx.StaticText(self)) bHelper = guiHelper.ButtonHelper(wx.HORIZONTAL) if not updateInfo: # Translators: A message indicating that no update to NVDA is available. message = _("No update available.") elif canOfferPendingUpdate: # 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) self.apiVersion = pendingUpdateDetails[2] self.backCompatTo = pendingUpdateDetails[3] showAddonCompat = any(getIncompatibleAddons( currentAPIVersion=self.apiVersion, backCompatToAPIVersion=self.backCompatTo )) if showAddonCompat: # Translators: A message indicating that some add-ons will be disabled unless reviewed before installation. message = message + _( "\n\n" "However, your NVDA configuration contains add-ons that are incompatible with this version of NVDA. " "These add-ons will be disabled after installation. If you rely on these add-ons, " "please review the list to decide whether to continue with the installation" ) confirmationCheckbox = sHelper.addItem(wx.CheckBox( self, # Translators: A message to confirm that the user understands that addons that have not been # reviewed and made available, will be disabled after installation. label=_("I understand that these incompatible add-ons will be disabled") )) confirmationCheckbox.Bind( wx.EVT_CHECKBOX, lambda evt: self.installPendingButton.Enable(not self.installPendingButton.Enabled) ) confirmationCheckbox.SetFocus() # Translators: The label of a button to review add-ons prior to NVDA update. reviewAddonsButton = bHelper.addButton(self, label=_("&Review add-ons...")) reviewAddonsButton.Bind(wx.EVT_BUTTON, self.onReviewAddonsButton) self.installPendingButton = bHelper.addButton( self, # Translators: The label of a button to install a pending NVDA update. # {version} will be replaced with the version; e.g. 2011.3. label=_("&Install NVDA {version}").format(**updateInfo) ) self.installPendingButton.Bind( wx.EVT_BUTTON, lambda evt: self.onInstallButton(pendingUpdateDetails[0]) ) self.installPendingButton.Enable(not showAddonCompat) bHelper.addButton( self, # Translators: The label of a button to re-download a pending NVDA update. label=_("Re-&download update") ).Bind(wx.EVT_BUTTON, self.onDownloadButton) 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) bHelper.addButton( self, # Translators: The label of a button to download an NVDA update. label=_("&Download update") ).Bind(wx.EVT_BUTTON, self.onDownloadButton) if auto: # this prompt was triggered by auto update checker # the user might not want to wait for a download right now, so give the option to be reminded later. # 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() text.SetLabel(message) text.Wrap(self.scaleSize(500)) sHelper.addDialogDismissButtons(bHelper) # 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()