コード例 #1
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))
コード例 #2
0
ファイル: installerGui.py プロジェクト: alex19EP/nvda
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 silent or startAfterCreate:
        newNVDA = None
        if startAfterCreate:
            newNVDA = core.NewNVDAInstance(
                os.path.join(portableDirectory, 'nvda.exe'))
        core.triggerNVDAExit(newNVDA)
コード例 #3
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)