Exemple #1
0
	def __init__(self, *args, **kwargs):
		"""Called in place of wx.Dialog __init__ arguments are forwarded on.
		Expected args (from wx docs):
		parent, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE, name=wx.DialogNameStr
		where:
		wx.DEFAULT_DIALOG_STYLE = (wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX)
		"""
		wx.Dialog.__init__(self, *args, **kwargs)
		DpiScalingHelperMixin.__init__(self, self.GetHandle())
Exemple #2
0
    def __init__(self, *args, **kwargs):
        """Called in place of wx.Dialog __init__ arguments are forwarded on.
		Expected args (from wx docs):
		parent, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE, name=wx.DialogNameStr
		where:
		wx.DEFAULT_DIALOG_STYLE = (wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX)
		"""
        wx.Dialog.__init__(self, *args, **kwargs)
        DpiScalingHelperMixin.__init__(self, self.GetHandle())
Exemple #3
0
	def __init__(self):
		# Translators: The title of a warning dialog.
		wx.Dialog.__init__(self, gui.mainFrame, title=_("Warning"))
		DpiScalingHelperMixin.__init__(self, self.GetHandle())

		mainSizer = wx.BoxSizer(wx.VERTICAL)
		contentSizer = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL)
		text = wx.StaticText(
			self,
			label=_(
				# Translators: A warning presented when the user attempts to downgrade NVDA
				# to an older version.
				"You are attempting to install an earlier version of NVDA "
				"than the version currently installed. "
				"If you really wish to revert to an earlier version, "
				"you should first cancel this installation "
				"and completely uninstall NVDA before installing the earlier version."
			))
		text.Wrap(self.scaleSize(600))
		contentSizer.addItem(text)

		buttonHelper = guiHelper.ButtonHelper(orientation=wx.HORIZONTAL)
		okButton = buttonHelper.addButton(
			parent=self,
			id=wx.ID_OK,
			# Translators: The label of a button to proceed with installation,
			# even though this is not recommended.
			label=_("&Proceed with installation (not recommended)")
		)
		cancelButton = buttonHelper.addButton(
			parent=self,
			id=wx.ID_CANCEL
		)
		contentSizer.addDialogDismissButtons(buttonHelper)

		cancelButton.SetFocus()
		mainSizer.Add(contentSizer.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
		self.Sizer = mainSizer
		self.SetSizer(mainSizer)
		mainSizer.Fit(self)
		self.CentreOnScreen()
Exemple #4
0
	def __init__(self):
		# Translators: The title of a warning dialog.
		wx.Dialog.__init__(self, gui.mainFrame, title=_("Warning"))
		DpiScalingHelperMixin.__init__(self, self.GetHandle())

		mainSizer = wx.BoxSizer(wx.VERTICAL)
		contentSizer = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL)
		text = wx.StaticText(
			self,
			# Translators: A warning presented when the user attempts to downgrade NVDA
			# to an older version.
			label=_(
				"You are attempting to install an earlier version of NVDA than the version currently installed. "
				"If you really wish to revert to an earlier version, you should first cancel this installation "
				"and completely uninstall NVDA before installing the earlier version."
			))
		text.Wrap(self.scaleSize(600))
		contentSizer.addItem(text)

		buttonHelper = guiHelper.ButtonHelper(orientation=wx.HORIZONTAL)
		okButton = buttonHelper.addButton(
			parent=self,
			id=wx.ID_OK,
			# Translators: The label of a button to proceed with installation,
			# even though this is not recommended.
			label=_("&Proceed with installation (not recommended)")
		)
		cancelButton = buttonHelper.addButton(
			parent=self,
			id=wx.ID_CANCEL
		)
		contentSizer.addDialogDismissButtons(buttonHelper)

		cancelButton.SetFocus()
		mainSizer.Add(contentSizer.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
		self.Sizer = mainSizer
		self.SetSizer(mainSizer)
		mainSizer.Fit(self)
		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()
Exemple #6
0
	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()
Exemple #7
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.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()
Exemple #8
0
    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:
            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()
Exemple #9
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.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()
Exemple #10
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 #11
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 #12
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()