Example #1
0
	def onRunCOMRegistrationFixesCommand(self, evt):
		if isInMessageBox:
			return
		if gui.messageBox(
			# Translators: A message to warn the user when starting the COM Registration Fixing tool 
			_("You are about to run the COM Registration Fixing tool. This tool will try to fix common system problems that stop NVDA from being able to access content in many programs including Firefox and Internet Explorer. This tool must make changes to the System registry and therefore requires administrative access. Are you sure you wish to proceed?"),
			# Translators: The title of the warning dialog displayed when launching the COM Registration Fixing tool 
			_("Warning"),wx.YES|wx.NO|wx.ICON_WARNING,self
		)==wx.NO:
			return
		progressDialog = IndeterminateProgressDialog(mainFrame,
			# Translators: The title of the dialog presented while NVDA is running the COM Registration fixing tool 
			_("COM Registration Fixing Tool"),
			# Translators: The message displayed while NVDA is running the COM Registration fixing tool 
			_("Please wait while NVDA tries to fix your system's COM registrations.")
		)
		try:
			config.execElevated(config.SLAVE_FILENAME,["fixCOMRegistrations"])
		except:
			log.error("Could not execute fixCOMRegistrations command",exc_info=True) 
		progressDialog.done()
		del progressDialog
		# Translators: The message displayed when the COM Registration Fixing tool completes.
		gui.messageBox(_("COM Registration Fixing tool complete"),
			# Translators: The title of a dialog presented when the COM Registration Fixing tool is complete. 
			_("COM Registration Fixing Tool"),
			wx.OK)
Example #2
0
	def onRunCOMRegistrationFixesCommand(self, evt):
		if isInMessageBox:
			return
		if gui.messageBox(
			# Translators: A message to warn the user when starting the COM Registration Fixing tool 
			_("You are about to run the COM Registration Fixing tool. This tool will try to fix common system problems that stop NVDA from being able to access content in many programs including Firefox and Internet Explorer. This tool must make changes to the System registry and therefore requires administrative access. Are you sure you wish to proceed?"),
			# Translators: The title of the warning dialog displayed when launching the COM Registration Fixing tool 
			_("Warning"),wx.YES|wx.NO|wx.ICON_WARNING,self
		)==wx.NO:
			return
		progressDialog = IndeterminateProgressDialog(mainFrame,
			# Translators: The title of the dialog presented while NVDA is running the COM Registration fixing tool 
			_("COM Registration Fixing Tool"),
			# Translators: The message displayed while NVDA is running the COM Registration fixing tool 
			_("Please wait while NVDA tries to fix your system's COM registrations.")
		)
		try:
			config.execElevated(config.SLAVE_FILENAME,["fixCOMRegistrations"])
		except:
			log.error("Could not execute fixCOMRegistrations command",exc_info=True) 
		progressDialog.done()
		del progressDialog
		# Translators: The message displayed when the COM Registration Fixing tool completes.
		gui.messageBox(_("COM Registration Fixing tool complete"),
			# Translators: The title of a dialog presented when the COM Registration Fixing tool is complete. 
			_("COM Registration Fixing Tool"),
			wx.OK)
