def initialize(): global bridgeDll, isRunning try: bridgeDll = cdll.LoadLibrary( os.path.join(NVDAHelper.versionedLibPath, "windowsaccessbridge-32.dll")) except WindowsError: raise NotImplementedError("dll not available") _fixBridgeFuncs() if ( not globalVars.appArgs.secure and config.isInstalledCopy() and not isBridgeEnabled() ): enableBridge() # Accept wm_copydata and any wm_user messages from other processes even if running with higher privileges if not windll.user32.ChangeWindowMessageFilter(winUser.WM_COPYDATA, 1): raise WinError() for msg in range(winUser.WM_USER + 1, 0xffff): if not windll.user32.ChangeWindowMessageFilter(msg, 1): raise WinError() bridgeDll.Windows_run() # Register java events bridgeDll.setFocusGainedFP(internal_event_focusGained) bridgeDll.setPropertyActiveDescendentChangeFP(internal_event_activeDescendantChange) bridgeDll.setPropertyNameChangeFP(event_nameChange) bridgeDll.setPropertyDescriptionChangeFP(event_descriptionChange) bridgeDll.setPropertyValueChangeFP(event_valueChange) bridgeDll.setPropertyStateChangeFP(internal_event_stateChange) bridgeDll.setPropertyCaretChangeFP(internal_event_caretChange) isRunning=True
def __init__(self, parent): # Translators: The title of the Welcome dialog when user starts NVDA for the first time. super(WelcomeDialog, self).__init__(parent, wx.ID_ANY, _("Welcome to NVDA")) mainSizer=wx.BoxSizer(wx.VERTICAL) # Translators: The header for the Welcome dialog when user starts NVDA for the first time. This is in larger, # bold lettering welcomeTextHeader = wx.StaticText(self, label=_("Welcome to NVDA!")) welcomeTextHeader.SetFont(wx.Font(18, wx.NORMAL, wx.NORMAL, wx.BOLD)) mainSizer.AddSpacer(10) mainSizer.Add(welcomeTextHeader,border=20,flag=wx.EXPAND|wx.LEFT|wx.RIGHT) mainSizer.AddSpacer(10) welcomeTextDetail = wx.StaticText(self, wx.ID_ANY, self.WELCOME_MESSAGE_DETAIL) mainSizer.Add(welcomeTextDetail,border=20,flag=wx.EXPAND|wx.LEFT|wx.RIGHT) optionsSizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Options")), wx.VERTICAL) self.capsAsNVDAModifierCheckBox = wx.CheckBox(self, wx.ID_ANY, _("Use CapsLock as an NVDA modifier key")) self.capsAsNVDAModifierCheckBox.SetValue(config.conf["keyboard"]["useCapsLockAsNVDAModifierKey"]) optionsSizer.Add(self.capsAsNVDAModifierCheckBox,flag=wx.TOP|wx.LEFT,border=10) # Translators: The label of a check box in the Welcome dialog. self.startAfterLogonCheckBox = wx.CheckBox(self, label=_("&Automatically start NVDA after I log on to Windows")) self.startAfterLogonCheckBox.Value = config.getStartAfterLogon() if globalVars.appArgs.secure or not config.isInstalledCopy(): self.startAfterLogonCheckBox.Disable() optionsSizer.Add(self.startAfterLogonCheckBox,flag=wx.TOP|wx.LEFT,border=10) # Translators: This is a label for a checkbox in welcome dialog to show welcome dialog at startup. self.showWelcomeDialogAtStartupCheckBox = wx.CheckBox(self, wx.ID_ANY, _("Show this dialog when NVDA starts")) self.showWelcomeDialogAtStartupCheckBox.SetValue(config.conf["general"]["showWelcomeDialogAtStartup"]) optionsSizer.Add(self.showWelcomeDialogAtStartupCheckBox,flag=wx.TOP|wx.LEFT,border=10) mainSizer.Add(optionsSizer,flag=wx.LEFT|wx.TOP|wx.RIGHT|wx.EXPAND,border=20) mainSizer.Add(self.CreateButtonSizer(wx.OK),flag=wx.TOP|wx.BOTTOM|wx.ALIGN_CENTER_HORIZONTAL,border=20) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) self.SetSizer(mainSizer) mainSizer.Fit(self) self.capsAsNVDAModifierCheckBox.SetFocus() self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
def __init__(self, parent): # Translators: The title of the Welcome dialog when user starts NVDA for the first time. super(WelcomeDialog, self).__init__(parent, wx.ID_ANY, _("Welcome to NVDA")) mainSizer=wx.BoxSizer(wx.VERTICAL) welcomeText = wx.StaticText(self, wx.ID_ANY, self.WELCOME_MESSAGE) mainSizer.Add(welcomeText,border=20,flag=wx.LEFT|wx.RIGHT|wx.TOP) optionsSizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Options")), wx.VERTICAL) self.capsAsNVDAModifierCheckBox = wx.CheckBox(self, wx.ID_ANY, _("Use CapsLock as an NVDA modifier key")) self.capsAsNVDAModifierCheckBox.SetValue(config.conf["keyboard"]["useCapsLockAsNVDAModifierKey"]) optionsSizer.Add(self.capsAsNVDAModifierCheckBox,flag=wx.TOP|wx.LEFT,border=10) # Translators: The label of a check box in the Welcome dialog. self.startAfterLogonCheckBox = wx.CheckBox(self, label=_("&Automatically start NVDA after I log on to Windows")) self.startAfterLogonCheckBox.Value = config.getStartAfterLogon() if globalVars.appArgs.secure or not config.isInstalledCopy(): self.startAfterLogonCheckBox.Disable() optionsSizer.Add(self.startAfterLogonCheckBox,flag=wx.TOP|wx.LEFT,border=10) # Translators: This is a label for a checkbox in welcome dialog to show welcome dialog at startup. self.showWelcomeDialogAtStartupCheckBox = wx.CheckBox(self, wx.ID_ANY, _("Show this dialog when NVDA starts")) self.showWelcomeDialogAtStartupCheckBox.SetValue(config.conf["general"]["showWelcomeDialogAtStartup"]) optionsSizer.Add(self.showWelcomeDialogAtStartupCheckBox,flag=wx.TOP|wx.LEFT,border=10) mainSizer.Add(optionsSizer,flag=wx.LEFT|wx.TOP|wx.RIGHT,border=20) mainSizer.Add(self.CreateButtonSizer(wx.OK),flag=wx.TOP|wx.BOTTOM|wx.ALIGN_CENTER_HORIZONTAL,border=20) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) self.SetSizer(mainSizer) mainSizer.Fit(self) self.capsAsNVDAModifierCheckBox.SetFocus() self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
def checkForUpdate(auto=False): """Check for an updated version of NVDA. This will block, so it generally shouldn't be called from the main thread. @param auto: Whether this is an automatic check for updates. @type auto: bool @return: Information about the update or C{None} if there is no update. @rtype: dict @raise RuntimeError: If there is an error checking for an update. """ winVer = sys.getwindowsversion() params = { "autoCheck": auto, "version": versionInfo.version, "versionType": versionInfo.updateVersionType, "osVersion": "{v.major}.{v.minor}.{v.build} {v.service_pack}".format(v=winVer), "x64": os.environ.get("PROCESSOR_ARCHITEW6432") == "AMD64", "language": languageHandler.getLanguage(), "installed": config.isInstalledCopy(), } res = urllib.urlopen("%s?%s" % (CHECK_URL, urllib.urlencode(params))) if res.code != 200: raise RuntimeError("Checking for update failed with code %d" % res.code) info = {} for line in res: line = line.rstrip() try: key, val = line.split(": ", 1) except ValueError: raise RuntimeError("Error in update check output") info[key] = val if not info: return None return info
def __init__(self, parent): # Translators: The title of the Welcome dialog when user starts NVDA for the first time. super().__init__(parent, wx.ID_ANY, _("Welcome to NVDA")) WelcomeDialog._instances.add(self) mainSizer = wx.BoxSizer(wx.VERTICAL) # Translators: The header for the Welcome dialog when user starts NVDA for the first time. # This is in larger, bold lettering welcomeTextHeader = wx.StaticText(self, label=_("Welcome to NVDA!")) welcomeTextHeader.SetFont(wx.Font(18, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD)) mainSizer.AddSpacer(gui.guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS) mainSizer.Add(welcomeTextHeader, border=20, flag=wx.EXPAND | wx.LEFT | wx.RIGHT) mainSizer.AddSpacer(gui.guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS) welcomeTextDetail = wx.StaticText(self, wx.ID_ANY, self.WELCOME_MESSAGE_DETAIL) mainSizer.Add(welcomeTextDetail, border=20, flag=wx.EXPAND | wx.LEFT | wx.RIGHT) # Translators: The label for a group box containing the NVDA welcome dialog options. optionsLabel = _("Options") optionsSizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=optionsLabel) optionsBox = optionsSizer.GetStaticBox() sHelper = gui.guiHelper.BoxSizerHelper(self, sizer=optionsSizer) # Translators: The label of a combobox in the Welcome dialog. kbdLabelText = _("&Keyboard layout:") layouts = keyboardHandler.KeyboardInputGesture.LAYOUTS self.kbdNames = sorted(layouts) kbdChoices = [layouts[layout] for layout in self.kbdNames] self.kbdList = sHelper.addLabeledControl(kbdLabelText, wx.Choice, choices=kbdChoices) try: index = self.kbdNames.index(config.conf["keyboard"]["keyboardLayout"]) self.kbdList.SetSelection(index) except (ValueError, KeyError): log.error("Could not set Keyboard layout list to current layout", exc_info=True) # Translators: The label of a checkbox in the Welcome dialog. capsAsNVDAModifierText = _("&Use CapsLock as an NVDA modifier key") self.capsAsNVDAModifierCheckBox = sHelper.addItem(wx.CheckBox(optionsBox, label=capsAsNVDAModifierText)) self.capsAsNVDAModifierCheckBox.SetValue(config.conf["keyboard"]["useCapsLockAsNVDAModifierKey"]) # Translators: The label of a checkbox in the Welcome dialog. startAfterLogonText = _("St&art NVDA after I sign in") self.startAfterLogonCheckBox = sHelper.addItem(wx.CheckBox(optionsBox, label=startAfterLogonText)) self.startAfterLogonCheckBox.Value = config.getStartAfterLogon() if globalVars.appArgs.secure or config.isAppX or not config.isInstalledCopy(): self.startAfterLogonCheckBox.Disable() # Translators: The label of a checkbox in the Welcome dialog. showWelcomeDialogAtStartupText = _("&Show this dialog when NVDA starts") _showWelcomeDialogAtStartupCheckBox = wx.CheckBox(optionsBox, label=showWelcomeDialogAtStartupText) self.showWelcomeDialogAtStartupCheckBox = sHelper.addItem(_showWelcomeDialogAtStartupCheckBox) self.showWelcomeDialogAtStartupCheckBox.SetValue(config.conf["general"]["showWelcomeDialogAtStartup"]) mainSizer.Add(optionsSizer, border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Add( self.CreateButtonSizer(wx.OK), border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL | wx.ALIGN_RIGHT ) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) mainSizer.Fit(self) self.SetSizer(mainSizer) self.kbdList.SetFocus() self.CentreOnScreen()
def isAudioDuckingSupported(): global _isAudioDuckingSupported if _isAudioDuckingSupported is None: _isAudioDuckingSupported = ( config.isInstalledCopy() or config.isAppX ) and hasattr(oledll.oleacc, 'AccSetRunningUtilityState') return _isAudioDuckingSupported
def checkForUpdate(auto=False): """Check for an updated version of NVDA. This will block, so it generally shouldn't be called from the main thread. @param auto: Whether this is an automatic check for updates. @type auto: bool @return: Information about the update or C{None} if there is no update. @rtype: dict @raise RuntimeError: If there is an error checking for an update. """ allowUsageStats=config.conf["update"]['allowUsageStats'] params = { "autoCheck": auto, "allowUsageStats":allowUsageStats, "version": versionInfo.version, "versionType": versionInfo.updateVersionType, "osVersion": winVersion.winVersionText, "x64": os.environ.get("PROCESSOR_ARCHITEW6432") == "AMD64", } if auto and allowUsageStats: synthDriverClass = synthDriverHandler.getSynth().__class__ brailleDisplayClass = braille.handler.display.__class__ if braille.handler else None # Following are parameters sent purely for stats gathering. # If new parameters are added here, they must be documented in the userGuide for transparency. extraParams={ "language": languageHandler.getLanguage(), "installed": config.isInstalledCopy(), "synthDriver":getQualifiedDriverClassNameForStats(synthDriverClass) if synthDriverClass else None, "brailleDisplay":getQualifiedDriverClassNameForStats(brailleDisplayClass) if brailleDisplayClass else None, "outputBrailleTable":config.conf['braille']['translationTable'] if brailleDisplayClass else None, } params.update(extraParams) url = "%s?%s" % (CHECK_URL, urllib.parse.urlencode(params)) try: res = urllib.request.urlopen(url) except IOError as e: if isinstance(e.strerror, ssl.SSLError) and e.strerror.reason == "CERTIFICATE_VERIFY_FAILED": # #4803: Windows fetches trusted root certificates on demand. # Python doesn't trigger this fetch (PythonIssue:20916), so try it ourselves _updateWindowsRootCertificates() # and then retry the update check. res = urllib.request.urlopen(url) else: raise if res.code != 200: raise RuntimeError("Checking for update failed with code %d" % res.code) info = {} for line in res: # #9819: update description resource returns bytes, so make it Unicode. line = line.decode("utf-8").rstrip() try: key, val = line.split(": ", 1) except ValueError: raise RuntimeError("Error in update check output") info[key] = val if not info: return None return info
def __init__(self, parent): # Translators: The title of the Welcome dialog when user starts NVDA for the first time. super(WelcomeDialog, self).__init__(parent, wx.ID_ANY, _("Welcome to NVDA")) mainSizer=wx.BoxSizer(wx.VERTICAL) # Translators: The header for the Welcome dialog when user starts NVDA for the first time. This is in larger, # bold lettering welcomeTextHeader = wx.StaticText(self, label=_("Welcome to NVDA!")) welcomeTextHeader.SetFont(wx.Font(18, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.BOLD)) mainSizer.AddSpacer(guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS) mainSizer.Add(welcomeTextHeader,border=20,flag=wx.EXPAND|wx.LEFT|wx.RIGHT) mainSizer.AddSpacer(guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS) welcomeTextDetail = wx.StaticText(self, wx.ID_ANY, self.WELCOME_MESSAGE_DETAIL) mainSizer.Add(welcomeTextDetail,border=20,flag=wx.EXPAND|wx.LEFT|wx.RIGHT) optionsSizer = wx.StaticBoxSizer( wx.StaticBox( self, # Translators: The label for a group box containing the NVDA welcome dialog options. label=_("Options") ), wx.VERTICAL ) sHelper = guiHelper.BoxSizerHelper(self, sizer=optionsSizer) # Translators: The label of a combobox in the Welcome dialog. kbdLabelText = _("&Keyboard layout:") layouts = keyboardHandler.KeyboardInputGesture.LAYOUTS self.kbdNames = sorted(layouts) kbdChoices = [layouts[layout] for layout in self.kbdNames] self.kbdList = sHelper.addLabeledControl(kbdLabelText, wx.Choice, choices=kbdChoices) try: index = self.kbdNames.index(config.conf["keyboard"]["keyboardLayout"]) self.kbdList.SetSelection(index) except: log.error("Could not set Keyboard layout list to current layout",exc_info=True) # Translators: The label of a checkbox in the Welcome dialog. capsAsNVDAModifierText = _("&Use CapsLock as an NVDA modifier key") self.capsAsNVDAModifierCheckBox = sHelper.addItem(wx.CheckBox(self, label=capsAsNVDAModifierText)) self.capsAsNVDAModifierCheckBox.SetValue(config.conf["keyboard"]["useCapsLockAsNVDAModifierKey"]) # Translators: The label of a checkbox in the Welcome dialog. startAfterLogonText = _("&Automatically start NVDA after I log on to Windows") self.startAfterLogonCheckBox = sHelper.addItem(wx.CheckBox(self, label=startAfterLogonText)) self.startAfterLogonCheckBox.Value = config.getStartAfterLogon() if globalVars.appArgs.secure or config.isAppX or not config.isInstalledCopy(): self.startAfterLogonCheckBox.Disable() # Translators: The label of a checkbox in the Welcome dialog. showWelcomeDialogAtStartupText = _("&Show this dialog when NVDA starts") self.showWelcomeDialogAtStartupCheckBox = sHelper.addItem(wx.CheckBox(self, label=showWelcomeDialogAtStartupText)) self.showWelcomeDialogAtStartupCheckBox.SetValue(config.conf["general"]["showWelcomeDialogAtStartup"]) mainSizer.Add(optionsSizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Add(self.CreateButtonSizer(wx.OK), border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL|wx.ALIGN_RIGHT) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) mainSizer.Fit(self) self.SetSizer(mainSizer) self.kbdList.SetFocus() self.CentreOnScreen()
def checkForUpdate(auto=False): """Check for an updated version of NVDA. This will block, so it generally shouldn't be called from the main thread. @param auto: Whether this is an automatic check for updates. @type auto: bool @return: Information about the update or C{None} if there is no update. @rtype: dict @raise RuntimeError: If there is an error checking for an update. """ allowUsageStats=config.conf["update"]['allowUsageStats'] params = { "autoCheck": auto, "allowUsageStats":allowUsageStats, "version": versionInfo.version, "versionType": versionInfo.updateVersionType, "osVersion": winVersion.winVersionText, "x64": os.environ.get("PROCESSOR_ARCHITEW6432") == "AMD64", } if auto and allowUsageStats: synthDriverClass=speech.getSynth().__class__ brailleDisplayClass=braille.handler.display.__class__ if braille.handler else None # Following are parameters sent purely for stats gathering. # If new parameters are added here, they must be documented in the userGuide for transparency. extraParams={ "language": languageHandler.getLanguage(), "installed": config.isInstalledCopy(), "synthDriver":getQualifiedDriverClassNameForStats(synthDriverClass) if synthDriverClass else None, "brailleDisplay":getQualifiedDriverClassNameForStats(brailleDisplayClass) if brailleDisplayClass else None, "outputBrailleTable":config.conf['braille']['translationTable'] if brailleDisplayClass else None, } params.update(extraParams) url = "%s?%s" % (CHECK_URL, urllib.urlencode(params)) try: res = urllib.urlopen(url) except IOError as e: if isinstance(e.strerror, ssl.SSLError) and e.strerror.reason == "CERTIFICATE_VERIFY_FAILED": # #4803: Windows fetches trusted root certificates on demand. # Python doesn't trigger this fetch (PythonIssue:20916), so try it ourselves _updateWindowsRootCertificates() # and then retry the update check. res = urllib.urlopen(url) else: raise if res.code != 200: raise RuntimeError("Checking for update failed with code %d" % res.code) info = {} for line in res: line = line.rstrip() try: key, val = line.split(": ", 1) except ValueError: raise RuntimeError("Error in update check output") info[key] = val if not info: return None return info
def paramsDL(): return { "versionProtocole": "1.4", "versionAddon": configBE._addonVersion, "versionNVDA": versionInfo.version, "language": languageHandler.getLanguage(), "installed": config.isInstalledCopy(), "brailledisplay": braille.handler.display.name, "channel": configBE.conf['general']['channelUpdate'] } def checkUpdates(sil = False):
def __init__(self, parent, updateInfo, auto): # Translators: The title of the dialog informing the user about an NVDA update. super(UpdateResultDialog, self).__init__(parent, title=_("NVDA Update")) self.updateInfo = updateInfo mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) if updateInfo: self.isInstalled = config.isInstalledCopy() if isPendingUpdate() and state["pendingUpdateVersion"] == updateInfo["version"]: # 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) 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) else: # Translators: A message indicating that no update to NVDA is available. message = _("No update available.") sHelper.addItem(wx.StaticText(self, label=message)) bHelper = sHelper.addDialogDismissButtons(guiHelper.ButtonHelper(wx.HORIZONTAL)) if updateInfo: if isPendingUpdate() and state["pendingUpdateVersion"] == updateInfo["version"]: # Translators: The label of a button to install a pending NVDA update. # {version} will be replaced with the version; e.g. 2011.3. installPendingButton = bHelper.addButton(self, label=_("&Install NVDA {version}").format(**updateInfo)) installPendingButton.Bind(wx.EVT_BUTTON, self.onInstallButton) # Translators: The label of a button to re-download a pending NVDA update. label = _("Re-&download update") else: # Translators: The label of a button to download an NVDA update. label = _("&Download update") downloadButton = bHelper.addButton(self, label=label) downloadButton.Bind(wx.EVT_BUTTON, self.onDownloadButton) if auto and (not isPendingUpdate() or state["pendingUpdateVersion"] != updateInfo["version"]): # 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() # 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()
def __init__(self, parent, updateInfo, auto): # Translators: The title of the dialog informing the user about an NVDA update. super(UpdateResultDialog, self).__init__(parent, title=_("NVDA Update")) self.updateInfo = updateInfo mainSizer = wx.BoxSizer(wx.VERTICAL) sHelper = guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) if updateInfo: self.isInstalled = config.isInstalledCopy() self.urls = updateInfo["launcherUrl"].split(" ") self.fileHash = updateInfo.get("launcherHash") # 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) else: # Translators: A message indicating that no update to NVDA is available. message = _("No update available.") sHelper.addItem(wx.StaticText(self, label=message)) bHelper = sHelper.addDialogDismissButtons( guiHelper.ButtonHelper(wx.HORIZONTAL)) if updateInfo: if self.isInstalled: # Translators: The label of a button to download and install an NVDA update. label = _("Download and &install update") else: # Translators: The label of a button to download an NVDA update. label = _("&Download update") downloadButton = bHelper.addButton(self, label=label) downloadButton.Bind(wx.EVT_BUTTON, self.onDownloadButton) if auto: # 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() # 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.Center(wx.BOTH | wx.CENTER_ON_SCREEN) self.Show()
def paramsDL(): return { "versionProtocole": "2.0", "versionAddon": configBE._addonVersion, "versionNVDA": versionInfo.version, "language": languageHandler.getLanguage(), "installed": config.isInstalledCopy(), "brailledisplay": braille.handler.display.name, "channel": config.conf["brailleExtender"]["updateChannel"] } def checkUpdates(sil = False):
def cap_touch(): if not config.isInstalledCopy(): log.debugWarning("Touch only supported on installed copies") return False if (winVersion.winVersion.major*10+winVersion.winVersion.minor)<62: log.debugWarning("Touch only supported on Windows 8 and higher") return False maxTouches=windll.user32.GetSystemMetrics(95) #maximum touches if maxTouches<=0: log.debugWarning("No touch devices found") return False return True
def touchSupported(): """Returns if the system and current NVDA session supports touchscreen interaction. """ if not config.isInstalledCopy(): log.debugWarning("Touch only supported on installed copies") return False if (winVersion.winVersion.major*10+winVersion.winVersion.minor)<62: log.debugWarning("Touch only supported on Windows 8 and higher") return False maxTouches=windll.user32.GetSystemMetrics(SM_MAXIMUMTOUCHES) if maxTouches<=0: log.debugWarning("No touch devices found") return False return True
def touchSupported(): """Returns if the system and current NVDA session supports touchscreen interaction. """ if not config.isInstalledCopy(): log.debugWarning("Touch only supported on installed copies") return False if (winVersion.winVersion.major * 10 + winVersion.winVersion.minor) < 62: log.debugWarning("Touch only supported on Windows 8 and higher") return False maxTouches = windll.user32.GetSystemMetrics(SM_MAXIMUMTOUCHES) if maxTouches <= 0: log.debugWarning("No touch devices found") return False return True
def initialize(): global handler if not config.isInstalledCopy(): log.debugWarning("Touch only supported on installed copies") raise NotImplementedError if (winVersion.winVersion.major*10+winVersion.winVersion.minor)<62: log.debugWarning("Touch only supported on Windows 8 and higher") raise NotImplementedError maxTouches=windll.user32.GetSystemMetrics(95) #maximum touches if maxTouches<=0: log.debugWarning("No touch devices found") raise NotImplementedError handler=TouchHandler() log.debug("Touch support initialized. maximum touch inputs: %d"%maxTouches)
def event_gainFocus(self, obj, nextHandler): # Crucial: Don't do anything unless if it is an installed copy and touchscreen support is active. if config.isInstalledCopy() and touchHandler.handler: # From 2015 onwards, browse mode module is used. if isinstance(obj.treeInterceptor, browseMode.BrowseModeTreeInterceptor) and "Web" not in touchHandler.availableTouchModes: touchHandler.availableTouchModes.append("Web") # Web browsing gestures. else: # If we're not in browser window, force object mode. if "Web" not in touchHandler.availableTouchModes: touchHandler.handler._curTouchMode = touchHandler.availableTouchModes[1] else: curAvailTouchModes = len(touchHandler.availableTouchModes) # If we have too many touch modes, pop all except the original entries. if curAvailTouchModes > self.origAvailTouchModes: for i in range(0, curAvailTouchModes-self.origAvailTouchModes): touchHandler.availableTouchModes.pop() nextHandler()
def initialize(): global handler if not config.isInstalledCopy(): log.debugWarning("Touch only supported on installed copies") raise NotImplementedError if (winVersion.winVersion.major * 10 + winVersion.winVersion.minor) < 62: log.debugWarning("Touch only supported on Windows 8 and higher") raise NotImplementedError maxTouches = windll.user32.GetSystemMetrics(95) #maximum touches if maxTouches <= 0: log.debugWarning("No touch devices found") raise NotImplementedError handler = TouchHandler() log.debug("Touch support initialized. maximum touch inputs: %d" % maxTouches)
def __init__(self, parent, updateInfo, auto): # Translators: The title of the dialog informing the user about an NVDA update. super(UpdateResultDialog, self).__init__(parent, title=_("NVDA Update")) self.updateInfo = updateInfo mainSizer = wx.BoxSizer(wx.VERTICAL) if updateInfo: self.isInstalled = config.isInstalledCopy() self.urls = updateInfo["launcherUrl"].split(" ") self.fileHash = updateInfo.get("launcherHash") # 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) else: # Translators: A message indicating that no update to NVDA is available. message = _("No update available.") mainSizer.Add(wx.StaticText(self, label=message)) if updateInfo: if self.isInstalled: # Translators: The label of a button to download and install an NVDA update. label = _("Download and &install update") else: # Translators: The label of a button to download an NVDA update. label = _("&Download update") item = wx.Button(self, label=label) item.Bind(wx.EVT_BUTTON, self.onDownloadButton) mainSizer.Add(item) if auto: # Translators: The label of a button to remind the user later about performing some action. item = wx.Button(self, label=_("Remind me &later")) item.Bind(wx.EVT_BUTTON, self.onLaterButton) mainSizer.Add(item) item.SetFocus() # Translators: The label of a button to close a dialog. item = wx.Button(self, wx.ID_CLOSE, label=_("&Close")) item.Bind(wx.EVT_BUTTON, lambda evt: self.Close()) mainSizer.Add(item) self.Bind(wx.EVT_CLOSE, lambda evt: self.Destroy()) self.EscapeId = wx.ID_CLOSE self.Sizer = mainSizer mainSizer.Fit(self) self.Center(wx.BOTH | wx.CENTER_ON_SCREEN) self.Show()
def __init__(self, parent, updateInfo, auto): # Translators: The title of the dialog informing the user about an NVDA update. super(UpdateResultDialog, self).__init__(parent, title=_("NVDA Update")) self.updateInfo = updateInfo mainSizer = wx.BoxSizer(wx.VERTICAL) if updateInfo: self.isInstalled = config.isInstalledCopy() self.urls = updateInfo["launcherUrl"].split(" ") # 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) else: # Translators: A message indicating that no update to NVDA is available. message = _("No update available.") mainSizer.Add(wx.StaticText(self, label=message)) if updateInfo: if self.isInstalled: # Translators: The label of a button to download and install an NVDA update. label = _("Download and &install update") else: # Translators: The label of a button to download an NVDA update. label = _("&Download update") item = wx.Button(self, label=label) item.Bind(wx.EVT_BUTTON, self.onDownloadButton) mainSizer.Add(item) if auto: # Translators: The label of a button to remind the user later about performing some action. item = wx.Button(self, label=_("Remind me &later")) item.Bind(wx.EVT_BUTTON, self.onLaterButton) mainSizer.Add(item) item.SetFocus() # Translators: The label of a button to close a dialog. item = wx.Button(self, wx.ID_CLOSE, label=_("&Close")) item.Bind(wx.EVT_BUTTON, lambda evt: self.Close()) mainSizer.Add(item) self.Bind(wx.EVT_CLOSE, lambda evt: self.Destroy()) self.EscapeId = wx.ID_CLOSE self.Sizer = mainSizer mainSizer.Fit(self) self.Show()
def checkForUpdate(auto=False): """Check for an updated version of NVDA. This will block, so it generally shouldn't be called from the main thread. @param auto: Whether this is an automatic check for updates. @type auto: bool @return: Information about the update or C{None} if there is no update. @rtype: dict @raise RuntimeError: If there is an error checking for an update. """ params = { "autoCheck": auto, "version": versionInfo.version, "versionType": versionInfo.updateVersionType, "osVersion": winVersion.winVersionText, "x64": os.environ.get("PROCESSOR_ARCHITEW6432") == "AMD64", "language": languageHandler.getLanguage(), "installed": config.isInstalledCopy(), } url = "%s?%s" % (CHECK_URL, urllib.urlencode(params)) try: res = urllib.urlopen(url) except IOError as e: if isinstance(e.strerror, ssl.SSLError ) and e.strerror.reason == "CERTIFICATE_VERIFY_FAILED": # #4803: Windows fetches trusted root certificates on demand. # Python doesn't trigger this fetch (PythonIssue:20916), so try it ourselves _updateWindowsRootCertificates() # and then retry the update check. res = urllib.urlopen(url) else: raise if res.code != 200: raise RuntimeError("Checking for update failed with code %d" % res.code) info = {} for line in res: line = line.rstrip() try: key, val = line.split(": ", 1) except ValueError: raise RuntimeError("Error in update check output") info[key] = val if not info: return None return info
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))
def touchSupported(debugLog: bool = False): """Returns if the system and current NVDA session supports touchscreen interaction. @param debugLog: Whether to log additional details about touch support to the NVDA log. """ if not config.isInstalledCopy() and not config.isAppX: if debugLog: log.debugWarning("Touch only supported on installed copies") return False if winVersion.getWinVer() < winVersion.WIN8: if debugLog: log.debugWarning("Touch only supported on Windows 8 and higher") return False maxTouches = windll.user32.GetSystemMetrics(SM_MAXIMUMTOUCHES) if maxTouches <= 0: if debugLog: log.debugWarning("No touch devices found") return False return True
def _executeUpdate(destPath): if not destPath: return _setStateToNone(state) saveState() if config.isInstalledCopy(): executeParams = u"--install -m" else: portablePath = os.getcwd() if os.access(portablePath, os.W_OK): executeParams = u'--create-portable --portable-path "{portablePath}" --config-path "{configPath}" -m'.format( portablePath=portablePath, configPath=os.path.abspath(globalVars.appArgs.configPath)) else: executeParams = u"--launcher" # #4475: ensure that the new process shows its first window, by providing SW_SHOWNORMAL shellapi.ShellExecute(None, None, destPath, executeParams, None, winUser.SW_SHOWNORMAL)
def checkForUpdate(auto=False): """Check for an updated version of NVDA. This will block, so it generally shouldn't be called from the main thread. @param auto: Whether this is an automatic check for updates. @type auto: bool @return: Information about the update or C{None} if there is no update. @rtype: dict @raise RuntimeError: If there is an error checking for an update. """ params = { "autoCheck": auto, "version": versionInfo.version, "versionType": versionInfo.updateVersionType, "osVersion": winVersion.winVersionText, "x64": os.environ.get("PROCESSOR_ARCHITEW6432") == "AMD64", "language": languageHandler.getLanguage(), "installed": config.isInstalledCopy(), } url = "%s?%s" % (CHECK_URL, urllib.urlencode(params)) try: res = urllib.urlopen(url) except IOError as e: if isinstance(e.strerror, ssl.SSLError) and e.strerror.reason == "CERTIFICATE_VERIFY_FAILED": # #4803: Windows fetches trusted root certificates on demand. # Python doesn't trigger this fetch (PythonIssue:20916), so try it ourselves _updateWindowsRootCertificates() # and then retry the update check. res = urllib.urlopen(url) else: raise if res.code != 200: raise RuntimeError("Checking for update failed with code %d" % res.code) info = {} for line in res: line = line.rstrip() try: key, val = line.split(": ", 1) except ValueError: raise RuntimeError("Error in update check output") info[key] = val if not info: return None return info
def terminate(self): self.disconnect() self.local_machine = None self.menu.RemoveItem(self.connect_item) self.connect_item.Destroy() self.connect_item=None self.menu.RemoveItem(self.disconnect_item) self.disconnect_item.Destroy() self.disconnect_item=None self.menu.RemoveItem(self.mute_item) self.mute_item.Destroy() self.mute_item=None self.menu.RemoveItem(self.push_clipboard_item) self.push_clipboard_item.Destroy() self.push_clipboard_item=None self.menu.RemoveItem(self.copy_link_item) self.copy_link_item.Destroy() self.copy_link_item = None self.menu.RemoveItem(self.options_item) self.options_item.Destroy() self.options_item=None self.menu.RemoveItem(self.send_ctrl_alt_del_item) self.send_ctrl_alt_del_item.Destroy() self.send_ctrl_alt_del_item=None tools_menu = gui.mainFrame.sysTrayIcon.toolsMenu tools_menu.RemoveItem(self.remote_item) self.remote_item.Destroy() self.remote_item=None try: self.menu.Destroy() except (RuntimeError, AttributeError): pass try: os.unlink(self.ipc_file) except: pass self.menu=None if not isInstalledCopy(): url_handler.unregister_url_handler() self.url_handler_window.destroy() self.url_handler_window=None
def terminate(self): self.disconnect() self.local_machine = None self.menu.Remove(self.connect_item.Id) self.connect_item.Destroy() self.connect_item = None self.menu.Remove(self.disconnect_item.Id) self.disconnect_item.Destroy() self.disconnect_item = None self.menu.Remove(self.mute_item.Id) self.mute_item.Destroy() self.mute_item = None self.menu.Remove(self.push_clipboard_item.Id) self.push_clipboard_item.Destroy() self.push_clipboard_item = None self.menu.Remove(self.copy_link_item.Id) self.copy_link_item.Destroy() self.copy_link_item = None self.menu.Remove(self.options_item.Id) self.options_item.Destroy() self.options_item = None self.menu.Remove(self.send_ctrl_alt_del_item.Id) self.send_ctrl_alt_del_item.Destroy() self.send_ctrl_alt_del_item = None tools_menu = gui.mainFrame.sysTrayIcon.toolsMenu tools_menu.Remove(self.remote_item.Id) self.remote_item.Destroy() self.remote_item = None try: self.menu.Destroy() except (RuntimeError, AttributeError): pass try: os.unlink(self.ipc_file) except: pass self.menu = None if not isInstalledCopy(): url_handler.unregister_url_handler() self.url_handler_window.destroy() self.url_handler_window = None
def executeUpdate(destPath=None): if not destPath: destPath = getPendingUpdate() if not destPath: return state["pendingUpdateFile"] = None state["pendingUpdateVersion"] = None saveState() if config.isInstalledCopy(): executeParams = u"--install -m" else: portablePath = os.getcwdu() if os.access(portablePath, os.W_OK): executeParams = u'--create-portable --portable-path "{portablePath}" --config-path "{configPath}" -m'.format( portablePath=portablePath, configPath=os.path.abspath(globalVars.appArgs.configPath)) else: executeParams = u"--launcher" # #4475: ensure that the new process shows its first window, by providing SW_SHOWNORMAL shellapi.ShellExecute(None, None, destPath.decode("mbcs"), executeParams, None, winUser.SW_SHOWNORMAL)
def _executeUpdate(destPath): if not destPath: return _setStateToNone(state) saveState() if config.isInstalledCopy(): executeParams = u"--install -m" else: portablePath = os.getcwdu() if os.access(portablePath, os.W_OK): executeParams = u'--create-portable --portable-path "{portablePath}" --config-path "{configPath}" -m'.format( portablePath=portablePath, configPath=os.path.abspath(globalVars.appArgs.configPath) ) else: executeParams = u"--launcher" # #4475: ensure that the new process shows its first window, by providing SW_SHOWNORMAL shellapi.ShellExecute(None, None, destPath.decode("mbcs"), executeParams, None, winUser.SW_SHOWNORMAL)
def event_gainFocus(self, obj, nextHandler): # Crucial: Don't do anything unless if it is an installed copy and touchscreen support is active. if config.isInstalledCopy() and touchHandler.handler: # From 2015 onwards, browse mode module is used. if (isinstance(obj.treeInterceptor, browseMode.BrowseModeTreeInterceptor) and "Web" not in touchHandler.availableTouchModes): touchHandler.availableTouchModes.append("Web") else: # If we're not in browser window, force object mode. if "Web" not in touchHandler.availableTouchModes: touchHandler.handler._curTouchMode = touchHandler.availableTouchModes[ 1] else: curAvailTouchModes = len(touchHandler.availableTouchModes) # If we have too many touch modes, pop all except the original entries. if curAvailTouchModes > self.origAvailTouchModes: for i in range( 0, curAvailTouchModes - self.origAvailTouchModes): touchHandler.availableTouchModes.pop() nextHandler()
def __init__(self, frame): super(SysTrayIcon, self).__init__() icon=wx.Icon(ICON_PATH,wx.BITMAP_TYPE_ICO) self.SetIcon(icon, versionInfo.name) self.menu=wx.Menu() menu_preferences=self.preferencesMenu=wx.Menu() # Translators: The label for the menu item to open general Settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&General settings..."),_("General settings")) self.Bind(wx.EVT_MENU, frame.onGeneralSettingsCommand, item) #nvdajp begin item = menu_preferences.Append(wx.ID_ANY,_("Language settings..."),_("Configure language dependent options")) self.Bind(wx.EVT_MENU, frame.onLanguageSettingsCommand, item) #nvdajp end # Translators: The label for the menu item to open Synthesizer settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Synthesizer..."),_("Change the synthesizer to be used")) self.Bind(wx.EVT_MENU, frame.onSynthesizerCommand, item) # Translators: The label for the menu item to open Voice Settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Voice settings..."),_("Choose the voice, rate, pitch and volume to use")) self.Bind(wx.EVT_MENU, frame.onVoiceCommand, item) # Translators: The label for the menu item to open Braille Settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("B&raille settings...")) self.Bind(wx.EVT_MENU, frame.onBrailleCommand, item) # Translators: The label for the menu item to open Keyboard Settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Keyboard settings..."),_("Configure keyboard layout, speaking of typed characters, words or command keys")) self.Bind(wx.EVT_MENU, frame.onKeyboardSettingsCommand, item) # Translators: The label for the menu item to open Mouse Settings dialog. item = menu_preferences.Append(wx.ID_ANY, _("&Mouse settings..."),_("Change reporting of mouse shape and object under mouse")) self.Bind(wx.EVT_MENU, frame.onMouseSettingsCommand, item) # Translators: The label for the menu item to open Review Cursor dialog. item = menu_preferences.Append(wx.ID_ANY,_("Review &cursor..."),_("Configure how and when the review cursor moves")) self.Bind(wx.EVT_MENU, frame.onReviewCursorCommand, item) # Translators: The label for the menu item to open Input Composition Settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Input composition settings..."),_("Configure how NVDA reports input composition and candidate selection for certain languages")) self.Bind(wx.EVT_MENU, frame.onInputCompositionCommand, item) # Translators: The label for the menu item to open Object Presentation dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Object presentation..."),_("Change reporting of objects")) self.Bind(wx.EVT_MENU, frame.onObjectPresentationCommand, item) # Translators: The label for the menu item to open Browse Mode settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Browse mode..."),_("Change virtual buffers specific settings")) self.Bind(wx.EVT_MENU, frame.onBrowseModeCommand, item) # Translators: The label for the menu item to open Document Formatting settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("Document &formatting..."),_("Change settings of document properties")) self.Bind(wx.EVT_MENU, frame.onDocumentFormattingCommand, item) subMenu_speechDicts = wx.Menu() if not globalVars.appArgs.secure: # Translators: The label for the menu item to open Default speech dictionary dialog. item = subMenu_speechDicts.Append(wx.ID_ANY,_("&Default dictionary..."),_("A dialog where you can set default dictionary by adding dictionary entries to the list")) self.Bind(wx.EVT_MENU, frame.onDefaultDictionaryCommand, item) # Translators: The label for the menu item to open Voice specific speech dictionary dialog. item = subMenu_speechDicts.Append(wx.ID_ANY,_("&Voice dictionary..."),_("A dialog where you can set voice-specific dictionary by adding dictionary entries to the list")) self.Bind(wx.EVT_MENU, frame.onVoiceDictionaryCommand, item) # Translators: The label for the menu item to open Temporary speech dictionary dialog. item = subMenu_speechDicts.Append(wx.ID_ANY,_("&Temporary dictionary..."),_("A dialog where you can set temporary dictionary by adding dictionary entries to the edit box")) self.Bind(wx.EVT_MENU, frame.onTemporaryDictionaryCommand, item) # Translators: The label for a submenu under NvDA Preferences menu to select speech dictionaries. menu_preferences.AppendMenu(wx.ID_ANY,_("Speech &dictionaries"),subMenu_speechDicts) if not globalVars.appArgs.secure: # Translators: The label for the menu item to open Punctuation/symbol pronunciation dialog. item = menu_preferences.Append(wx.ID_ANY, _("&Punctuation/symbol pronunciation...")) self.Bind(wx.EVT_MENU, frame.onSpeechSymbolsCommand, item) # Translators: The label for the menu item to open the Input Gestures dialog. item = menu_preferences.Append(wx.ID_ANY, _("I&nput gestures...")) self.Bind(wx.EVT_MENU, frame.onInputGesturesCommand, item) # Translators: The label for Preferences submenu in NVDA menu. self.menu.AppendMenu(wx.ID_ANY,_("&Preferences"),menu_preferences) menu_tools = self.toolsMenu = wx.Menu() if not globalVars.appArgs.secure: # Translators: The label for the menu item to open NVDA Log Viewer. item = menu_tools.Append(wx.ID_ANY, _("View log")) self.Bind(wx.EVT_MENU, frame.onViewLogCommand, item) # Translators: The label for the menu item to toggle Speech Viewer. item=self.menu_tools_toggleSpeechViewer = menu_tools.AppendCheckItem(wx.ID_ANY, _("Speech viewer")) self.Bind(wx.EVT_MENU, frame.onToggleSpeechViewerCommand, item) if not globalVars.appArgs.secure: # Translators: The label for the menu item to open NVDA Python Console. item = menu_tools.Append(wx.ID_ANY, _("Python console")) self.Bind(wx.EVT_MENU, frame.onPythonConsoleCommand, item) # Translators: The label of a menu item to open the Add-ons Manager. item = menu_tools.Append(wx.ID_ANY, _("Manage &add-ons...")) self.Bind(wx.EVT_MENU, frame.onAddonsManagerCommand, item) if not globalVars.appArgs.secure and getattr(sys,'frozen',None): # Translators: The label for the menu item to create a portable copy of NVDA from an installed or another portable version. item = menu_tools.Append(wx.ID_ANY, _("Create portable copy...")) self.Bind(wx.EVT_MENU, frame.onCreatePortableCopyCommand, item) if not config.isInstalledCopy(): # Translators: The label for the menu item to install NVDA on the computer. item = menu_tools.Append(wx.ID_ANY, _("&Install NVDA...")) self.Bind(wx.EVT_MENU, frame.onInstallCommand, item) # Translators: The label for the menu item to reload plugins. item = menu_tools.Append(wx.ID_ANY, _("Reload plugins")) self.Bind(wx.EVT_MENU, frame.onReloadPluginsCommand, item) #nvdajp begin item=self.menu_tools_toggleBrailleViewer = menu_tools.AppendCheckItem(wx.ID_ANY, _("Braille viewer")) self.Bind(wx.EVT_MENU, frame.onToggleBrailleViewerCommand, item) #nvdajp end # Translators: The label for the Tools submenu in NVDA menu. self.menu.AppendMenu(wx.ID_ANY, pgettext("nvdaMenu", "Tools"), menu_tools) menu_help = self.helpMenu = wx.Menu() #nvdajp begin if not globalVars.appArgs.secure: item = menu_help.Append(wx.ID_ANY, _("&Readme (nvdajp)")) self.Bind(wx.EVT_MENU, lambda evt: openDocFile("readmejp"), item) #nvdajp end if not globalVars.appArgs.secure: # Translators: The label of a menu item to open NVDA user guide. item = menu_help.Append(wx.ID_ANY, _("&User Guide")) self.Bind(wx.EVT_MENU, lambda evt: openDocFile("userGuide"), item) # Translators: The label of a menu item to open the Commands Quick Reference document. item = menu_help.Append(wx.ID_ANY, _("Commands &Quick Reference")) self.Bind(wx.EVT_MENU, lambda evt: openDocFile("keyCommands"), item) # Translators: The label for the menu item to open What's New document. item = menu_help.Append(wx.ID_ANY, _("What's &new")) self.Bind(wx.EVT_MENU, lambda evt: openDocFile("changes"), item) item = menu_help.Append(wx.ID_ANY, _("NVDA &web site")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile("http://www.nvda-project.org/"), item) # Translators: The label for the menu item to view NVDA License document. item = menu_help.Append(wx.ID_ANY, _("L&icense")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("copying.txt", False)), item) # Translators: The label for the menu item to view NVDA Contributors list document. item = menu_help.Append(wx.ID_ANY, _("C&ontributors")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("contributors.txt", False)), item) # Translators: The label for the menu item to open NVDA Welcome Dialog. item = menu_help.Append(wx.ID_ANY, _("We&lcome dialog...")) self.Bind(wx.EVT_MENU, lambda evt: WelcomeDialog.run(), item) menu_help.AppendSeparator() if updateCheck: # Translators: The label of a menu item to manually check for an updated version of NVDA. item = menu_help.Append(wx.ID_ANY, _("&Check for update...")) self.Bind(wx.EVT_MENU, frame.onCheckForUpdateCommand, item) # Translators: The label for the menu item to open About dialog to get information about NVDA. item = menu_help.Append(wx.ID_ABOUT, _("About..."), _("About NVDA")) self.Bind(wx.EVT_MENU, frame.onAboutCommand, item) # Translators: The label for the Help submenu in NVDA menu. self.menu.AppendMenu(wx.ID_ANY,_("&Help"),menu_help) self.menu.AppendSeparator() # Translators: The label for the menu item to open the Configuration Profiles dialog. item = self.menu.Append(wx.ID_ANY, _("&Configuration profiles...")) self.Bind(wx.EVT_MENU, frame.onConfigProfilesCommand, item) # Translators: The label for the menu item to revert to saved configuration. item = self.menu.Append(wx.ID_ANY, _("&Revert to saved configuration"),_("Reset all settings to saved state")) self.Bind(wx.EVT_MENU, frame.onRevertToSavedConfigurationCommand, item) if not globalVars.appArgs.secure: # Translators: The label for the menu item to reset settings to default settings. # Here, default settings means settings that were there when the user first used NVDA. item = self.menu.Append(wx.ID_ANY, _("&Reset configuration to factory defaults"),_("Reset all settings to default state")) self.Bind(wx.EVT_MENU, frame.onRevertToDefaultConfigurationCommand, item) # Translators: The label for the menu item to save current settings. item = self.menu.Append(wx.ID_SAVE, _("&Save configuration"), _("Write the current configuration to nvda.ini")) self.Bind(wx.EVT_MENU, frame.onSaveConfigurationCommand, item) if not globalVars.appArgs.secure: self.menu.AppendSeparator() # Translators: The label for the menu item to open donate page. item = self.menu.Append(wx.ID_ANY, _("Donate")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(DONATE_URL), item) self.menu.AppendSeparator() item = self.menu.Append(wx.ID_EXIT, _("E&xit"),_("Exit NVDA")) self.Bind(wx.EVT_MENU, frame.onExitCommand, item) self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.onActivate) self.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, self.onActivate)
def __init__(self, frame): super(SysTrayIcon, self).__init__() icon=wx.Icon(ICON_PATH,wx.BITMAP_TYPE_ICO) self.SetIcon(icon, versionInfo.name) self.menu=wx.Menu() menu_preferences=self.preferencesMenu=wx.Menu() item = menu_preferences.Append(wx.ID_ANY, # Translators: The label for the menu item to open NVDA Settings dialog. _("&Settings..."), # Translators: The description for the menu item to open NVDA Settings dialog. _("NVDA settings")) self.Bind(wx.EVT_MENU, frame.onNVDASettingsCommand, item) subMenu_speechDicts = wx.Menu() if not globalVars.appArgs.secure: item = subMenu_speechDicts.Append( wx.ID_ANY, # Translators: The label for the menu item to open Default speech dictionary dialog. _("&Default dictionary..."), # Translators: The help text for the menu item to open Default speech dictionary dialog. _("A dialog where you can set default dictionary by adding dictionary entries to the list") ) self.Bind(wx.EVT_MENU, frame.onDefaultDictionaryCommand, item) item = subMenu_speechDicts.Append( wx.ID_ANY, # Translators: The label for the menu item to open Voice specific speech dictionary dialog. _("&Voice dictionary..."), _( # Translators: The help text for the menu item # to open Voice specific speech dictionary dialog. "A dialog where you can set voice-specific dictionary by adding" " dictionary entries to the list" ) ) self.Bind(wx.EVT_MENU, frame.onVoiceDictionaryCommand, item) item = subMenu_speechDicts.Append( wx.ID_ANY, # Translators: The label for the menu item to open Temporary speech dictionary dialog. _("&Temporary dictionary..."), # Translators: The help text for the menu item to open Temporary speech dictionary dialog. _("A dialog where you can set temporary dictionary by adding dictionary entries to the edit box") ) self.Bind(wx.EVT_MENU, frame.onTemporaryDictionaryCommand, item) # Translators: The label for a submenu under NvDA Preferences menu to select speech dictionaries. menu_preferences.AppendSubMenu(subMenu_speechDicts,_("Speech &dictionaries")) if not globalVars.appArgs.secure: # Translators: The label for the menu item to open Punctuation/symbol pronunciation dialog. item = menu_preferences.Append(wx.ID_ANY, _("&Punctuation/symbol pronunciation...")) self.Bind(wx.EVT_MENU, frame.onSpeechSymbolsCommand, item) # Translators: The label for the menu item to open the Input Gestures dialog. item = menu_preferences.Append(wx.ID_ANY, _("I&nput gestures...")) self.Bind(wx.EVT_MENU, frame.onInputGesturesCommand, item) # Translators: The label for Preferences submenu in NVDA menu. self.menu.AppendSubMenu(menu_preferences,_("&Preferences")) menu_tools = self.toolsMenu = wx.Menu() if not globalVars.appArgs.secure: # Translators: The label for the menu item to open NVDA Log Viewer. item = menu_tools.Append(wx.ID_ANY, _("View log")) self.Bind(wx.EVT_MENU, frame.onViewLogCommand, item) # Translators: The label for the menu item to toggle Speech Viewer. item=self.menu_tools_toggleSpeechViewer = menu_tools.AppendCheckItem(wx.ID_ANY, _("Speech viewer")) self.Bind(wx.EVT_MENU, frame.onToggleSpeechViewerCommand, item) self.menu_tools_toggleBrailleViewer: wx.MenuItem = menu_tools.AppendCheckItem( wx.ID_ANY, # Translators: The label for the menu item to toggle Braille Viewer. _("Braille viewer") ) item = self.menu_tools_toggleBrailleViewer self.Bind(wx.EVT_MENU, frame.onToggleBrailleViewerCommand, item) import brailleViewer self.menu_tools_toggleBrailleViewer.Check(brailleViewer.isBrailleViewerActive()) brailleViewer.postBrailleViewerToolToggledAction.register(frame.onBrailleViewerChangedState) if not globalVars.appArgs.secure and not config.isAppX: # Translators: The label for the menu item to open NVDA Python Console. item = menu_tools.Append(wx.ID_ANY, _("Python console")) self.Bind(wx.EVT_MENU, frame.onPythonConsoleCommand, item) # Translators: The label of a menu item to open the Add-ons Manager. item = menu_tools.Append(wx.ID_ANY, _("Manage &add-ons...")) self.Bind(wx.EVT_MENU, frame.onAddonsManagerCommand, item) if not globalVars.appArgs.secure and not config.isAppX and getattr(sys,'frozen',None): # Translators: The label for the menu item to create a portable copy of NVDA from an installed or another portable version. item = menu_tools.Append(wx.ID_ANY, _("Create portable copy...")) self.Bind(wx.EVT_MENU, frame.onCreatePortableCopyCommand, item) if not config.isInstalledCopy(): # Translators: The label for the menu item to install NVDA on the computer. item = menu_tools.Append(wx.ID_ANY, _("&Install NVDA...")) self.Bind(wx.EVT_MENU, frame.onInstallCommand, item) # Translators: The label for the menu item to run the COM registration fix tool item = menu_tools.Append(wx.ID_ANY, _("Run COM Registration Fixing tool...")) self.Bind(wx.EVT_MENU, frame.onRunCOMRegistrationFixesCommand, item) if not config.isAppX: # Translators: The label for the menu item to reload plugins. item = menu_tools.Append(wx.ID_ANY, _("Reload plugins")) self.Bind(wx.EVT_MENU, frame.onReloadPluginsCommand, item) # Translators: The label for the Tools submenu in NVDA menu. self.menu.AppendSubMenu(menu_tools,_("Tools")) menu_help = self.helpMenu = wx.Menu() if not globalVars.appArgs.secure: # Translators: The label of a menu item to open NVDA user guide. item = menu_help.Append(wx.ID_ANY, _("&User Guide")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("userGuide.html")), item) # Translators: The label of a menu item to open the Commands Quick Reference document. item = menu_help.Append(wx.ID_ANY, _("Commands &Quick Reference")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("keyCommands.html")), item) # Translators: The label for the menu item to open What's New document. item = menu_help.Append(wx.ID_ANY, _("What's &new")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("changes.html")), item) item = menu_help.Append(wx.ID_ANY, _("NVDA &web site")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile("http://www.nvda-project.org/"), item) # Translators: The label for the menu item to view NVDA License document. item = menu_help.Append(wx.ID_ANY, _("L&icense")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("copying.txt", False)), item) # Translators: The label for the menu item to view NVDA Contributors list document. item = menu_help.Append(wx.ID_ANY, _("C&ontributors")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("contributors.txt", False)), item) # Translators: The label for the menu item to open NVDA Welcome Dialog. item = menu_help.Append(wx.ID_ANY, _("We&lcome dialog...")) from .startupDialogs import WelcomeDialog self.Bind(wx.EVT_MENU, lambda evt: WelcomeDialog.run(), item) menu_help.AppendSeparator() if updateCheck: # Translators: The label of a menu item to manually check for an updated version of NVDA. item = menu_help.Append(wx.ID_ANY, _("&Check for update...")) self.Bind(wx.EVT_MENU, frame.onCheckForUpdateCommand, item) # Translators: The label for the menu item to open About dialog to get information about NVDA. item = menu_help.Append(wx.ID_ABOUT, _("About..."), _("About NVDA")) self.Bind(wx.EVT_MENU, frame.onAboutCommand, item) # Translators: The label for the Help submenu in NVDA menu. self.menu.AppendSubMenu(menu_help,_("&Help")) self.menu.AppendSeparator() # Translators: The label for the menu item to open the Configuration Profiles dialog. item = self.menu.Append(wx.ID_ANY, _("&Configuration profiles...")) self.Bind(wx.EVT_MENU, frame.onConfigProfilesCommand, item) # Translators: The label for the menu item to revert to saved configuration. item = self.menu.Append(wx.ID_ANY, _("&Revert to saved configuration"),_("Reset all settings to saved state")) self.Bind(wx.EVT_MENU, frame.onRevertToSavedConfigurationCommand, item) if not globalVars.appArgs.secure: # Translators: The label for the menu item to reset settings to default settings. # Here, default settings means settings that were there when the user first used NVDA. item = self.menu.Append(wx.ID_ANY, _("&Reset configuration to factory defaults"),_("Reset all settings to default state")) self.Bind(wx.EVT_MENU, frame.onRevertToDefaultConfigurationCommand, item) # Translators: The label for the menu item to save current settings. item = self.menu.Append(wx.ID_SAVE, _("&Save configuration"), _("Write the current configuration to nvda.ini")) self.Bind(wx.EVT_MENU, frame.onSaveConfigurationCommand, item) self.menu.AppendSeparator() # Translators: The label for the menu item to open donate page. item = self.menu.Append(wx.ID_ANY, _("Donate")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(DONATE_URL), item) self.installPendingUpdateMenuItemPos = self.menu.GetMenuItemCount() item = self.installPendingUpdateMenuItem = self.menu.Append(wx.ID_ANY, # Translators: The label for the menu item to run a pending update. _("Install pending &update"), # Translators: The description for the menu item to run a pending update. _("Execute a previously downloaded NVDA update")) self.Bind(wx.EVT_MENU, frame.onExecuteUpdateCommand, item) self.menu.AppendSeparator() item = self.menu.Append(wx.ID_EXIT, _("E&xit"),_("Exit NVDA")) self.Bind(wx.EVT_MENU, frame.onExitCommand, item) self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.onActivate) self.Bind(wx.adv.EVT_TASKBAR_RIGHT_DOWN, self.onActivate)
def __init__(self, frame): super(SysTrayIcon, self).__init__() icon=wx.Icon(ICON_PATH,wx.BITMAP_TYPE_ICO) self.SetIcon(icon, versionInfo.name) self.menu=wx.Menu() menu_preferences=self.preferencesMenu=wx.Menu() # Translators: The label for the menu item to open general Settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&General settings..."),_("General settings")) self.Bind(wx.EVT_MENU, frame.onGeneralSettingsCommand, item) # Translators: The label for the menu item to open Synthesizer settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Synthesizer..."),_("Change the synthesizer to be used")) self.Bind(wx.EVT_MENU, frame.onSynthesizerCommand, item) # Translators: The label for the menu item to open Voice Settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Voice settings..."),_("Choose the voice, rate, pitch and volume to use")) self.Bind(wx.EVT_MENU, frame.onVoiceCommand, item) # Translators: The label for the menu item to open Braille Settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("B&raille settings...")) self.Bind(wx.EVT_MENU, frame.onBrailleCommand, item) # Translators: The label for the menu item to open Keyboard Settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Keyboard settings..."),_("Configure keyboard layout, speaking of typed characters, words or command keys")) self.Bind(wx.EVT_MENU, frame.onKeyboardSettingsCommand, item) # Translators: The label for the menu item to open Mouse Settings dialog. item = menu_preferences.Append(wx.ID_ANY, _("&Mouse settings..."),_("Change reporting of mouse shape and object under mouse")) self.Bind(wx.EVT_MENU, frame.onMouseSettingsCommand, item) # Translators: The label for the menu item to open Review Cursor dialog. item = menu_preferences.Append(wx.ID_ANY,_("Review &cursor..."),_("Configure how and when the review cursor moves")) self.Bind(wx.EVT_MENU, frame.onReviewCursorCommand, item) # Translators: The label for the menu item to open Input Composition Settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Input composition settings..."),_("Configure how NVDA reports input composition and candidate selection for certain languages")) self.Bind(wx.EVT_MENU, frame.onInputCompositionCommand, item) # Translators: The label for the menu item to open Object Presentation dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Object presentation..."),_("Change reporting of objects")) self.Bind(wx.EVT_MENU, frame.onObjectPresentationCommand, item) # Translators: The label for the menu item to open Browse Mode settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("&Browse mode..."),_("Change virtual buffers specific settings")) self.Bind(wx.EVT_MENU, frame.onBrowseModeCommand, item) # Translators: The label for the menu item to open Document Formatting settings dialog. item = menu_preferences.Append(wx.ID_ANY,_("Document &formatting..."),_("Change settings of document properties")) self.Bind(wx.EVT_MENU, frame.onDocumentFormattingCommand, item) subMenu_speechDicts = wx.Menu() if not globalVars.appArgs.secure: # Translators: The label for the menu item to open Default speech dictionary dialog. item = subMenu_speechDicts.Append(wx.ID_ANY,_("&Default dictionary..."),_("A dialog where you can set default dictionary by adding dictionary entries to the list")) self.Bind(wx.EVT_MENU, frame.onDefaultDictionaryCommand, item) # Translators: The label for the menu item to open Voice specific speech dictionary dialog. item = subMenu_speechDicts.Append(wx.ID_ANY,_("&Voice dictionary..."),_("A dialog where you can set voice-specific dictionary by adding dictionary entries to the list")) self.Bind(wx.EVT_MENU, frame.onVoiceDictionaryCommand, item) # Translators: The label for the menu item to open Temporary speech dictionary dialog. item = subMenu_speechDicts.Append(wx.ID_ANY,_("&Temporary dictionary..."),_("A dialog where you can set temporary dictionary by adding dictionary entries to the edit box")) self.Bind(wx.EVT_MENU, frame.onTemporaryDictionaryCommand, item) # Translators: The label for a submenu under NvDA Preferences menu to select speech dictionaries. menu_preferences.AppendMenu(wx.ID_ANY,_("Speech &dictionaries"),subMenu_speechDicts) if not globalVars.appArgs.secure: # Translators: The label for the menu item to open Punctuation/symbol pronunciation dialog. item = menu_preferences.Append(wx.ID_ANY, _("&Punctuation/symbol pronunciation...")) self.Bind(wx.EVT_MENU, frame.onSpeechSymbolsCommand, item) # Translators: The label for the menu item to open the Input Gestures dialog. item = menu_preferences.Append(wx.ID_ANY, _("I&nput gestures...")) self.Bind(wx.EVT_MENU, frame.onInputGesturesCommand, item) # Translators: The label for Preferences submenu in NVDA menu. self.menu.AppendMenu(wx.ID_ANY,_("&Preferences"),menu_preferences) menu_tools = self.toolsMenu = wx.Menu() if not globalVars.appArgs.secure: # Translators: The label for the menu item to open NVDA Log Viewer. item = menu_tools.Append(wx.ID_ANY, _("View log")) self.Bind(wx.EVT_MENU, frame.onViewLogCommand, item) # Translators: The label for the menu item to toggle Speech Viewer. item=self.menu_tools_toggleSpeechViewer = menu_tools.AppendCheckItem(wx.ID_ANY, _("Speech viewer")) self.Bind(wx.EVT_MENU, frame.onToggleSpeechViewerCommand, item) if not globalVars.appArgs.secure: # Translators: The label for the menu item to open NVDA Python Console. item = menu_tools.Append(wx.ID_ANY, _("Python console")) self.Bind(wx.EVT_MENU, frame.onPythonConsoleCommand, item) # Translators: The label of a menu item to open the Add-ons Manager. item = menu_tools.Append(wx.ID_ANY, _("Manage &add-ons...")) self.Bind(wx.EVT_MENU, frame.onAddonsManagerCommand, item) if not globalVars.appArgs.secure and getattr(sys,'frozen',None): # Translators: The label for the menu item to create a portable copy of NVDA from an installed or another portable version. item = menu_tools.Append(wx.ID_ANY, _("Create portable copy...")) self.Bind(wx.EVT_MENU, frame.onCreatePortableCopyCommand, item) if not config.isInstalledCopy(): # Translators: The label for the menu item to install NVDA on the computer. item = menu_tools.Append(wx.ID_ANY, _("&Install NVDA...")) self.Bind(wx.EVT_MENU, frame.onInstallCommand, item) # Translators: The label for the menu item to reload plugins. item = menu_tools.Append(wx.ID_ANY, _("Reload plugins")) self.Bind(wx.EVT_MENU, frame.onReloadPluginsCommand, item) # Translators: The label for the Tools submenu in NVDA menu. self.menu.AppendMenu(wx.ID_ANY, _("Tools"), menu_tools) menu_help = self.helpMenu = wx.Menu() if not globalVars.appArgs.secure: # Translators: The label of a menu item to open NVDA user guide. item = menu_help.Append(wx.ID_ANY, _("&User Guide")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("userGuide.html")), item) # Translators: The label of a menu item to open the Commands Quick Reference document. item = menu_help.Append(wx.ID_ANY, _("Commands &Quick Reference")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("keyCommands.html")), item) # Translators: The label for the menu item to open What's New document. item = menu_help.Append(wx.ID_ANY, _("What's &new")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("changes.html")), item) item = menu_help.Append(wx.ID_ANY, _("NVDA &web site")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile("http://www.nvda-project.org/"), item) # Translators: The label for the menu item to view NVDA License document. item = menu_help.Append(wx.ID_ANY, _("L&icense")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("copying.txt", False)), item) # Translators: The label for the menu item to view NVDA Contributors list document. item = menu_help.Append(wx.ID_ANY, _("C&ontributors")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("contributors.txt", False)), item) # Translators: The label for the menu item to open NVDA Welcome Dialog. item = menu_help.Append(wx.ID_ANY, _("We&lcome dialog...")) self.Bind(wx.EVT_MENU, lambda evt: WelcomeDialog.run(), item) menu_help.AppendSeparator() if updateCheck: # Translators: The label of a menu item to manually check for an updated version of NVDA. item = menu_help.Append(wx.ID_ANY, _("&Check for update...")) self.Bind(wx.EVT_MENU, frame.onCheckForUpdateCommand, item) # Translators: The label for the menu item to open About dialog to get information about NVDA. item = menu_help.Append(wx.ID_ABOUT, _("About..."), _("About NVDA")) self.Bind(wx.EVT_MENU, frame.onAboutCommand, item) # Translators: The label for the Help submenu in NVDA menu. self.menu.AppendMenu(wx.ID_ANY,_("&Help"),menu_help) self.menu.AppendSeparator() # Translators: The label for the menu item to open the Configuration Profiles dialog. item = self.menu.Append(wx.ID_ANY, _("&Configuration profiles...")) self.Bind(wx.EVT_MENU, frame.onConfigProfilesCommand, item) # Translators: The label for the menu item to revert to saved configuration. item = self.menu.Append(wx.ID_ANY, _("&Revert to saved configuration"),_("Reset all settings to saved state")) self.Bind(wx.EVT_MENU, frame.onRevertToSavedConfigurationCommand, item) if not globalVars.appArgs.secure: # Translators: The label for the menu item to reset settings to default settings. # Here, default settings means settings that were there when the user first used NVDA. item = self.menu.Append(wx.ID_ANY, _("&Reset configuration to factory defaults"),_("Reset all settings to default state")) self.Bind(wx.EVT_MENU, frame.onRevertToDefaultConfigurationCommand, item) # Translators: The label for the menu item to save current settings. item = self.menu.Append(wx.ID_SAVE, _("&Save configuration"), _("Write the current configuration to nvda.ini")) self.Bind(wx.EVT_MENU, frame.onSaveConfigurationCommand, item) if not globalVars.appArgs.secure: self.menu.AppendSeparator() # Translators: The label for the menu item to open donate page. item = self.menu.Append(wx.ID_ANY, _("Donate")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(DONATE_URL), item) self.menu.AppendSeparator() item = self.menu.Append(wx.ID_EXIT, _("E&xit"),_("Exit NVDA")) self.Bind(wx.EVT_MENU, frame.onExitCommand, item) self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.onActivate) self.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, self.onActivate)
def isAudioDuckingSupported(): global _isAudioDuckingSupported if _isAudioDuckingSupported is None: _isAudioDuckingSupported=config.isInstalledCopy() and hasattr(oledll.oleacc,'AccSetRunningUtilityState') return _isAudioDuckingSupported
def __init__(self, frame): super(SysTrayIcon, self).__init__() icon=wx.Icon(ICON_PATH,wx.BITMAP_TYPE_ICO) self.SetIcon(icon, versionInfo.name) self.menu=wx.Menu() menu_preferences=self.preferencesMenu=wx.Menu() item = menu_preferences.Append(wx.ID_ANY, # Translators: The label for the menu item to open NVDA Settings dialog. _("&Settings..."), # Translators: The description for the menu item to open NVDA Settings dialog. _("NVDA settings")) self.Bind(wx.EVT_MENU, frame.onNVDASettingsCommand, item) subMenu_speechDicts = wx.Menu() if not globalVars.appArgs.secure: # Translators: The label for the menu item to open Default speech dictionary dialog. item = subMenu_speechDicts.Append(wx.ID_ANY,_("&Default dictionary..."),_("A dialog where you can set default dictionary by adding dictionary entries to the list")) self.Bind(wx.EVT_MENU, frame.onDefaultDictionaryCommand, item) # Translators: The label for the menu item to open Voice specific speech dictionary dialog. item = subMenu_speechDicts.Append(wx.ID_ANY,_("&Voice dictionary..."),_("A dialog where you can set voice-specific dictionary by adding dictionary entries to the list")) self.Bind(wx.EVT_MENU, frame.onVoiceDictionaryCommand, item) # Translators: The label for the menu item to open Temporary speech dictionary dialog. item = subMenu_speechDicts.Append(wx.ID_ANY,_("&Temporary dictionary..."),_("A dialog where you can set temporary dictionary by adding dictionary entries to the edit box")) self.Bind(wx.EVT_MENU, frame.onTemporaryDictionaryCommand, item) # Translators: The label for a submenu under NvDA Preferences menu to select speech dictionaries. menu_preferences.AppendSubMenu(subMenu_speechDicts,_("Speech &dictionaries")) if not globalVars.appArgs.secure: # Translators: The label for the menu item to open Punctuation/symbol pronunciation dialog. item = menu_preferences.Append(wx.ID_ANY, _("&Punctuation/symbol pronunciation...")) self.Bind(wx.EVT_MENU, frame.onSpeechSymbolsCommand, item) # Translators: The label for the menu item to open the Input Gestures dialog. item = menu_preferences.Append(wx.ID_ANY, _("I&nput gestures...")) self.Bind(wx.EVT_MENU, frame.onInputGesturesCommand, item) # Translators: The label for Preferences submenu in NVDA menu. self.menu.AppendSubMenu(menu_preferences,_("&Preferences")) menu_tools = self.toolsMenu = wx.Menu() if not globalVars.appArgs.secure: # Translators: The label for the menu item to open NVDA Log Viewer. item = menu_tools.Append(wx.ID_ANY, _("View log")) self.Bind(wx.EVT_MENU, frame.onViewLogCommand, item) # Translators: The label for the menu item to toggle Speech Viewer. item=self.menu_tools_toggleSpeechViewer = menu_tools.AppendCheckItem(wx.ID_ANY, _("Speech viewer")) self.Bind(wx.EVT_MENU, frame.onToggleSpeechViewerCommand, item) if not globalVars.appArgs.secure and not config.isAppX: # Translators: The label for the menu item to open NVDA Python Console. item = menu_tools.Append(wx.ID_ANY, _("Python console")) self.Bind(wx.EVT_MENU, frame.onPythonConsoleCommand, item) # Translators: The label of a menu item to open the Add-ons Manager. item = menu_tools.Append(wx.ID_ANY, _("Manage &add-ons...")) self.Bind(wx.EVT_MENU, frame.onAddonsManagerCommand, item) if not globalVars.appArgs.secure and not config.isAppX and getattr(sys,'frozen',None): # Translators: The label for the menu item to create a portable copy of NVDA from an installed or another portable version. item = menu_tools.Append(wx.ID_ANY, _("Create portable copy...")) self.Bind(wx.EVT_MENU, frame.onCreatePortableCopyCommand, item) if not config.isInstalledCopy(): # Translators: The label for the menu item to install NVDA on the computer. item = menu_tools.Append(wx.ID_ANY, _("&Install NVDA...")) self.Bind(wx.EVT_MENU, frame.onInstallCommand, item) # Translators: The label for the menu item to run the COM registration fix tool item = menu_tools.Append(wx.ID_ANY, _("Run COM Registration Fixing tool...")) self.Bind(wx.EVT_MENU, frame.onRunCOMRegistrationFixesCommand, item) if not config.isAppX: # Translators: The label for the menu item to reload plugins. item = menu_tools.Append(wx.ID_ANY, _("Reload plugins")) self.Bind(wx.EVT_MENU, frame.onReloadPluginsCommand, item) # Translators: The label for the Tools submenu in NVDA menu. self.menu.AppendSubMenu(menu_tools,_("Tools")) menu_help = self.helpMenu = wx.Menu() if not globalVars.appArgs.secure: # Translators: The label of a menu item to open NVDA user guide. item = menu_help.Append(wx.ID_ANY, _("&User Guide")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("userGuide.html")), item) # Translators: The label of a menu item to open the Commands Quick Reference document. item = menu_help.Append(wx.ID_ANY, _("Commands &Quick Reference")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("keyCommands.html")), item) # Translators: The label for the menu item to open What's New document. item = menu_help.Append(wx.ID_ANY, _("What's &new")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("changes.html")), item) item = menu_help.Append(wx.ID_ANY, _("NVDA &web site")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile("http://www.nvda-project.org/"), item) # Translators: The label for the menu item to view NVDA License document. item = menu_help.Append(wx.ID_ANY, _("L&icense")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("copying.txt", False)), item) # Translators: The label for the menu item to view NVDA Contributors list document. item = menu_help.Append(wx.ID_ANY, _("C&ontributors")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(getDocFilePath("contributors.txt", False)), item) # Translators: The label for the menu item to open NVDA Welcome Dialog. item = menu_help.Append(wx.ID_ANY, _("We&lcome dialog...")) self.Bind(wx.EVT_MENU, lambda evt: WelcomeDialog.run(), item) menu_help.AppendSeparator() if updateCheck: # Translators: The label of a menu item to manually check for an updated version of NVDA. item = menu_help.Append(wx.ID_ANY, _("&Check for update...")) self.Bind(wx.EVT_MENU, frame.onCheckForUpdateCommand, item) # Translators: The label for the menu item to open About dialog to get information about NVDA. item = menu_help.Append(wx.ID_ABOUT, _("About..."), _("About NVDA")) self.Bind(wx.EVT_MENU, frame.onAboutCommand, item) # Translators: The label for the Help submenu in NVDA menu. self.menu.AppendSubMenu(menu_help,_("&Help")) self.menu.AppendSeparator() # Translators: The label for the menu item to open the Configuration Profiles dialog. item = self.menu.Append(wx.ID_ANY, _("&Configuration profiles...")) self.Bind(wx.EVT_MENU, frame.onConfigProfilesCommand, item) # Translators: The label for the menu item to revert to saved configuration. item = self.menu.Append(wx.ID_ANY, _("&Revert to saved configuration"),_("Reset all settings to saved state")) self.Bind(wx.EVT_MENU, frame.onRevertToSavedConfigurationCommand, item) if not globalVars.appArgs.secure: # Translators: The label for the menu item to reset settings to default settings. # Here, default settings means settings that were there when the user first used NVDA. item = self.menu.Append(wx.ID_ANY, _("&Reset configuration to factory defaults"),_("Reset all settings to default state")) self.Bind(wx.EVT_MENU, frame.onRevertToDefaultConfigurationCommand, item) # Translators: The label for the menu item to save current settings. item = self.menu.Append(wx.ID_SAVE, _("&Save configuration"), _("Write the current configuration to nvda.ini")) self.Bind(wx.EVT_MENU, frame.onSaveConfigurationCommand, item) self.menu.AppendSeparator() # Translators: The label for the menu item to open donate page. item = self.menu.Append(wx.ID_ANY, _("Donate")) self.Bind(wx.EVT_MENU, lambda evt: os.startfile(DONATE_URL), item) self.installPendingUpdateMenuItemPos = self.menu.GetMenuItemCount() item = self.installPendingUpdateMenuItem = self.menu.Append(wx.ID_ANY, # Translators: The label for the menu item to run a pending update. _("Install pending &update"), # Translators: The description for the menu item to run a pending update. _("Execute a previously downloaded NVDA update")) self.Bind(wx.EVT_MENU, frame.onExecuteUpdateCommand, item) self.menu.AppendSeparator() item = self.menu.Append(wx.ID_EXIT, _("E&xit"),_("Exit NVDA")) self.Bind(wx.EVT_MENU, frame.onExitCommand, item) self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.onActivate) self.Bind(wx.adv.EVT_TASKBAR_RIGHT_DOWN, self.onActivate)