コード例 #1
0
ファイル: __init__.py プロジェクト: bocoup/nvda
	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:
			core.triggerNVDAExit()
			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)
コード例 #2
0
 def onExitCommand(self, evt):
     if config.conf["general"]["askToExit"]:
         self.prePopup()
         d = ExitDialog(self)
         d.Raise()
         d.Show()
         self.postPopup()
     else:
         core.triggerNVDAExit()
コード例 #3
0
 def onExit(self, evt: wx.CommandEvent):
     if not core.triggerNVDAExit():
         log.error(
             "NVDA already in process of exiting, this indicates a logic error."
         )
     self.Destroy(
     )  # Without this, the onExit is called multiple times by wx.
コード例 #4
0
def doCreatePortable(portableDirectory,
                     copyUserConfig=False,
                     silent=False,
                     startAfterCreate=False):
    d = gui.IndeterminateProgressDialog(
        gui.mainFrame,
        # Translators: The title of the dialog presented while a portable copy of NVDA is bieng created.
        _("Creating Portable Copy"),
        # Translators: The message displayed while a portable copy of NVDA is bieng created.
        _("Please wait while a portable copy of NVDA is created."))
    try:
        gui.ExecAndPump(installer.createPortableCopy, portableDirectory,
                        copyUserConfig)
    except Exception as e:
        log.error("Failed to create portable copy", exc_info=True)
        d.done()
        if isinstance(e, installer.RetriableFailure):
            # Translators: a message dialog asking to retry or cancel when NVDA portable copy creation fails
            message = _("NVDA is unable to remove or overwrite a file.")
            # Translators: the title of a retry cancel dialog when NVDA portable copy creation  fails
            title = _("File in Use")
            if winUser.MessageBox(None, message, title,
                                  winUser.MB_RETRYCANCEL) == winUser.IDRETRY:
                return doCreatePortable(portableDirectory, copyUserConfig,
                                        silent, startAfterCreate)
        # Translators: The message displayed when an error occurs while creating a portable copy of NVDA.
        # %s will be replaced with the specific error message.
        gui.messageBox(
            _("Failed to create portable copy: %s") % e, _("Error"),
            wx.OK | wx.ICON_ERROR)
        return
    d.done()
    if not silent:
        # Translators: The message displayed when a portable copy of NVDA has been successfully created.
        # %s will be replaced with the destination directory.
        gui.messageBox(
            _("Successfully created a portable copy of NVDA at %s") %
            portableDirectory, _("Success"))
        if startAfterCreate:

            def startNewPortableNVDAInstance():
                _startNewNVDAInstance(portableDirectory)

            core.preNVDAExit.register(startNewPortableNVDAInstance)
    if silent or startAfterCreate:
        core.triggerNVDAExit()
コード例 #5
0
ファイル: updateCheck.py プロジェクト: alex19EP/nvda
def _executeUpdate(destPath):
    if not destPath:
        return

    _setStateToNone(state)
    saveState()
    if config.isInstalledCopy():
        executeParams = u"--install -m"
    else:
        portablePath = globalVars.appDir
        if os.access(portablePath, os.W_OK):
            executeParams = u'--create-portable --portable-path "{portablePath}" --config-path "{configPath}" -m'.format(
                portablePath=portablePath,
                configPath=globalVars.appArgs.configPath)
        else:
            executeParams = u"--launcher"
    # #4475: ensure that the new process shows its first window, by providing SW_SHOWNORMAL
    core.triggerNVDAExit(core.NewNVDAInstance(destPath, executeParams))
コード例 #6
0
ファイル: __init__.py プロジェクト: zstanecic/nvda
	def onExitCommand(self, evt):
		if config.conf["general"]["askToExit"]:
			self.prePopup()
			d = ExitDialog(self)
			d.Raise()
			d.Show()
			self.postPopup()
		else:
			if not core.triggerNVDAExit():
				log.error("NVDA already in process of exiting, this indicates a logic error.")
コード例 #7
0
 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)
コード例 #8
0
ファイル: startupDialogs.py プロジェクト: okasen/nvda
 def onExit(self, evt):
     core.triggerNVDAExit()
コード例 #9
0
ファイル: installerGui.py プロジェクト: alex19EP/nvda
def doInstall(createDesktopShortcut=True,
              startOnLogon=True,
              isUpdate=False,
              copyPortableConfig=False,
              silent=False,
              startAfterInstall=True):
    progressDialog = gui.IndeterminateProgressDialog(
        gui.mainFrame,
        # Translators: The title of the dialog presented while NVDA is being updated.
        _("Updating NVDA") if isUpdate
        # Translators: The title of the dialog presented while NVDA is being installed.
        else _("Installing NVDA"),
        # Translators: The message displayed while NVDA is being updated.
        _("Please wait while your previous installation of NVDA is being updated."
          ) if isUpdate
        # Translators: The message displayed while NVDA is being installed.
        else _("Please wait while NVDA is being installed"))
    try:
        res = systemUtils.execElevated(config.SLAVE_FILENAME, [
            "install",
            str(int(createDesktopShortcut)),
            str(int(startOnLogon))
        ],
                                       wait=True,
                                       handleAlreadyElevated=True)
        if res == 2: raise installer.RetriableFailure
        if copyPortableConfig:
            installedUserConfigPath = config.getInstalledUserConfigPath()
            if installedUserConfigPath:
                if _canPortableConfigBeCopied():
                    gui.ExecAndPump(installer.copyUserConfig,
                                    installedUserConfigPath)
    except Exception as e:
        res = e
        log.error("Failed to execute installer", exc_info=True)
    progressDialog.done()
    del progressDialog
    if isinstance(res, installer.RetriableFailure):
        # Translators: a message dialog asking to retry or cancel when NVDA install fails
        message = _(
            "The installation is unable to remove or overwrite a file. Another copy of NVDA may be running on another logged-on user account. Please make sure all installed copies of NVDA are shut down and try the installation again."
        )
        # Translators: the title of a retry cancel dialog when NVDA installation fails
        title = _("File in Use")
        if winUser.MessageBox(None, message, title,
                              winUser.MB_RETRYCANCEL) == winUser.IDRETRY:
            return doInstall(createDesktopShortcut=createDesktopShortcut,
                             startOnLogon=startOnLogon,
                             copyPortableConfig=copyPortableConfig,
                             isUpdate=isUpdate,
                             silent=silent,
                             startAfterInstall=startAfterInstall)
    if res != 0:
        log.error("Installation failed: %s" % res)
        # Translators: The message displayed when an error occurs during installation of NVDA.
        gui.messageBox(
            _("The installation of NVDA failed. Please check the Log Viewer for more information."
              ),
            # Translators: The title of a dialog presented when an error occurs.
            _("Error"),
            wx.OK | wx.ICON_ERROR)
        return
    if not silent:
        msg = (
            # Translators: The message displayed when NVDA has been successfully installed.
            _("Successfully installed NVDA. ") if not isUpdate
            # Translators: The message displayed when NVDA has been successfully updated.
            else _("Successfully updated your installation of NVDA. "))
        # Translators: The message displayed to the user after NVDA is installed
        # and the installed copy is about to be started.
        gui.messageBox(
            msg + _("Please press OK to start the installed copy."),
            # Translators: The title of a dialog presented to indicate a successful operation.
            _("Success"))

    newNVDA = None
    if startAfterInstall:
        newNVDA = core.NewNVDAInstance(
            os.path.join(installer.defaultInstallPath, 'nvda.exe'))
    core.triggerNVDAExit(newNVDA)