Exemple #1
0
	def onExecuteUpdateCommand(self, evt):
		if updateCheck and updateCheck.isPendingUpdate():
			updateTuple = updateCheck.getPendingUpdate()
			newNVDAVersionTuple = updateTuple[2]
			from addonHandler import getAddonsWithoutKnownCompatibility
			if any(getAddonsWithoutKnownCompatibility(newNVDAVersionTuple)):
				confirmUpdateDialog = updateCheck.UpdateAskInstallDialog(gui.mainFrame, updateTuple[0], updateTuple[1], newNVDAVersionTuple)
				gui.runScriptModalDialog(confirmUpdateDialog)
			else:
				updateCheck.executePendingUpdate()
Exemple #2
0
	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:
				updateTuple = updateCheck.getPendingUpdate()
				newNVDAVersionTuple = updateTuple[2]
				from addonHandler import getAddonsWithoutKnownCompatibility
				if any(getAddonsWithoutKnownCompatibility(newNVDAVersionTuple)):
					confirmUpdateDialog = updateCheck.UpdateAskInstallDialog(gui.mainFrame, updateTuple[0], updateTuple[1], newNVDAVersionTuple)
					confirmUpdateDialog.ShowModal()
				else:
					updateCheck.executePendingUpdate()
		self.Destroy()
Exemple #3
0
	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()
Exemple #4
0
	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
		self.version = buildVersion.getCurrentVersionTuple()
		addonsWithoutKnownCompat = list(addonHandler.getAddonsWithoutKnownCompatibility(self.version))
		shouldAskAboutAddons = any(addonsWithoutKnownCompat)

		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\nHowever, your NVDA configuration contains add-ons that are not tested 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 manually enable them before installation."
			)
			from addonHandler import AddonCompatibilityState, compatValues
			for a in addonsWithoutKnownCompat:
				# now that the use is warned about the compatibility and so that the user is
				# not prompted again after installation, we set the default compatibility
				AddonCompatibilityState.setAddonCompatibility(
					addon=a,
					NVDAVersion=self.version,
					compatibilityStateValue=compatValues.MANUALLY_SET_INCOMPATIBLE
				)

		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 untested 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()
Exemple #5
0
    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
        self.version = buildVersion.getCurrentVersionTuple()
        addonsWithoutKnownCompat = list(
            addonHandler.getAddonsWithoutKnownCompatibility(self.version))
        shouldAskAboutAddons = any(addonsWithoutKnownCompat)

        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\nHowever, your NVDA configuration contains add-ons that are not tested 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 manually enable them before installation."
            )
            from addonHandler import AddonCompatibilityState, compatValues
            for a in addonsWithoutKnownCompat:
                # now that the use is warned about the compatibility and so that the user is
                # not prompted again after installation, we set the default compatibility
                AddonCompatibilityState.setAddonCompatibility(
                    addon=a,
                    NVDAVersion=self.version,
                    compatibilityStateValue=compatValues.
                    MANUALLY_SET_INCOMPATIBLE)

        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 untested 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))
        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()
Exemple #6
0
    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()
Exemple #7
0
	def __init__(self, parent, destPath, version, versionTuple):
		self.destPath = destPath
		self.version = version
		self.versionTuple = versionTuple
		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)

		addonsWithoutKnownCompat = list(getAddonsWithoutKnownCompatibility(versionTuple))
		showAddonCompat = any(addonsWithoutKnownCompat)
		if showAddonCompat:
			# Translators: A message indicating that some add-ons will be disabled unless reviewed before installation.
			message = message + _(
				"\nHowever, your NVDA configuration contains add-ons that are not tested 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 manually enable them before installation."
			)
			for a in addonsWithoutKnownCompat:
				# now that the use is warned about the compatibility and so that the user is
				# not prompted again after installation, we set the default compatibility
				AddonCompatibilityState.setAddonCompatibility(
					addon=a,
					NVDAVersion=versionTuple,
					compatibilityStateValue=compatValues.MANUALLY_SET_INCOMPATIBLE)
		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 untested 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)
			reviewAddonsButton.SetFocus()
		# 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.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()
Exemple #8
0
	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.newNVDAVersionTuple = pendingUpdateDetails[2]
			addonsWithoutKnownCompat = list(getAddonsWithoutKnownCompatibility(self.newNVDAVersionTuple))
			showAddonCompat = any(addonsWithoutKnownCompat)
			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 not tested 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 manually enable them before 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 untested add-ons will be disabled")
				))
				confirmationCheckbox.Bind(
					wx.EVT_CHECKBOX,
					lambda evt: self.installPendingButton.Enable(not self.installPendingButton.Enabled)
				)
				# 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)
				reviewAddonsButton.SetFocus()
				for a in addonsWithoutKnownCompat:
					# now that the use is warned about the compatibility and so that the user is
					# not prompted again after installation, we set the default compatibility
					AddonCompatibilityState.setAddonCompatibility(
						addon=a,
						NVDAVersion=self.newNVDAVersionTuple,
						compatibilityStateValue=compatValues.MANUALLY_SET_INCOMPATIBLE
					)
			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()
Exemple #9
0
    def __init__(self, parent, destPath, version):
        self.destPath = destPath
        self.version = version
        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)

        newNVDAVersionTuple = versionInfo.getNVDAVersionTupleFromString(
            self.version)
        addonsWithoutKnownCompat = list(
            getAddonsWithoutKnownCompatibility(newNVDAVersionTuple))
        showAddonCompat = any(addonsWithoutKnownCompat)
        if showAddonCompat:
            # Translators: A message indicating that some add-ons will be disabled unless reviewed before installation.
            message = message + _(
                "\nHowever, your NVDA configuration contains add-ons that are not tested 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 manually enable them before installation."
            )
            for a in addonsWithoutKnownCompat:
                # now that the use is warned about the compatibility and so that the user is
                # not prompted again after installation, we set the default compatibility
                AddonCompatibilityState.setAddonCompatibility(
                    addon=a,
                    NVDAVersion=newNVDAVersionTuple,
                    compatibilityStateValue=compatValues.
                    MANUALLY_SET_INCOMPATIBLE)
        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 untested 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)
            reviewAddonsButton.SetFocus()
        # 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.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()
Exemple #10
0
    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.newNVDAVersionTuple = versionInfo.getNVDAVersionTupleFromString(
                updateInfo["version"])
            addonsWithoutKnownCompat = list(
                getAddonsWithoutKnownCompatibility(self.newNVDAVersionTuple))
            showAddonCompat = any(addonsWithoutKnownCompat)
            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 not tested 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 manually enable them before 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 untested add-ons will be disabled"
                          )))
                confirmationCheckbox.Bind(
                    wx.EVT_CHECKBOX, lambda evt: self.installPendingButton.
                    Enable(not self.installPendingButton.Enabled))
                # 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)
                reviewAddonsButton.SetFocus()
                for a in addonsWithoutKnownCompat:
                    # now that the use is warned about the compatibility and so that the user is
                    # not prompted again after installation, we set the default compatibility
                    AddonCompatibilityState.setAddonCompatibility(
                        addon=a,
                        NVDAVersion=self.newNVDAVersionTuple,
                        compatibilityStateValue=compatValues.
                        MANUALLY_SET_INCOMPATIBLE)
            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()