def doInstall(createDesktopShortcut,startOnLogon,copyPortableConfig,isUpdate,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=config.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:
				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,startOnLogon,copyPortableConfig,isUpdate,silent,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"))
	if startAfterInstall:
		# #4475: ensure that the first window of the new process is not hidden by providing SW_SHOWNORMAL  
		shellapi.ShellExecute(
			None,
			None,
			os.path.join(installer.defaultInstallPath,'nvda.exe'),
			None,
			None,
			winUser.SW_SHOWNORMAL
		)
	else:
		wx.GetApp().ExitMainLoop()
Example #4
0
def doInstall(createDesktopShortcut,startOnLogon,copyPortableConfig,isUpdate,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=config.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:
				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,startOnLogon,copyPortableConfig,isUpdate,silent,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"))
	if startAfterInstall:
		# #4475: ensure that the first window of the new process is not hidden by providing SW_SHOWNORMAL  
		shellapi.ShellExecute(None, None,
			os.path.join(installer.defaultInstallPath,'nvda.exe'),
			u"-r",
			None, winUser.SW_SHOWNORMAL)
	else:
		wx.GetApp().ExitMainLoop()
Example #5
0
def _onInstallDragonCommands():
    si = subprocess.STARTUPINFO()
    si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
    si.wShowWindow = subprocess.SW_HIDE
    dragonDir = r"C:\Program Files (x86)\Nuance\NaturallySpeaking15\Program"
    #Translators: Title of an error dialog shown in dictation bridge.
    DB_ERROR_TITLE = _("Dictation Bridge Error")
    if not os.path.exists(dragonDir):
        dragonDir.replace(r" (x86)", "")
    if not os.path.exists(dragonDir):
        #Translators: Message given to the user when the addon can't find an installed copy of dragon.
        gui.messageBox(
            _("Cannot find dragon installed on your machine. Please install dragon and then try this process again."
              ), DB_ERROR_TITLE)
        return
    xml2dat = os.path.join(dragonDir, "mycmdsxml2dat.exe")
    nsadmin = os.path.join(dragonDir, "nsadmin.exe")
    addonRootDir = os.path.abspath(
        os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
    #Translators: The official name of Dragon in your language, this probably should be left as Dragon.
    thisProgram = _("Dragon")
    if os.path.exists(
            os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat")):
        os.remove(
            os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat"))
    try:
        subprocess.check_call([
            xml2dat,
            os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat"),
            os.path.join(addonRootDir, "dragon_dictationBridgeCommands.xml"),
        ],
                              startupinfo=si)
        #Fixme: might need to get the users language, and put them there for non-english locales.
        d = config.execElevated(nsadmin, [
            "/commands",
            os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat"),
            "/overwrite=yes"
        ],
                                wait=True,
                                handleAlreadyElevated=True)

        successDialog(thisProgram)
    except:
        #Translators: Message shown if dragon commands failed to install.
        gui.messageBox(
            _("There was an error while performing the addition of dragon commands into dragon. Are you running as an administrator? If so, please send the error in your log to the dictation bridge team as a bug report."
              ), DB_ERROR_TITLE)
        raise
    finally:
        if os.path.exists(
                os.path.join(addonRootDir,
                             "dragon_dictationBridgeCommands.dat")):
            os.remove(
                os.path.join(addonRootDir,
                             "dragon_dictationBridgeCommands.dat"))
Example #6
0
def _onInstallDragonCommands():
	#Translators: Warning about having custom commands already.
	goAhead = gui.messageBox(_("If you are on a computer with shared commands, and you have multiple users using these commands, this will override them. Please do not proceed unless you are sure you aren't sharing commands over a network. if you are, please read \"Importing Commands Into a Shared System\" in the Dictation Bridge documentation for manual steps.\nDo you want to proceed?"),
		#Translators: Warning dialog title.
		_("Warning: Potentially Dangerous Opperation Will be Performed"),
		wx.YES|wx.NO)
	if goAhead==wx.NO:
		return
	si = subprocess.STARTUPINFO()
	si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
	si.wShowWindow = subprocess.SW_HIDE
	dragonDir = r"C:\Program Files (x86)\Nuance\NaturallySpeaking15\Program"
	#Translators: Title of an error dialog shown in dictation bridge.
	DB_ERROR_TITLE = _("Dictation Bridge Error")
	if not os.path.exists(dragonDir):
		dragonDir.replace(r" (x86)", "")
	if not os.path.exists(dragonDir):
		#Translators: Message given to the user when the addon can't find an installed copy of dragon.
		gui.messageBox(_("Cannot find dragon installed on your machine. Please install dragon and then try this process again."),
			DB_ERROR_TITLE)
		return
	xml2dat = os.path.join(dragonDir, "mycmdsxml2dat.exe")
	nsadmin = os.path.join(dragonDir, "nsadmin.exe")
	addonRootDir = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
	if os.path.exists(os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat")):
			os.remove(os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat"))
	try:
		subprocess.check_call([
			xml2dat,
			os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat"),
			os.path.join(addonRootDir, "dragon_dictationBridgeCommands.xml"),
			"-v",
			], startupinfo=si)
		#Fixme: might need to get the users language, and put them there for non-english locales.
		d=config.execElevated(nsadmin,
			["/commands", os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat"), "/overwrite=yes"],
			wait=True, handleAlreadyElevated=True)
		print "blah"+str(d)
		#Translators: Message shown if the commands were installed into dragon successfully.
		gui.messageBox(_("The dragon commands were successfully installed. Please restart your dragon profile to proceed. See the manual for details on how to do this."),
			#Translators: Title of the successfully installed commands dialog
			_("Success!"))
	except:
		#Translators: Message shown if dragon commands failed to install.
		gui.messageBox(_("There was an error while performing the addition of dragon commands into dragon. Are you running as an administrator? If so, please send the error in your log to the dictation bridge team as a bug report."),
			DB_ERROR_TITLE)
		raise
	finally:
		if os.path.exists(os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat")):
			os.remove(os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat"))
		else:
			print "baaaaaaaaaaaaaaaaaaaaaaaaa ", os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat")
def _onInstallDragonCommands():
	si = subprocess.STARTUPINFO()
	si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
	si.wShowWindow = subprocess.SW_HIDE
	dragonDir = r"C:\Program Files (x86)\Nuance\NaturallySpeaking15\Program"
	#Translators: Title of an error dialog shown in dictation bridge.
	DB_ERROR_TITLE = _("Dictation Bridge Error")
	if not os.path.exists(dragonDir):
		dragonDir.replace(r" (x86)", "")
	if not os.path.exists(dragonDir):
		#Translators: Message given to the user when the addon can't find an installed copy of dragon.
		gui.messageBox(_("Cannot find dragon installed on your machine. Please install dragon and then try this process again."),
			DB_ERROR_TITLE)
		return
	xml2dat = os.path.join(dragonDir, "mycmdsxml2dat.exe")
	nsadmin = os.path.join(dragonDir, "nsadmin.exe")
	
	#Translators: The official name of Dragon in your language, this probably should be left as Dragon.
	thisProgram = _("Dragon")
	if os.path.exists(os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat")):
			os.remove(os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat"))
	try:
		subprocess.check_call([
			xml2dat,
			os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat"),
			os.path.join(addonRootDir, "dragon_dictationBridgeCommands.xml"),
			], startupinfo=si)
		#Fixme: might need to get the users language, and put them there for non-english locales.
		d=config.execElevated(nsadmin,
			["/commands", os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat"), "/overwrite=yes"],
			wait=True, handleAlreadyElevated=True)

		successDialog(thisProgram)
	except:
		#Translators: Message shown if dragon commands failed to install.
		gui.messageBox(_("There was an error while performing the addition of dragon commands into dragon. Are you running as an administrator? If so, please send the error in your log to the dictation bridge team as a bug report."),
			DB_ERROR_TITLE)
		raise
	finally:
		if os.path.exists(os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat")):
			os.remove(os.path.join(addonRootDir, "dragon_dictationBridgeCommands.dat"))