Skip to content

Commit

Permalink
Added an unassigned command (undocumented) to open the add-on settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Davis authored and Luke Davis committed Jul 11, 2023
1 parent 75fd967 commit 8e21260
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
29 changes: 27 additions & 2 deletions addon/globalPlugins/speechLogger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"""

import os
import types
import wx
from time import strftime
from typing import Optional, Dict
from functools import wraps
Expand All @@ -38,14 +38,15 @@
import globalVars
import ui
import gui
from gui.settingsDialogs import SettingsDialog, MultiCategorySettingsDialog
import config
import speech
from speech.speechWithoutPauses import SpeechWithoutPauses
from speech.types import SpeechSequence
from speech.priorities import Spri
from scriptHandler import script
from logHandler import log
from globalCommands import SCRCAT_TOOLS
from globalCommands import SCRCAT_TOOLS, SCRCAT_CONFIG

from .configUI import SpeechLoggerSettings, getConf
from .immutableKeyObj import ImmutableKeyObj
Expand Down Expand Up @@ -414,6 +415,30 @@ def script_toggleRemoteSpeechLogging(self, gesture):
# Translators: a message to tell the user that we can't start this kind of logging
ui.message(_("Remote speech logging has been disabled by an error or your NVDA configuration."))

@script(
# Translators: Input help mode message for open Speech Logger settings command.
description=_("Opens the Speech Logger add-on's settings"),
category=SCRCAT_CONFIG
)
@gui.blockAction.when(gui.blockAction.Context.MODAL_DIALOG_OPEN)
def script_activateSpeechLoggerSettingsDialog(self, gesture):
wx.CallAfter(self.onSpeechLoggerSettingsCommand, None)

def onSpeechLoggerSettingsCommand(self, evt, *args, **kwargs):
gui.mainFrame.prePopup()
try:
SpeechLoggerSettings(gui.mainFrame, *args, **kwargs).Show()
except SettingsDialog.MultiInstanceErrorWithDialog as errorWithDialog:
errorWithDialog.dialog.SetFocus()
except MultiCategorySettingsDialog.CategoryUnavailableError:
# Translators: Message shown when trying to open an unavailable category of a multi category settings dialog
# (example: when trying to open touch interaction settings on an unsupported system).
gui.messageBox(
_("The settings panel you tried to open is unavailable on this system."),
_("Error"),style=wx.OK | wx.ICON_ERROR
)
gui.mainFrame.postPopup()

def logToFile(self, file: str, sequence: Optional[SpeechSequence], initialText: Optional[str]) -> None:
"""Append text of the given speech sequence to the given file.
If an initialText is given, it appears on its own line before the logged text.
Expand Down
2 changes: 1 addition & 1 deletion buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _(arg):
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description": _("""Logs speech utterances to a file. Can also log NVDA remote session speech from the NVDA Remote add-on, to the same or another file."""),
# version
"addon_version": "23.2.03",
"addon_version": "23.2.021",
# Author(s)
"addon_author": "Luke Davis <XLTechie@newanswertech.com>, James Scholes",
# URL for the add-on documentation support
Expand Down

0 comments on commit 8e21260

Please sign in to comment.