def registerInstallation(installDir,startMenuFolder,shouldCreateDesktopShortcut,startOnLogonScreen): import _winreg with _winreg.CreateKeyEx(_winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\NVDA",0,_winreg.KEY_WRITE) as k: for name,value in uninstallerRegInfo.iteritems(): _winreg.SetValueEx(k,name,None,_winreg.REG_SZ,value.format(installDir=installDir)) with _winreg.CreateKeyEx(_winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe",0,_winreg.KEY_WRITE) as k: _winreg.SetValueEx(k,"",None,_winreg.REG_SZ,os.path.join(installDir,"nvda.exe")) with _winreg.CreateKeyEx(_winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\nvda",0,_winreg.KEY_WRITE) as k: _winreg.SetValueEx(k,"startMenuFolder",None,_winreg.REG_SZ,startMenuFolder) if startOnLogonScreen is not None: _winreg.SetValueEx(k,"startOnLogonScreen",None,_winreg.REG_DWORD,int(startOnLogonScreen)) import nvda_service nvda_service.installService(installDir) nvda_service.startService() NVDAExe=os.path.join(installDir,u"nvda.exe") slaveExe=os.path.join(installDir,u"nvda_slave.exe") if shouldCreateDesktopShortcut: createShortcut(u"NVDA.lnk",targetPath=slaveExe,arguments="launchNVDA -r",hotkey="CTRL+ALT+N",workingDirectory=installDir,prependSpecialFolder="AllUsersDesktop") createShortcut(os.path.join(startMenuFolder,"NVDA.lnk"),targetPath=NVDAExe,workingDirectory=installDir,prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut in start menu and a menu entry in NVDA menu (to go to NVDA website). createShortcut(os.path.join(startMenuFolder,_("NVDA web site")+".lnk"),targetPath=versionInfo.url,prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut item in start menu to uninstall NVDA from the computer. createShortcut(os.path.join(startMenuFolder,_("Uninstall NVDA")+".lnk"),targetPath=os.path.join(installDir,"uninstall.exe"),workingDirectory=installDir,prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut item in start menu to open current user's NVDA configuration directory. createShortcut(os.path.join(startMenuFolder,_("Explore NVDA user configuration directory")+".lnk"),targetPath=slaveExe,arguments="explore_userConfigPath",workingDirectory=installDir,prependSpecialFolder="AllUsersPrograms") # Translators: The label of the NVDA Documentation menu in the Start Menu. docFolder=os.path.join(startMenuFolder,_("Documentation")) # Translators: The label of the Start Menu item to open the Commands Quick Reference document. createShortcut(os.path.join(docFolder,_("Commands Quick Reference")+".lnk"),targetPath=getDocFilePath("keyCommands.html",installDir),prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut in start menu and a menu entry in NVDA menu (to open the user guide). createShortcut(os.path.join(docFolder,_("User Guide")+".lnk"),targetPath=getDocFilePath("userGuide.html",installDir),prependSpecialFolder="AllUsersPrograms") registerAddonFileAssociation(slaveExe)
def registerInstallation(installDir,startMenuFolder,shouldCreateDesktopShortcut,startOnLogonScreen,configInLocalAppData=False): import _winreg with _winreg.CreateKeyEx(_winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\NVDA",0,_winreg.KEY_WRITE) as k: for name,value in uninstallerRegInfo.iteritems(): _winreg.SetValueEx(k,name,None,_winreg.REG_SZ,value.format(installDir=installDir)) with _winreg.CreateKeyEx(_winreg.HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe",0,_winreg.KEY_WRITE) as k: _winreg.SetValueEx(k,"",None,_winreg.REG_SZ,os.path.join(installDir,"nvda.exe")) with _winreg.CreateKeyEx(_winreg.HKEY_LOCAL_MACHINE,config.NVDA_REGKEY,0,_winreg.KEY_WRITE) as k: _winreg.SetValueEx(k,"startMenuFolder",None,_winreg.REG_SZ,startMenuFolder) if configInLocalAppData: _winreg.SetValueEx(k,config.CONFIG_IN_LOCAL_APPDATA_SUBKEY,None,_winreg.REG_DWORD,int(configInLocalAppData)) if easeOfAccess.isSupported: registerEaseOfAccess(installDir) else: import nvda_service nvda_service.installService(installDir) nvda_service.startService() if startOnLogonScreen is not None: config._setStartOnLogonScreen(startOnLogonScreen) NVDAExe=os.path.join(installDir,u"nvda.exe") slaveExe=os.path.join(installDir,u"nvda_slave.exe") if shouldCreateDesktopShortcut: # Translators: The shortcut key used to start NVDA. # This should normally be left as is, but might be changed for some locales # if the default key causes problems for the normal locale keyboard layout. # The key must be formatted as described in this article: # http://msdn.microsoft.com/en-us/library/3zb1shc6%28v=vs.84%29.aspx createShortcut(u"NVDA.lnk",targetPath=slaveExe,arguments="launchNVDA -r",hotkey=_("CTRL+ALT+N"),workingDirectory=installDir,prependSpecialFolder="AllUsersDesktop") createShortcut(os.path.join(startMenuFolder,"NVDA.lnk"),targetPath=NVDAExe,workingDirectory=installDir,prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut in start menu and a menu entry in NVDA menu (to go to NVDA website). createShortcut(os.path.join(startMenuFolder,_("NVDA web site")+".lnk"),targetPath=versionInfo.url,prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut item in start menu to uninstall NVDA from the computer. createShortcut(os.path.join(startMenuFolder,_("Uninstall NVDA")+".lnk"),targetPath=os.path.join(installDir,"uninstall.exe"),workingDirectory=installDir,prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut item in start menu to open current user's NVDA configuration directory. createShortcut(os.path.join(startMenuFolder,_("Explore NVDA user configuration directory")+".lnk"),targetPath=slaveExe,arguments="explore_userConfigPath",workingDirectory=installDir,prependSpecialFolder="AllUsersPrograms") # Translators: The label of the NVDA Documentation menu in the Start Menu. docFolder=os.path.join(startMenuFolder,_("Documentation")) # Translators: The label of the Start Menu item to open the Commands Quick Reference document. createShortcut(os.path.join(docFolder,_("Commands Quick Reference")+".lnk"),targetPath=getDocFilePath("keyCommands.html",installDir),prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut in start menu to open NVDA user guide. createShortcut(os.path.join(docFolder,_("User Guide")+".lnk"),targetPath=getDocFilePath("userGuide.html",installDir),prependSpecialFolder="AllUsersPrograms") registerAddonFileAssociation(slaveExe)
def registerInstallation(installDir, startMenuFolder, shouldCreateDesktopShortcut, startOnLogonScreen): import _winreg with _winreg.CreateKeyEx( _winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\NVDA", 0, _winreg.KEY_WRITE) as k: for name, value in uninstallerRegInfo.iteritems(): _winreg.SetValueEx(k, name, None, _winreg.REG_SZ, value.format(installDir=installDir)) with _winreg.CreateKeyEx( _winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\nvda.exe", 0, _winreg.KEY_WRITE) as k: _winreg.SetValueEx(k, "", None, _winreg.REG_SZ, os.path.join(installDir, "nvda.exe")) with _winreg.CreateKeyEx(_winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\nvda", 0, _winreg.KEY_WRITE) as k: _winreg.SetValueEx(k, "startMenuFolder", None, _winreg.REG_SZ, startMenuFolder) if startOnLogonScreen is not None: _winreg.SetValueEx(k, "startOnLogonScreen", None, _winreg.REG_DWORD, int(startOnLogonScreen)) import nvda_service nvda_service.installService(installDir) nvda_service.startService() NVDAExe = os.path.join(installDir, u"nvda.exe") slaveExe = os.path.join(installDir, u"nvda_slave.exe") if shouldCreateDesktopShortcut: createShortcut(u"NVDA.lnk", targetPath=slaveExe, arguments="launchNVDA -r", hotkey="CTRL+ALT+N", workingDirectory=installDir, prependSpecialFolder="AllUsersDesktop") createShortcut(os.path.join(startMenuFolder, "NVDA.lnk"), targetPath=NVDAExe, workingDirectory=installDir, prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut in start menu and a menu entry in NVDA menu (to go to NVDA website). createShortcut(os.path.join(startMenuFolder, _("NVDA web site") + ".lnk"), targetPath=versionInfo.url, prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut item in start menu to uninstall NVDA from the computer. createShortcut(os.path.join(startMenuFolder, _("Uninstall NVDA") + ".lnk"), targetPath=os.path.join(installDir, "uninstall.exe"), workingDirectory=installDir, prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut item in start menu to open current user's NVDA configuration directory. createShortcut(os.path.join( startMenuFolder, _("Explore NVDA user configuration directory") + ".lnk"), targetPath=slaveExe, arguments="explore_userConfigPath", workingDirectory=installDir, prependSpecialFolder="AllUsersPrograms") # Translators: The label of the NVDA Documentation menu in the Start Menu. docFolder = os.path.join(startMenuFolder, _("Documentation")) # Translators: The label of the Start Menu item to open the Commands Quick Reference document. createShortcut(os.path.join(docFolder, _("Commands Quick Reference") + ".lnk"), targetPath=getDocFilePath("keyCommands.html", installDir), prependSpecialFolder="AllUsersPrograms") # Translators: A label for a shortcut in start menu and a menu entry in NVDA menu (to open the user guide). createShortcut(os.path.join(docFolder, _("User Guide") + ".lnk"), targetPath=getDocFilePath("userGuide.html", installDir), prependSpecialFolder="AllUsersPrograms") registerAddonFileAssociation(slaveExe)