Example #1
0
 def _createLicenseAgreementGroup(self) -> wx.StaticBoxSizer:
     # Translators: The label of the license text which will be shown when NVDA installation program starts.
     groupLabel = _("License Agreement")
     sizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=groupLabel)
     # Create a fake text control to determine appropriate width of license text box
     _fakeTextCtrl = wx.StaticText(
         self,
         label="a" *
         80,  # The GPL2 text of copying.txt wraps sentences at 80 characters
     )
     widthOfLicenseText = _fakeTextCtrl.Size[0]
     _fakeTextCtrl.Destroy()
     licenseTextCtrl = wx.TextCtrl(
         self,
         size=(widthOfLicenseText, self.scaleSize(300)),
         style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH,
     )
     licenseTextCtrl.Value = open(getDocFilePath("copying.txt", False),
                                  "r",
                                  encoding="UTF-8").read()
     sizer.Add(
         licenseTextCtrl,
         flag=wx.EXPAND,
         proportion=1,
     )
     return sizer
Example #2
0
def showHelp(helpObj):
    """Display the corresponding section of the user guide when either the Help
	button in an NVDA dialog is pressed or the F1 key is pressed on a
	recognized control.
	"""

    import ui
    import queueHandler
    if not helpObj:
        # Translators: Message indicating no context sensitive help is available for the control or dialog.
        noHelpMessage = _("No help available here.")
        queueHandler.queueFunction(queueHandler.eventQueue, ui.message,
                                   noHelpMessage)
        return
    if isinstance(helpObj, str):
        # for NVDA
        helpId = helpObj
        helpFile = getDocFilePath("userGuide.html")
    elif isinstance(helpObj, tuple):
        # for add-ons
        (helpId, helpFile) = helpObj
    else:
        # erreur
        log.error("helpObj is invalid: %s" % type(helpObj))
        return
    if helpFile is None or not os.path.exists(helpFile) or not os.path.isfile(
            helpFile):
        # Translators: Message shown when trying to display context sensitive help,
        # indicating that	the user guide could not be found.
        noHelpMessage = _("No user guide found.")
        log.debugWarning(
            "No user guide found: possible cause - running from source without building user docs"
        )
        queueHandler.queueFunction(queueHandler.eventQueue, ui.message,
                                   noHelpMessage)
        return
    log.debug(f"Opening help: helpId = {helpId}, userGuidePath: {helpFile}")
    nvdaTempDir = os.path.join(tempfile.gettempdir(), "nvda")
    if not os.path.exists(nvdaTempDir):
        os.mkdir(nvdaTempDir)
    contextHelpRedirect = os.path.join(nvdaTempDir, "contextHelp.html")
    try:
        # a redirect is necessary because not all browsers support opening a fragment URL from the command line.
        writeRedirect(helpId, helpFile, contextHelpRedirect)
    except Exception:
        log.error("Unable to write context help redirect file.", exc_info=True)
        return
    try:
        log.warning("open help file: %s, %s" % (helpId, helpFile))
        queueHandler.queueFunction(queueHandler.eventQueue, ui.message,
                                   _("Please wait"))
        os.startfile(f"file://{contextHelpRedirect}")
    except Exception:
        log.error("Unable to launch context help.", exc_info=True)
Example #3
0
	def __init__(self, parent):
		super().__init__(parent, title=f"{versionInfo.name} {_('Launcher')}")

		mainSizer = wx.BoxSizer(wx.VERTICAL)
		sHelper = gui.guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL)

		# Translators: The label of the license text which will be shown when NVDA installation program starts.
		groupLabel = _("License Agreement")
		sizer = wx.StaticBoxSizer(wx.VERTICAL, self, label=groupLabel)
		sHelper.addItem(sizer)
		licenseTextCtrl = wx.TextCtrl(self, size=(500, 400), style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH)
		licenseTextCtrl.Value = open(getDocFilePath("copying.txt", False), "r", encoding="UTF-8").read()
		sizer.Add(licenseTextCtrl)

		# Translators: The label for a checkbox in NvDA installation program to agree to the license agreement.
		agreeText = _("I &agree")
		self.licenseAgreeCheckbox = sHelper.addItem(wx.CheckBox(self, label=agreeText))
		self.licenseAgreeCheckbox.Value = False
		self.licenseAgreeCheckbox.Bind(wx.EVT_CHECKBOX, self.onLicenseAgree)

		sizer = sHelper.addItem(wx.GridSizer(2, 2, 0, 0))
		self.actionButtons = []
		# Translators: The label of the button in NVDA installation program to install NvDA on the user's computer.
		ctrl = wx.Button(self, label=_("&Install NVDA on this computer"))
		sizer.Add(ctrl)
		ctrl.Bind(wx.EVT_BUTTON, lambda evt: self.onAction(evt, gui.mainFrame.onInstallCommand))
		self.actionButtons.append(ctrl)
		# Translators: The label of the button in NVDA installation program to create a portable version of NVDA.
		ctrl = wx.Button(self, label=_("Create &portable copy"))
		sizer.Add(ctrl)
		ctrl.Bind(wx.EVT_BUTTON, lambda evt: self.onAction(evt, gui.mainFrame.onCreatePortableCopyCommand))
		self.actionButtons.append(ctrl)
		# Translators: The label of the button in NVDA installation program
		# 		to continue using the installation program as a temporary copy of NVDA.
		ctrl = wx.Button(self, label=_("&Continue running"))
		sizer.Add(ctrl)
		ctrl.Bind(wx.EVT_BUTTON, self.onContinueRunning)
		self.actionButtons.append(ctrl)
		sizer.Add(wx.Button(self, label=_("E&xit"), id=wx.ID_CANCEL))
		# If we bind this on the button, it fails to trigger when the dialog is closed.
		self.Bind(wx.EVT_BUTTON, self.onExit, id=wx.ID_CANCEL)

		for ctrl in self.actionButtons:
			ctrl.Disable()

		mainSizer.Add(sHelper.sizer, border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
		self.Sizer = mainSizer
		mainSizer.Fit(self)
		self.CentreOnScreen()
Example #4
0
	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)