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 onToggleBrailleViewerCommand(self, evt): import brailleViewer if brailleViewer.isBrailleViewerActive(): brailleViewer.destroyBrailleViewer() else: brailleViewer.createBrailleViewerTool()