diff --git a/.vscode/settings.json b/.vscode/settings.json
index 5fe667e7..737eee59 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -233,20 +233,19 @@
"中文",
"日本語"
],
- "flake8.args": [
- "--max-line-length=130",
- ],
"git.ignoreLimitWarning": true,
- "python.analysis.typeCheckingMode": "basic",
"python.analysis.diagnosticMode": "workspace",
- "python.analysis.exclude": [
- "addon/globalPlugins/MathCAT/yaml",
- ],
- "python.analysis.diagnosticSeverityOverrides": {
- "reportMissingImports": "none"
- },
- "triggerTaskOnSave.tasks": {
- "flake8-whole-project": ["**/*.*py"]
- },
- "cmake.configureOnOpen": false
-}
\ No newline at end of file
+ "python.languageServer": "Pylance",
+
+ "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
+
+ "python.linting.enabled": true,
+ "python.linting.ruffEnabled": true,
+ "python.linting.ruffPath": "ruff",
+
+ "python.linting.pylintEnabled": false,
+ "python.linting.flake8Enabled": false,
+ "python.linting.mypyEnabled": false,
+
+ "cmake.configureOnOpen": false,
+}
diff --git a/addon/globalPlugins/MathCAT/MathCAT.py b/addon/globalPlugins/MathCAT/MathCAT.py
index 5dd95536..fa7daaab 100644
--- a/addon/globalPlugins/MathCAT/MathCAT.py
+++ b/addon/globalPlugins/MathCAT/MathCAT.py
@@ -82,7 +82,7 @@
# try to get around espeak bug where voice slows down (for other voices, just a waste of time)
# we use a global that gets set at a time when the rate is probably good (SetMathML)
-_synthesizer_rate: int | None = None
+_synthesizerRate: int | None = None
def getLanguageToUse(mathMl: str = "") -> str:
@@ -110,7 +110,7 @@ def getLanguageToUse(mathMl: str = "") -> str:
return language
-def ConvertSSMLTextForNVDA(text: str) -> list:
+def convertSSMLTextForNVDA(text: str) -> list:
"""Change the SSML in the text into NVDA's command structure.
The environment is examined to determine whether a language switch is needed"""
# MathCAT's default rate is 180 wpm.
@@ -135,14 +135,14 @@ def ConvertSSMLTextForNVDA(text: str) -> list:
# At "50" espeak finished in 46 sec, sapi in 75 sec, and one core in 70; at '100' one core was much slower than the others
wpm = 2 * getSynth()._get_rate()
breakMulti = 180.0 / wpm
- supported_commands = synth.supportedCommands
- use_break = BreakCommand in supported_commands
- use_pitch = PitchCommand in supported_commands
+ supportedCommands = synth.supportedCommands
+ useBreak = BreakCommand in supportedCommands
+ usePitch = PitchCommand in supportedCommands
# use_rate = RateCommand in supported_commands
# use_volume = VolumeCommand in supported_commands
- use_phoneme = PhonemeCommand in supported_commands
+ usePhoneme = PhonemeCommand in supportedCommands
# as of 7/23, oneCore voices do not implement the CharacterModeCommand despite it being in supported_commands
- use_character = CharacterModeCommand in supported_commands and synth.name != "oneCore"
+ useCharacter = CharacterModeCommand in supportedCommands and synth.name != "oneCore"
out = []
if mathCATLanguageSetting != language:
# log.info(f"Setting language to {language}")
@@ -158,23 +158,23 @@ def ConvertSSMLTextForNVDA(text: str) -> list:
# log.info(f"\ntext: {text}")
for m in RE_MATHML_SPEECH.finditer(text):
if m.lastgroup == "break":
- if use_break:
+ if useBreak:
out.append(BreakCommand(time=int(int(m.group("break")) * breakMulti)))
elif m.lastgroup == "char":
ch = m.group("char")
- if use_character:
+ if useCharacter:
out.extend((CharacterModeCommand(True), ch, CharacterModeCommand(False)))
else:
out.extend((" ", "eigh" if ch == "a" and language.startswith("en") else ch, " "))
elif m.lastgroup == "beep":
out.append(BeepCommand(2000, 50))
elif m.lastgroup == "pitch":
- if use_pitch:
+ if usePitch:
out.append(PitchCommand(multiplier=int(m.group(m.lastgroup))))
resetProsody.append(PitchCommand)
elif m.lastgroup in PROSODY_COMMANDS:
command = PROSODY_COMMANDS[m.lastgroup]
- if command in supported_commands:
+ if command in supportedCommands:
out.append(command(multiplier=int(m.group(m.lastgroup)) / 100.0))
resetProsody.append(command)
elif m.lastgroup == "prosodyReset":
@@ -182,7 +182,7 @@ def ConvertSSMLTextForNVDA(text: str) -> list:
command = resetProsody.pop()
out.append(command(multiplier=1))
elif m.lastgroup == "phonemeText":
- if use_phoneme:
+ if usePhoneme:
out.append(PhonemeCommand(m.group("ipa"), text=m.group("phonemeText")))
else:
out.append(m.group("phonemeText"))
@@ -220,27 +220,27 @@ class MathCATInteraction(mathPres.MathInteractionNVDAObject):
def __init__(self, provider=None, mathMl: Optional[str] = None):
super(MathCATInteraction, self).__init__(provider=provider, mathMl=mathMl)
if mathMl is None:
- self.init_mathml = ""
+ self.initMathML = ""
else:
- self.init_mathml = mathMl
+ self.initMathML = mathMl
def reportFocus(self):
super(MathCATInteraction, self).reportFocus()
# try to get around espeak bug where voice slows down
- if _synthesizer_rate and getSynth().name == "espeak":
- getSynth()._set_rate(_synthesizer_rate)
+ if _synthesizerRate and getSynth().name == "espeak":
+ getSynth()._set_rate(_synthesizerRate)
try:
text = libmathcat.DoNavigateCommand("ZoomIn")
- speech.speak(ConvertSSMLTextForNVDA(text))
+ speech.speak(convertSSMLTextForNVDA(text))
except Exception as e:
log.exception(e)
# Translators: this message directs users to look in the log file
speech.speakMessage(_("Error in starting navigation of math: see NVDA error log for details"))
finally:
# try to get around espeak bug where voice slows down
- if _synthesizer_rate and getSynth().name == "espeak":
+ if _synthesizerRate and getSynth().name == "espeak":
# log.info(f'reportFocus: reset to {_synthesizer_rate}')
- getSynth()._set_rate(_synthesizer_rate)
+ getSynth()._set_rate(_synthesizerRate)
def getBrailleRegions(self, review: bool = False):
# log.info("***MathCAT start getBrailleRegions")
@@ -295,8 +295,8 @@ def getScript(self, gesture: KeyboardInputGesture):
def script_navigate(self, gesture: KeyboardInputGesture):
try:
# try to get around espeak bug where voice slows down
- if _synthesizer_rate and getSynth().name == "espeak":
- getSynth()._set_rate(_synthesizer_rate)
+ if _synthesizerRate and getSynth().name == "espeak":
+ getSynth()._set_rate(_synthesizerRate)
if gesture is not None: # == None when initial focus -- handled in reportFocus()
modNames = gesture.modifierNames
text = libmathcat.DoNavigateKeyPress(
@@ -307,27 +307,27 @@ def script_navigate(self, gesture: KeyboardInputGesture):
False,
)
# log.info(f"Navigate speech for {gesture.vkCode}/(s={'shift' in modNames}, c={'control' in modNames}): '{text}'")
- speech.speak(ConvertSSMLTextForNVDA(text))
+ speech.speak(convertSSMLTextForNVDA(text))
except Exception as e:
log.exception(e)
# Translators: this message directs users to look in the log file
speech.speakMessage(_("Error in navigating math: see NVDA error log for details"))
finally:
# try to get around espeak bug where voice slows down
- if _synthesizer_rate and getSynth().name == "espeak":
+ if _synthesizerRate and getSynth().name == "espeak":
# log.info(f'script_navigate: reset to {_synthesizer_rate}')
- getSynth()._set_rate(_synthesizer_rate)
+ getSynth()._set_rate(_synthesizerRate)
if not braille.handler.enabled:
return
try:
# update the braille to reflect the nav position (might be excess code, but it works)
- nav_node = libmathcat.GetNavigationMathMLId()
- braille_chars = libmathcat.GetBraille(nav_node[0])
+ navNode = libmathcat.GetNavigationMathMLId()
+ brailleChars = libmathcat.GetBraille(navNode[0])
# log.info(f'braille display = {config.conf["braille"]["display"]}, braille_chars: {braille_chars}')
region = braille.Region()
- region.rawText = braille_chars
+ region.rawText = brailleChars
region.focusToHardLeft = True
region.update()
braille.handler.buffer.regions.append(region)
@@ -350,44 +350,44 @@ def script_navigate(self, gesture: KeyboardInputGesture):
) # type: ignore
def script_rawdataToClip(self, gesture: KeyboardInputGesture):
try:
- copy_as = "mathml" # value used even if "CopyAs" pref is invalid
- text_to_copy = ""
+ copyAs = "mathml" # value used even if "CopyAs" pref is invalid
+ textToCopy = ""
try:
- copy_as = libmathcat.GetPreference("CopyAs").lower()
+ copyAs = libmathcat.GetPreference("CopyAs").lower()
except Exception as e:
log.exception(f"Not able to get 'CopyAs' preference: {e}")
- if copy_as == "asciimath" or copy_as == "latex":
+ if copyAs == "asciimath" or copyAs == "latex":
# save the old braille code, set the new one, get the braille, then reset the code
- saved_braille_code: str = libmathcat.GetPreference("BrailleCode")
- libmathcat.SetPreference("BrailleCode", "LaTeX" if copy_as == "latex" else "ASCIIMath")
- text_to_copy = libmathcat.GetNavigationBraille()
- libmathcat.SetPreference("BrailleCode", saved_braille_code)
- if copy_as == "asciimath":
- copy_as = "ASCIIMath" # speaks better in at least some voices
+ savedBrailleCode: str = libmathcat.GetPreference("BrailleCode")
+ libmathcat.SetPreference("BrailleCode", "LaTeX" if copyAs == "latex" else "ASCIIMath")
+ textToCopy = libmathcat.GetNavigationBraille()
+ libmathcat.SetPreference("BrailleCode", savedBrailleCode)
+ if copyAs == "asciimath":
+ copyAs = "ASCIIMath" # speaks better in at least some voices
else:
mathml = libmathcat.GetNavigationMathML()[0]
if not re.match(self._startsWithMath, mathml):
mathml = "" # copy will fix up name spacing
- elif self.init_mathml != "":
- mathml = self.init_mathml
- if copy_as == "speech":
+ elif self.initMathML != "":
+ mathml = self.initMathML
+ if copyAs == "speech":
# save the old MathML, set the navigation MathML as MathMl, get the speech, then reset the MathML
- saved_mathml: str = self.init_mathml
- saved_tts = libmathcat.GetPreference("TTS")
- if saved_mathml == "": # shouldn't happen
+ savedMathML: str = self.initMathML
+ savedTTS = libmathcat.GetPreference("TTS")
+ if savedMathML == "": # shouldn't happen
raise Exception("Internal error -- MathML not set for copy")
libmathcat.SetPreference("TTS", "None")
libmathcat.SetMathML(mathml)
# get the speech text and collapse the whitespace
- text_to_copy = " ".join(libmathcat.GetSpokenText().split())
- libmathcat.SetPreference("TTS", saved_tts)
- libmathcat.SetMathML(saved_mathml)
+ textToCopy = " ".join(libmathcat.GetSpokenText().split())
+ libmathcat.SetPreference("TTS", savedTTS)
+ libmathcat.SetMathML(savedMathML)
else:
- text_to_copy = self._wrapMathMLForClipBoard(mathml)
+ textToCopy = self._wrapMathMLForClipBoard(mathml)
- self._copyToClipAsMathML(text_to_copy, copy_as == "mathml")
+ self._copyToClipAsMathML(textToCopy, copyAs == "mathml")
# Translators: copy to clipboard
- ui.message(_("copy as ") + copy_as)
+ ui.message(_("copy as ") + copyAs)
except Exception as e:
log.exception(e)
# Translators: this message directs users to look in the log file
@@ -402,16 +402,16 @@ def script_rawdataToClip(self, gesture: KeyboardInputGesture):
def _wrapMathMLForClipBoard(self, text: str) -> str:
# cleanup the MathML a little
text = re.sub(self._hasAddedId, "", text)
- mathml_with_ns = re.sub(self._hasDataAttr, "", text)
- if not re.match(self._mathTagHasNameSpace, mathml_with_ns):
- mathml_with_ns = mathml_with_ns.replace(
+ mathMLWithNS = re.sub(self._hasDataAttr, "", text)
+ if not re.match(self._mathTagHasNameSpace, mathMLWithNS):
+ mathMLWithNS = mathMLWithNS.replace(
"math",
"math xmlns='http://www.w3.org/1998/Math/MathML'",
1,
)
- return mathml_with_ns
+ return mathMLWithNS
- def _copyToClipAsMathML(self, text: str, is_mathml: bool, notify: Optional[bool] = False) -> bool:
+ def _copyToClipAsMathML(self, text: str, isMathML: bool, notify: Optional[bool] = False) -> bool:
"""Copies the given text to the windows clipboard.
@returns: True if it succeeds, False otherwise.
@param text: the text which will be copied to the clipboard
@@ -424,7 +424,7 @@ def _copyToClipAsMathML(self, text: str, is_mathml: bool, notify: Optional[bool]
try:
with winUser.openClipboard(gui.mainFrame.Handle):
winUser.emptyClipboard()
- if is_mathml:
+ if isMathML:
self._setClipboardData(self.CF_MathML, '' + text)
self._setClipboardData(self.CF_MathML_Presentation, '' + text)
self._setClipboardData(winUser.CF_UNICODETEXT, text)
@@ -468,9 +468,9 @@ def __init__(self):
try:
# IMPORTANT -- SetRulesDir must be the first call to libmathcat besides GetVersion()
- rules_dir = path.join(path.dirname(path.abspath(__file__)), "Rules")
- log.info(f"MathCAT {libmathcat.GetVersion()} installed. Using rules dir: {rules_dir}")
- libmathcat.SetRulesDir(rules_dir)
+ rulesDir = path.join(path.dirname(path.abspath(__file__)), "Rules")
+ log.info(f"MathCAT {libmathcat.GetVersion()} installed. Using rules dir: {rulesDir}")
+ libmathcat.SetRulesDir(rulesDir)
libmathcat.SetPreference("TTS", "SSML")
except Exception as e:
log.exception(e)
@@ -478,13 +478,13 @@ def __init__(self):
speech.speakMessage(_("MathCAT initialization failed: see NVDA error log for details"))
def getSpeechForMathMl(self, mathml: str):
- global _synthesizer_rate
+ global _synthesizerRate
synth = getSynth()
synthConfig = config.conf["speech"][synth.name]
if synth.name == "espeak":
- _synthesizer_rate = synthConfig["rate"]
+ _synthesizerRate = synthConfig["rate"]
# log.info(f'_synthesizer_rate={_synthesizer_rate}, get_rate()={getSynth()._get_rate()}')
- getSynth()._set_rate(_synthesizer_rate)
+ getSynth()._set_rate(_synthesizerRate)
# log.info(f'..............get_rate()={getSynth()._get_rate()}, name={synth.name}')
try:
# need to set Language before the MathML for DecimalSeparator canonicalization
@@ -499,7 +499,7 @@ def getSpeechForMathMl(self, mathml: str):
speech.speakMessage(_("Illegal MathML found: see NVDA error log for details"))
libmathcat.SetMathML("") # set it to something
try:
- supported_commands = synth.supportedCommands
+ supportedCommands = synth.supportedCommands
# Set preferences for capital letters
libmathcat.SetPreference(
"CapitalLetters_Beep",
@@ -510,16 +510,16 @@ def getSpeechForMathMl(self, mathml: str):
"true" if synthConfig["sayCapForCapitals"] else "false",
)
# log.info(f"Speech text: {libmathcat.GetSpokenText()}")
- if PitchCommand in supported_commands:
+ if PitchCommand in supportedCommands:
libmathcat.SetPreference("CapitalLetters_Pitch", str(synthConfig["capPitchChange"]))
- if self._add_sounds():
+ if self._addSounds():
return (
[BeepCommand(800, 25)]
- + ConvertSSMLTextForNVDA(libmathcat.GetSpokenText())
+ + convertSSMLTextForNVDA(libmathcat.GetSpokenText())
+ [BeepCommand(600, 15)]
)
else:
- return ConvertSSMLTextForNVDA(libmathcat.GetSpokenText())
+ return convertSSMLTextForNVDA(libmathcat.GetSpokenText())
except Exception as e:
log.exception(e)
@@ -528,11 +528,11 @@ def getSpeechForMathMl(self, mathml: str):
return [""]
finally:
# try to get around espeak bug where voice slows down
- if _synthesizer_rate and getSynth().name == "espeak":
+ if _synthesizerRate and getSynth().name == "espeak":
# log.info(f'getSpeechForMathMl: reset to {_synthesizer_rate}')
- getSynth()._set_rate(_synthesizer_rate)
+ getSynth()._set_rate(_synthesizerRate)
- def _add_sounds(self):
+ def _addSounds(self):
try:
return libmathcat.GetPreference("SpeechSound") != "None"
except Exception as e:
@@ -572,10 +572,10 @@ def _monkeyPatchESpeak():
return # already patched
CACHED_SYNTH = currentSynth
- currentSynth.speak = patched_speak.__get__(currentSynth, type(currentSynth))
+ currentSynth.speak = patchedSpeak.__get__(currentSynth, type(currentSynth))
-def patched_speak(self, speechSequence: SpeechSequence): # noqa: C901
+def patchedSpeak(self, speechSequence: SpeechSequence): # noqa: C901
# log.info(f"\npatched_speak input: {speechSequence}")
textList: List[str] = []
langChanged = False
diff --git a/addon/globalPlugins/MathCAT/MathCATPreferences.py b/addon/globalPlugins/MathCAT/MathCATPreferences.py
index 4820ff88..ddd314ad 100644
--- a/addon/globalPlugins/MathCAT/MathCATPreferences.py
+++ b/addon/globalPlugins/MathCAT/MathCATPreferences.py
@@ -11,7 +11,7 @@
import addonHandler
from logHandler import log # logging
from typing import List, Dict, Union, Callable
-from .MathCAT import ConvertSSMLTextForNVDA
+from .MathCAT import convertSSMLTextForNVDA
from speech import speak
from zipfile import ZipFile
@@ -24,7 +24,7 @@
PAUSE_FACTOR_LOG_BASE = 1.4
# initialize the user preferences tuples
-user_preferences: Dict[str, Dict[str, Union[int, str, bool]]] = {}
+userPreferences: Dict[str, Dict[str, Union[int, str, bool]]] = {}
# Speech_Language is derived from the folder structures
Speech_DecimalSeparator = ("Auto", ".", ",", "Custom")
Speech_Impairment = ("LearningDisability", "Blindness", "LowVision")
@@ -47,38 +47,38 @@ def __init__(self, parent):
MathCATgui.MathCATPreferencesDialog.__init__(self, parent)
# load the logo into the dialog
- full_path_to_logo = os.path.join(os.path.dirname(os.path.abspath(__file__)), "logo.png")
- if os.path.exists(full_path_to_logo):
- self.m_bitmapLogo.SetBitmap(wx.Bitmap(full_path_to_logo))
+ fullPathToLogo = os.path.join(os.path.dirname(os.path.abspath(__file__)), "logo.png")
+ if os.path.exists(fullPathToLogo):
+ self._bitmapLogo.SetBitmap(wx.Bitmap(fullPathToLogo))
# load in the system values followed by the user prefs (if any)
- UserInterface.load_default_preferences()
- UserInterface.load_user_preferences()
+ UserInterface.loadDefaultPreferences()
+ UserInterface.loadUserPreferences()
# hack for "CopyAs" because its location in the prefs is not yet fixed
- if "CopyAs" not in user_preferences["Navigation"]:
- user_preferences["Navigation"]["CopyAs"] = (
- user_preferences["Other"]["CopyAs"] if "CopyAs" in user_preferences["Other"] else "MathML"
+ if "CopyAs" not in userPreferences["Navigation"]:
+ userPreferences["Navigation"]["CopyAs"] = (
+ userPreferences["Other"]["CopyAs"] if "CopyAs" in userPreferences["Other"] else "MathML"
)
- UserInterface.validate_user_preferences()
+ UserInterface.validateUserPreferences()
- if "NVDAAddOn" in user_preferences:
+ if "NVDAAddOn" in userPreferences:
# set the categories selection to what we used on last run
- self.m_listBoxPreferencesTopic.SetSelection(user_preferences["NVDAAddOn"]["LastCategory"])
+ self._listBoxPreferencesTopic.SetSelection(userPreferences["NVDAAddOn"]["LastCategory"])
# show the appropriate dialogue page
- self.m_simplebookPanelsCategories.SetSelection(self.m_listBoxPreferencesTopic.GetSelection())
+ self._simplebookPanelsCategories.SetSelection(self._listBoxPreferencesTopic.GetSelection())
else:
# set the categories selection to the first item
- self.m_listBoxPreferencesTopic.SetSelection(0)
- user_preferences["NVDAAddOn"] = {"LastCategory": "0"}
+ self._listBoxPreferencesTopic.SetSelection(0)
+ userPreferences["NVDAAddOn"] = {"LastCategory": "0"}
# populate the languages and braille codes
- UserInterface.GetLanguages(self)
- UserInterface.GetBrailleCodes(self)
+ UserInterface.getLanguages(self)
+ UserInterface.getBrailleCodes(self)
# set the ui items to match the preferences
- UserInterface.set_ui_values(self)
+ UserInterface.setUIValues(self)
@staticmethod
- def path_to_languages_folder():
+ def pathToLanguagesFolder():
# the user preferences file is stored at: MathCAT\Rules\Languages
return os.path.join(os.path.dirname(os.path.abspath(__file__)), "Rules", "Languages")
@@ -88,7 +88,7 @@ def pathToBrailleFolder():
return os.path.join(os.path.dirname(os.path.abspath(__file__)), "Rules", "Braille")
@staticmethod
- def LanguagesDict() -> Dict[str, str]:
+ def languagesDict() -> Dict[str, str]:
languages = {
"aa": "Afar",
"ab": "Аҧсуа",
@@ -265,7 +265,7 @@ def LanguagesDict() -> Dict[str, str]:
}
return languages
- def get_rules_files(
+ def getRulesFiles(
self,
pathToDir: str,
processSubDirs: Callable[[str, str], List[str]] | None,
@@ -291,52 +291,52 @@ def get_rules_files(
return ruleFiles
- def GetLanguages(self):
+ def getLanguages(self):
def addRegionalLanguages(subDir: str, language: str) -> List[str]:
# the language variants are in folders named using ISO 3166-1 alpha-2
# codes https://en.wikipedia.org/wiki/ISO_3166-2
# check if there are language variants in the language folder
if subDir != "SharedRules":
- languagesDict = UserInterface.LanguagesDict()
+ languagesDict = UserInterface.languagesDict()
# add to the listbox the text for this language variant together with the code
regionalCode = language + "-" + subDir.upper()
if languagesDict.get(regionalCode, "missing") != "missing":
- self.m_choiceLanguage.Append(f"{languagesDict[regionalCode]} ({language}-{subDir})")
+ self._choiceLanguage.Append(f"{languagesDict[regionalCode]} ({language}-{subDir})")
elif languagesDict.get(language, "missing") != "missing":
- self.m_choiceLanguage.Append(f"{languagesDict[language]} ({regionalCode})")
+ self._choiceLanguage.Append(f"{languagesDict[language]} ({regionalCode})")
else:
- self.m_choiceLanguage.Append(f"{language} ({regionalCode})")
+ self._choiceLanguage.Append(f"{language} ({regionalCode})")
return [os.path.basename(file) for file in glob.glob(os.path.join(subDir, "*_Rules.yaml"))]
return []
# initialise the language list
- languagesDict = UserInterface.LanguagesDict()
+ languagesDict = UserInterface.languagesDict()
# clear the language names in the dialog
- self.m_choiceLanguage.Clear()
+ self._choiceLanguage.Clear()
# Translators: menu item -- use the language of the voice chosen in the NVDA speech settings dialog
# "Auto" == "Automatic" -- other items in menu are "English (en)", etc., so this matches that style
- self.m_choiceLanguage.Append(_("Use Voice's Language (Auto)"))
+ self._choiceLanguage.Append(_("Use Voice's Language (Auto)"))
# populate the available language names in the dialog
# the implemented languages are in folders named using the relevant ISO 639-1
# code https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
- languageDir = UserInterface.path_to_languages_folder()
+ languageDir = UserInterface.pathToLanguagesFolder()
for language in os.listdir(languageDir):
- pathToLanguageDir = os.path.join(UserInterface.path_to_languages_folder(), language)
+ pathToLanguageDir = os.path.join(UserInterface.pathToLanguagesFolder(), language)
if os.path.isdir(pathToLanguageDir):
# only add this language if there is a xxx_Rules.yaml file
- if len(self.get_rules_files(pathToLanguageDir, addRegionalLanguages)) > 0:
+ if len(self.getRulesFiles(pathToLanguageDir, addRegionalLanguages)) > 0:
# add to the listbox the text for this language together with the code
if languagesDict.get(language, "missing") != "missing":
- self.m_choiceLanguage.Append(languagesDict[language] + " (" + language + ")")
+ self._choiceLanguage.Append(languagesDict[language] + " (" + language + ")")
else:
- self.m_choiceLanguage.Append(language + " (" + language + ")")
+ self._choiceLanguage.Append(language + " (" + language + ")")
- def GetLanguageCode(self):
- lang_selection = self.m_choiceLanguage.GetStringSelection()
+ def getLanguageCode(self):
+ lang_selection = self._choiceLanguage.GetStringSelection()
lang_code = lang_selection[lang_selection.find("(") + 1 : lang_selection.find(")")]
return lang_code
- def GetSpeechStyles(self, this_SpeechStyle: str):
+ def getSpeechStyles(self, thisSpeechStyle: str):
"""Get all the speech styles for the current language.
This sets the SpeechStyles dialog entry"""
from speech import getCurrentLanguage
@@ -346,287 +346,285 @@ def getSpeechStyleFromDirectory(dir: str, lang: str) -> list[str]:
The 'lang', if it has a region dialect, is of the form 'en\uk'
The returned list is sorted alphabetically"""
# start with the regional dialect, then add on any (unique) styles in the main dir
- main_lang = lang.split("\\")[0] # does the right thing even if there is no regional directory
- all_style_files = []
+ mainLang = lang.split("\\")[0] # does the right thing even if there is no regional directory
+ allStyleFiles = []
if lang.find("\\") >= 0:
- all_style_files = [
- os.path.basename(name) for name in glob.glob(dir + lang + "\\*_Rules.yaml")
- ]
- all_style_files.extend(
- [os.path.basename(name) for name in glob.glob(dir + main_lang + "\\*_Rules.yaml")],
+ allStyleFiles = [os.path.basename(name) for name in glob.glob(dir + lang + "\\*_Rules.yaml")]
+ allStyleFiles.extend(
+ [os.path.basename(name) for name in glob.glob(dir + mainLang + "\\*_Rules.yaml")],
)
- all_style_files = list(set(all_style_files)) # make them unique
- if len(all_style_files) == 0:
+ allStyleFiles = list(set(allStyleFiles)) # make them unique
+ if len(allStyleFiles) == 0:
# look in the .zip file for the style files -- this will have regional variants, but also have that dir
try:
- zip_file = dir + main_lang + "\\" + main_lang + ".zip"
- zip_file = ZipFile(zip_file, "r") # file might not exist
- all_style_files = [
- name.split("/")[-1] for name in zip_file.namelist() if name.endswith("_Rules.yaml")
+ zipFile = dir + mainLang + "\\" + mainLang + ".zip"
+ zipFile = ZipFile(zipFile, "r") # file might not exist
+ allStyleFiles = [
+ name.split("/")[-1] for name in zipFile.namelist() if name.endswith("_Rules.yaml")
]
except Exception as e:
- log.debugWarning(f"MathCAT Dialog: didn't find zip file {zip_file}. Error: {e}")
- all_style_files.sort()
- return all_style_files
+ log.debugWarning(f"MathCAT Dialog: didn't find zip file {zipFile}. Error: {e}")
+ allStyleFiles.sort()
+ return allStyleFiles
# clear the SpeechStyle choices
- self.m_choiceSpeechStyle.Clear()
+ self._choiceSpeechStyle.Clear()
# get the currently selected language code
- languageCode = UserInterface.GetLanguageCode(self)
+ languageCode = UserInterface.getLanguageCode(self)
if languageCode == "Auto":
# list the speech styles for the current voice rather than have none listed
languageCode = getCurrentLanguage().lower().replace("_", "-")
languageCode = languageCode.replace("-", "\\")
- languagePath = UserInterface.path_to_languages_folder() + "\\"
+ languagePath = UserInterface.pathToLanguagesFolder() + "\\"
# log.info(f"languagePath={languagePath}")
# populate the m_choiceSpeechStyle choices
- all_style_files = [
+ allStyleFiles = [
# remove "_Rules.yaml" from the list
name[: name.find("_Rules.yaml")]
for name in getSpeechStyleFromDirectory(languagePath, languageCode)
]
# There isn't a LiteralSpeak rules file since it has no language-specific rules. We add it at the end.
# Translators: at the moment, do NOT translate this string as some code specifically looks for this name.
- all_style_files.append("LiteralSpeak")
- for name in all_style_files:
- self.m_choiceSpeechStyle.Append((name))
+ allStyleFiles.append("LiteralSpeak")
+ for name in allStyleFiles:
+ self._choiceSpeechStyle.Append((name))
try:
# set the SpeechStyle to the same as previous
- self.m_choiceSpeechStyle.SetStringSelection(
- this_SpeechStyle if this_SpeechStyle in all_style_files else all_style_files[0],
+ self._choiceSpeechStyle.SetStringSelection(
+ thisSpeechStyle if thisSpeechStyle in allStyleFiles else allStyleFiles[0],
)
except Exception as e:
log.exception(
f"MathCAT: An exception occurred in GetSpeechStyles evaluating set SetStringSelection: {e}",
)
# that didn't work, choose the first in the list
- self.m_choiceSpeechStyle.SetSelection(0)
+ self._choiceSpeechStyle.SetSelection(0)
- def GetBrailleCodes(self):
+ def getBrailleCodes(self):
# initialise the braille code list
- self.m_choiceBrailleMathCode.Clear()
+ self._choiceBrailleMathCode.Clear()
# populate the available braille codes in the dialog
# the dir names are used, not the rule file names because the dir names have to be unique
pathToBrailleFolder = UserInterface.pathToBrailleFolder()
- for braille_code in os.listdir(pathToBrailleFolder):
- pathToBrailleCode = os.path.join(pathToBrailleFolder, braille_code)
+ for brailleCode in os.listdir(pathToBrailleFolder):
+ pathToBrailleCode = os.path.join(pathToBrailleFolder, brailleCode)
if os.path.isdir(pathToBrailleCode):
- if len(self.get_rules_files(pathToBrailleCode, None)) > 0:
- self.m_choiceBrailleMathCode.Append(braille_code)
+ if len(self.getRulesFiles(pathToBrailleCode, None)) > 0:
+ self._choiceBrailleMathCode.Append(brailleCode)
- def set_ui_values(self):
+ def setUIValues(self):
# set the UI elements to the ones read from the preference file(s)
try:
- self.m_choiceImpairment.SetSelection(
- Speech_Impairment.index(user_preferences["Speech"]["Impairment"]),
+ self._choiceImpairment.SetSelection(
+ Speech_Impairment.index(userPreferences["Speech"]["Impairment"]),
)
try:
- lang_pref = user_preferences["Speech"]["Language"]
- self.m_choiceLanguage.SetSelection(0)
+ langPref = userPreferences["Speech"]["Language"]
+ self._choiceLanguage.SetSelection(0)
i = 1 # no need to test i == 0
- while i < self.m_choiceLanguage.GetCount():
- if f"({lang_pref})" in self.m_choiceLanguage.GetString(i):
- self.m_choiceLanguage.SetSelection(i)
+ while i < self._choiceLanguage.GetCount():
+ if f"({langPref})" in self._choiceLanguage.GetString(i):
+ self._choiceLanguage.SetSelection(i)
break
i += 1
except Exception as e:
log.exception(
- f"MathCAT: An exception occurred in set_ui_values ('{user_preferences['Speech']['Language']}'): {e}",
+ f"MathCAT: An exception occurred in setUIValues ('{userPreferences['Speech']['Language']}'): {e}",
)
# the language in the settings file is not in the folder structure, something went wrong,
# set to the first in the list
- self.m_choiceLanguage.SetSelection(0)
+ self._choiceLanguage.SetSelection(0)
try:
# now get the available SpeechStyles from the folder structure and set to the preference setting is possible
- self.GetSpeechStyles(str(user_preferences["Speech"]["SpeechStyle"]))
+ self.getSpeechStyles(str(userPreferences["Speech"]["SpeechStyle"]))
except Exception as e:
log.exception(f"MathCAT: An exception occurred in set_ui_values (getting SpeechStyle): {e}")
- self.m_choiceSpeechStyle.Append(
- "Error when setting SpeechStyle for " + self.m_choiceLanguage.GetStringSelection(),
+ self._choiceSpeechStyle.Append(
+ "Error when setting SpeechStyle for " + self._choiceLanguage.GetStringSelection(),
)
# set the rest of the UI elements
- self.m_choiceDecimalSeparator.SetSelection(
- Speech_DecimalSeparator.index(user_preferences["Other"]["DecimalSeparator"]),
+ self._choiceDecimalSeparator.SetSelection(
+ Speech_DecimalSeparator.index(userPreferences["Other"]["DecimalSeparator"]),
)
- self.m_choiceSpeechAmount.SetSelection(
- Speech_Verbosity.index(user_preferences["Speech"]["Verbosity"]),
+ self._choiceSpeechAmount.SetSelection(
+ Speech_Verbosity.index(userPreferences["Speech"]["Verbosity"]),
)
- self.m_sliderRelativeSpeed.SetValue(user_preferences["Speech"]["MathRate"])
+ self._sliderRelativeSpeed.SetValue(userPreferences["Speech"]["MathRate"])
pause_factor = (
0
- if int(user_preferences["Speech"]["PauseFactor"]) <= 1
+ if int(userPreferences["Speech"]["PauseFactor"]) <= 1
else round(
math.log(
- int(user_preferences["Speech"]["PauseFactor"]) / PAUSE_FACTOR_SCALE,
+ int(userPreferences["Speech"]["PauseFactor"]) / PAUSE_FACTOR_SCALE,
PAUSE_FACTOR_LOG_BASE,
),
)
)
- self.m_sliderPauseFactor.SetValue(pause_factor)
- self.m_checkBoxSpeechSound.SetValue(user_preferences["Speech"]["SpeechSound"] == "Beep")
- self.m_choiceSpeechForChemical.SetSelection(
- Speech_Chemistry.index(user_preferences["Speech"]["Chemistry"]),
+ self._sliderPauseFactor.SetValue(pause_factor)
+ self._checkBoxSpeechSound.SetValue(userPreferences["Speech"]["SpeechSound"] == "Beep")
+ self._choiceSpeechForChemical.SetSelection(
+ Speech_Chemistry.index(userPreferences["Speech"]["Chemistry"]),
)
- self.m_choiceNavigationMode.SetSelection(
- Navigation_NavMode.index(user_preferences["Navigation"]["NavMode"]),
+ self._choiceNavigationMode.SetSelection(
+ Navigation_NavMode.index(userPreferences["Navigation"]["NavMode"]),
)
- self.m_checkBoxResetNavigationMode.SetValue(user_preferences["Navigation"]["ResetNavMode"])
- self.m_choiceSpeechAmountNavigation.SetSelection(
- Navigation_NavVerbosity.index(user_preferences["Navigation"]["NavVerbosity"]),
+ self._checkBoxResetNavigationMode.SetValue(userPreferences["Navigation"]["ResetNavMode"])
+ self._choiceSpeechAmountNavigation.SetSelection(
+ Navigation_NavVerbosity.index(userPreferences["Navigation"]["NavVerbosity"]),
)
- if user_preferences["Navigation"]["Overview"]:
- self.m_choiceNavigationSpeech.SetSelection(1)
+ if userPreferences["Navigation"]["Overview"]:
+ self._choiceNavigationSpeech.SetSelection(1)
else:
- self.m_choiceNavigationSpeech.SetSelection(0)
- self.m_checkBoxResetNavigationSpeech.SetValue(user_preferences["Navigation"]["ResetOverview"])
- self.m_checkBoxAutomaticZoom.SetValue(user_preferences["Navigation"]["AutoZoomOut"])
- self.m_choiceCopyAs.SetSelection(
- Navigation_CopyAs.index(user_preferences["Navigation"]["CopyAs"]),
+ self._choiceNavigationSpeech.SetSelection(0)
+ self._checkBoxResetNavigationSpeech.SetValue(userPreferences["Navigation"]["ResetOverview"])
+ self._checkBoxAutomaticZoom.SetValue(userPreferences["Navigation"]["AutoZoomOut"])
+ self._choiceCopyAs.SetSelection(
+ Navigation_CopyAs.index(userPreferences["Navigation"]["CopyAs"]),
)
- self.m_choiceBrailleHighlights.SetSelection(
- Braille_BrailleNavHighlight.index(user_preferences["Braille"]["BrailleNavHighlight"]),
+ self._choiceBrailleHighlights.SetSelection(
+ Braille_BrailleNavHighlight.index(userPreferences["Braille"]["BrailleNavHighlight"]),
)
try:
- braille_pref = user_preferences["Braille"]["BrailleCode"]
+ braillePref = userPreferences["Braille"]["BrailleCode"]
i = 0
- while braille_pref != self.m_choiceBrailleMathCode.GetString(i):
+ while braillePref != self._choiceBrailleMathCode.GetString(i):
i = i + 1
- if i == self.m_choiceBrailleMathCode.GetCount():
+ if i == self._choiceBrailleMathCode.GetCount():
break
- if braille_pref == self.m_choiceBrailleMathCode.GetString(i):
- self.m_choiceBrailleMathCode.SetSelection(i)
+ if braillePref == self._choiceBrailleMathCode.GetString(i):
+ self._choiceBrailleMathCode.SetSelection(i)
else:
- self.m_choiceBrailleMathCode.SetSelection(0)
+ self._choiceBrailleMathCode.SetSelection(0)
except Exception as e:
log.exception(f"MathCAT: An exception occurred while trying to set the Braille code: {e}")
# the braille code in the settings file is not in the folder structure, something went wrong,
# set to the first in the list
- self.m_choiceBrailleMathCode.SetSelection(0)
+ self._choiceBrailleMathCode.SetSelection(0)
except KeyError as err:
print("Key not found", err)
- def get_ui_values(self):
- global user_preferences
+ def getUIValues(self):
+ global userPreferences
# read the values from the UI and update the user preferences dictionary
- user_preferences["Speech"]["Impairment"] = Speech_Impairment[self.m_choiceImpairment.GetSelection()]
- user_preferences["Speech"]["Language"] = self.GetLanguageCode()
- user_preferences["Other"]["DecimalSeparator"] = Speech_DecimalSeparator[
- self.m_choiceDecimalSeparator.GetSelection()
+ userPreferences["Speech"]["Impairment"] = Speech_Impairment[self._choiceImpairment.GetSelection()]
+ userPreferences["Speech"]["Language"] = self.getLanguageCode()
+ userPreferences["Other"]["DecimalSeparator"] = Speech_DecimalSeparator[
+ self._choiceDecimalSeparator.GetSelection()
]
- user_preferences["Speech"]["SpeechStyle"] = self.m_choiceSpeechStyle.GetStringSelection()
- user_preferences["Speech"]["Verbosity"] = Speech_Verbosity[self.m_choiceSpeechAmount.GetSelection()]
- user_preferences["Speech"]["MathRate"] = self.m_sliderRelativeSpeed.GetValue()
- pf_slider = self.m_sliderPauseFactor.GetValue()
- pause_factor = (
- 0 if pf_slider == 0 else round(PAUSE_FACTOR_SCALE * math.pow(PAUSE_FACTOR_LOG_BASE, pf_slider))
+ userPreferences["Speech"]["SpeechStyle"] = self._choiceSpeechStyle.GetStringSelection()
+ userPreferences["Speech"]["Verbosity"] = Speech_Verbosity[self._choiceSpeechAmount.GetSelection()]
+ userPreferences["Speech"]["MathRate"] = self._sliderRelativeSpeed.GetValue()
+ pfSlider = self._sliderPauseFactor.GetValue()
+ pauseFactor = (
+ 0 if pfSlider == 0 else round(PAUSE_FACTOR_SCALE * math.pow(PAUSE_FACTOR_LOG_BASE, pfSlider))
) # avoid log(0)
- user_preferences["Speech"]["PauseFactor"] = pause_factor
- if self.m_checkBoxSpeechSound.GetValue():
- user_preferences["Speech"]["SpeechSound"] = "Beep"
+ userPreferences["Speech"]["PauseFactor"] = pauseFactor
+ if self._checkBoxSpeechSound.GetValue():
+ userPreferences["Speech"]["SpeechSound"] = "Beep"
else:
- user_preferences["Speech"]["SpeechSound"] = "None"
- user_preferences["Speech"]["Chemistry"] = Speech_Chemistry[
- self.m_choiceSpeechForChemical.GetSelection()
+ userPreferences["Speech"]["SpeechSound"] = "None"
+ userPreferences["Speech"]["Chemistry"] = Speech_Chemistry[
+ self._choiceSpeechForChemical.GetSelection()
]
- user_preferences["Navigation"]["NavMode"] = Navigation_NavMode[
- self.m_choiceNavigationMode.GetSelection()
+ userPreferences["Navigation"]["NavMode"] = Navigation_NavMode[
+ self._choiceNavigationMode.GetSelection()
]
- user_preferences["Navigation"]["ResetNavMode"] = self.m_checkBoxResetNavigationMode.GetValue()
- user_preferences["Navigation"]["NavVerbosity"] = Navigation_NavVerbosity[
- self.m_choiceSpeechAmountNavigation.GetSelection()
+ userPreferences["Navigation"]["ResetNavMode"] = self._checkBoxResetNavigationMode.GetValue()
+ userPreferences["Navigation"]["NavVerbosity"] = Navigation_NavVerbosity[
+ self._choiceSpeechAmountNavigation.GetSelection()
]
- user_preferences["Navigation"]["Overview"] = self.m_choiceNavigationSpeech.GetSelection() != 0
- user_preferences["Navigation"]["ResetOverview"] = self.m_checkBoxResetNavigationSpeech.GetValue()
- user_preferences["Navigation"]["AutoZoomOut"] = self.m_checkBoxAutomaticZoom.GetValue()
- user_preferences["Navigation"]["CopyAs"] = Navigation_CopyAs[self.m_choiceCopyAs.GetSelection()]
+ userPreferences["Navigation"]["Overview"] = self._choiceNavigationSpeech.GetSelection() != 0
+ userPreferences["Navigation"]["ResetOverview"] = self._checkBoxResetNavigationSpeech.GetValue()
+ userPreferences["Navigation"]["AutoZoomOut"] = self._checkBoxAutomaticZoom.GetValue()
+ userPreferences["Navigation"]["CopyAs"] = Navigation_CopyAs[self._choiceCopyAs.GetSelection()]
- user_preferences["Braille"]["BrailleNavHighlight"] = Braille_BrailleNavHighlight[
- self.m_choiceBrailleHighlights.GetSelection()
+ userPreferences["Braille"]["BrailleNavHighlight"] = Braille_BrailleNavHighlight[
+ self._choiceBrailleHighlights.GetSelection()
]
- user_preferences["Braille"]["BrailleCode"] = self.m_choiceBrailleMathCode.GetStringSelection()
- if "NVDAAddOn" not in user_preferences:
- user_preferences["NVDAAddOn"] = {"LastCategory": "0"}
- user_preferences["NVDAAddOn"]["LastCategory"] = self.m_listBoxPreferencesTopic.GetSelection()
+ userPreferences["Braille"]["BrailleCode"] = self._choiceBrailleMathCode.GetStringSelection()
+ if "NVDAAddOn" not in userPreferences:
+ userPreferences["NVDAAddOn"] = {"LastCategory": "0"}
+ userPreferences["NVDAAddOn"]["LastCategory"] = self._listBoxPreferencesTopic.GetSelection()
@staticmethod
- def path_to_default_preferences():
+ def pathToDefaultPreferences():
return os.path.join(os.path.dirname(os.path.abspath(__file__)), "Rules", "prefs.yaml")
@staticmethod
- def path_to_user_preferences_folder():
+ def pathToUserPreferencesFolder():
# the user preferences file is stored at: C:\Users\AppData\Roaming\MathCAT\prefs.yaml
return os.path.join(os.path.expandvars("%APPDATA%"), "MathCAT")
@staticmethod
- def path_to_user_preferences():
+ def pathToUserPreferences():
# the user preferences file is stored at: C:\Users\AppData\Roaming\MathCAT\prefs.yaml
- return os.path.join(UserInterface.path_to_user_preferences_folder(), "prefs.yaml")
+ return os.path.join(UserInterface.pathToUserPreferencesFolder(), "prefs.yaml")
@staticmethod
- def load_default_preferences():
- global user_preferences
+ def loadDefaultPreferences():
+ global userPreferences
# load default preferences into the user preferences data structure (overwrites existing)
- if os.path.exists(UserInterface.path_to_default_preferences()):
+ if os.path.exists(UserInterface.pathToDefaultPreferences()):
with open(
- UserInterface.path_to_default_preferences(),
+ UserInterface.pathToDefaultPreferences(),
encoding="utf-8",
) as f:
- user_preferences = yaml.load(f, Loader=yaml.FullLoader)
+ userPreferences = yaml.load(f, Loader=yaml.FullLoader)
@staticmethod
- def load_user_preferences():
- global user_preferences
+ def loadUserPreferences():
+ global userPreferences
# merge user file values into the user preferences data structure
- if os.path.exists(UserInterface.path_to_user_preferences()):
- with open(UserInterface.path_to_user_preferences(), encoding="utf-8") as f:
+ if os.path.exists(UserInterface.pathToUserPreferences()):
+ with open(UserInterface.pathToUserPreferences(), encoding="utf-8") as f:
# merge with the default preferences, overwriting with the user's values
- user_preferences.update(yaml.load(f, Loader=yaml.FullLoader))
+ userPreferences.update(yaml.load(f, Loader=yaml.FullLoader))
@staticmethod
- def validate(key1: str, key2: str, valid_values: List[Union[str, bool]], default_value: Union[str, bool]):
- global user_preferences
+ def validate(key1: str, key2: str, validValues: List[Union[str, bool]], defaultValue: Union[str, bool]):
+ global userPreferences
try:
- if valid_values == []:
+ if validValues == []:
# any value is valid
- if user_preferences[key1][key2] != "":
+ if userPreferences[key1][key2] != "":
return
else:
# any value in the list is valid
- if user_preferences[key1][key2] in valid_values:
+ if userPreferences[key1][key2] in validValues:
return
except Exception as e:
log.exception(f"MathCAT: An exception occurred in validate: {e}")
# the preferences entry does not exist
- if key1 not in user_preferences:
- user_preferences[key1] = {key2: default_value}
+ if key1 not in userPreferences:
+ userPreferences[key1] = {key2: defaultValue}
else:
- user_preferences[key1][key2] = default_value
+ userPreferences[key1][key2] = defaultValue
@staticmethod
- def validate_int(key1: str, key2: str, valid_values: List[int], default_value: int):
- global user_preferences
+ def validateInt(key1: str, key2: str, validValues: List[int], defaultValue: int):
+ global userPreferences
try:
# any value between lower and upper bounds is valid
if (
- int(user_preferences[key1][key2]) >= valid_values[0]
- and int(user_preferences[key1][key2]) <= valid_values[1]
+ int(userPreferences[key1][key2]) >= validValues[0]
+ and int(userPreferences[key1][key2]) <= validValues[1]
):
return
except Exception as e:
- log.exception(f"MathCAT: An exception occurred in validate_int: {e}")
+ log.exception(f"MathCAT: An exception occurred in validateInt: {e}")
# the preferences entry does not exist
- if key1 not in user_preferences:
- user_preferences[key1] = {key2: default_value}
+ if key1 not in userPreferences:
+ userPreferences[key1] = {key2: defaultValue}
else:
- user_preferences[key1][key2] = default_value
+ userPreferences[key1][key2] = defaultValue
@staticmethod
- def validate_user_preferences():
+ def validateUserPreferences():
# check each user preference value to ensure it is present and valid, set default value if not
# Speech:
# Impairment: Blindness # LearningDisability, LowVision, Blindness
@@ -641,9 +639,9 @@ def validate_user_preferences():
# Verbosity: Medium # Terse, Medium, Verbose
UserInterface.validate("Speech", "Verbosity", ["Terse", "Medium", "Verbose"], "Medium")
# MathRate: 100 # Change from text speech rate (%)
- UserInterface.validate_int("Speech", "MathRate", [0, 200], 100)
+ UserInterface.validateInt("Speech", "MathRate", [0, 200], 100)
# PauseFactor: 100 # TBC
- UserInterface.validate_int("Speech", "PauseFactor", [0, 1000], 100)
+ UserInterface.validateInt("Speech", "PauseFactor", [0, 1000], 100)
# SpeechSound: None # make a sound when starting/ending math speech -- None, Beep
UserInterface.validate("Speech", "SpeechSound", ["None", "Beep"], "None")
# SpeechStyle: ClearSpeak # Any known speech style (falls back to ClearSpeak)
@@ -680,38 +678,38 @@ def validate_user_preferences():
UserInterface.validate("Braille", "BrailleCode", [], "Nemeth")
@staticmethod
- def write_user_preferences():
+ def writeUserPreferences():
# Language is special because it is set elsewhere by SetPreference which overrides the user_prefs -- so set it here
from . import libmathcat_py as libmathcat
try:
- libmathcat.SetPreference("Language", user_preferences["Speech"]["Language"])
+ libmathcat.SetPreference("Language", userPreferences["Speech"]["Language"])
except Exception as e:
log.exception(
- f'Error in trying to set MathCAT "Language" preference to "{user_preferences["Speech"]["Language"]}": {e}',
+ f'Error in trying to set MathCAT "Language" preference to "{userPreferences["Speech"]["Language"]}": {e}',
)
- if not os.path.exists(UserInterface.path_to_user_preferences_folder()):
+ if not os.path.exists(UserInterface.pathToUserPreferencesFolder()):
# create a folder for the user preferences
- os.mkdir(UserInterface.path_to_user_preferences_folder())
- with open(UserInterface.path_to_user_preferences(), "w", encoding="utf-8") as f:
+ os.mkdir(UserInterface.pathToUserPreferencesFolder())
+ with open(UserInterface.pathToUserPreferences(), "w", encoding="utf-8") as f:
# write values to the user preferences file, NOT the default
- yaml.dump(user_preferences, stream=f, allow_unicode=True)
+ yaml.dump(userPreferences, stream=f, allow_unicode=True)
- def OnRelativeSpeedChanged(self, event):
- rate = self.m_sliderRelativeSpeed.GetValue()
+ def onRelativeSpeedChanged(self, event):
+ rate = self._sliderRelativeSpeed.GetValue()
# Translators: this is a test string that is spoken. Only translate "the square root of x squared plus y squared"
text = _("the square root of x squared plus y squared").replace(
"XXX",
str(rate),
1,
)
- speak(ConvertSSMLTextForNVDA(text))
+ speak(convertSSMLTextForNVDA(text))
- def OnPauseFactorChanged(self, event):
- rate = self.m_sliderRelativeSpeed.GetValue()
- pf_slider = self.m_sliderPauseFactor.GetValue()
- pause_factor = (
- 0 if pf_slider == 0 else round(PAUSE_FACTOR_SCALE * math.pow(PAUSE_FACTOR_LOG_BASE, pf_slider))
+ def onPauseFactorChanged(self, event):
+ rate = self._sliderRelativeSpeed.GetValue()
+ pfSlider = self._sliderPauseFactor.GetValue()
+ pauseFactor = (
+ 0 if pfSlider == 0 else round(PAUSE_FACTOR_SCALE * math.pow(PAUSE_FACTOR_LOG_BASE, pfSlider))
)
text = _(
# Translators: this is a test string that is spoken. Only translate "the fraction with numerator"
@@ -727,93 +725,93 @@ def OnPauseFactorChanged(self, event):
end fraction ",
).format(
rate=rate,
- pause_factor_128=128 * pause_factor // 100,
- pause_factor_150=150 * pause_factor // 100,
- pause_factor_300=300 * pause_factor // 100,
- pause_factor_600=600 * pause_factor // 100,
+ pause_factor_128=128 * pauseFactor // 100,
+ pause_factor_150=150 * pauseFactor // 100,
+ pause_factor_300=300 * pauseFactor // 100,
+ pause_factor_600=600 * pauseFactor // 100,
)
- speak(ConvertSSMLTextForNVDA(text))
+ speak(convertSSMLTextForNVDA(text))
- def OnClickOK(self, event):
- UserInterface.get_ui_values(self)
- UserInterface.write_user_preferences()
+ def onClickOK(self, event):
+ UserInterface.getUIValues(self)
+ UserInterface.writeUserPreferences()
self.Destroy()
- def OnClickCancel(self, event):
+ def onClickCancel(self, event):
self.Destroy()
- def OnClickApply(self, event):
- UserInterface.get_ui_values(self)
- UserInterface.write_user_preferences()
+ def onClickApply(self, event):
+ UserInterface.getUIValues(self)
+ UserInterface.writeUserPreferences()
- def OnClickReset(self, event):
- UserInterface.load_default_preferences()
- UserInterface.validate_user_preferences()
- UserInterface.set_ui_values(self)
+ def onClickReset(self, event):
+ UserInterface.loadDefaultPreferences()
+ UserInterface.validateUserPreferences()
+ UserInterface.setUIValues(self)
- def OnClickHelp(self, event):
+ def onClickHelp(self, event):
webbrowser.open("https://nsoiffer.github.io/MathCAT/users.html")
- def OnListBoxCategories(self, event):
+ def onListBoxCategories(self, event):
# the category changed, now show the appropriate dialogue page
- self.m_simplebookPanelsCategories.SetSelection(self.m_listBoxPreferencesTopic.GetSelection())
+ self._simplebookPanelsCategories.SetSelection(self._listBoxPreferencesTopic.GetSelection())
- def OnLanguage(self, event):
+ def onLanguage(self, event):
# the language changed, get the SpeechStyles for the new language
- UserInterface.GetSpeechStyles(self, self.m_choiceSpeechStyle.GetStringSelection())
+ UserInterface.getSpeechStyles(self, self._choiceSpeechStyle.GetStringSelection())
- def MathCATPreferencesDialogOnCharHook(self, event: wx.KeyEvent):
+ def mathCATPreferencesDialogOnCharHook(self, event: wx.KeyEvent):
# designed choice is that Enter is the same as clicking OK, and Escape is the same as clicking Cancel
keyCode = event.GetKeyCode()
if keyCode == wx.WXK_ESCAPE:
- UserInterface.OnClickCancel(self, event)
+ UserInterface.onClickCancel(self, event)
return
if keyCode == wx.WXK_RETURN:
- UserInterface.OnClickOK(self, event)
+ UserInterface.onClickOK(self, event)
if keyCode == wx.WXK_TAB:
if event.GetModifiers() == wx.MOD_CONTROL:
# cycle the category forward
- new_category = self.m_listBoxPreferencesTopic.GetSelection() + 1
- if new_category == 3:
- new_category = 0
- self.m_listBoxPreferencesTopic.SetSelection(new_category)
+ newCategory = self._listBoxPreferencesTopic.GetSelection() + 1
+ if newCategory == 3:
+ newCategory = 0
+ self._listBoxPreferencesTopic.SetSelection(newCategory)
# update the ui to show the new page
- UserInterface.OnListBoxCategories(self, event)
+ UserInterface.onListBoxCategories(self, event)
# set the focus into the category list box
- self.m_listBoxPreferencesTopic.SetFocus()
+ self._listBoxPreferencesTopic.SetFocus()
# jump out so the tab key is not processed
return
if event.GetModifiers() == wx.MOD_CONTROL | wx.MOD_SHIFT:
# cycle the category back
- new_category = self.m_listBoxPreferencesTopic.GetSelection() - 1
- if new_category == -1:
- new_category = 2
- self.m_listBoxPreferencesTopic.SetSelection(new_category)
+ newCategory = self._listBoxPreferencesTopic.GetSelection() - 1
+ if newCategory == -1:
+ newCategory = 2
+ self._listBoxPreferencesTopic.SetSelection(newCategory)
# update the ui to show the new page
- UserInterface.OnListBoxCategories(self, event)
+ UserInterface.onListBoxCategories(self, event)
# update the ui to show the new page
- self.m_listBoxPreferencesTopic.SetFocus()
+ self._listBoxPreferencesTopic.SetFocus()
# jump out so the tab key is not processed
return
if event.GetModifiers() == wx.MOD_NONE and (
- MathCATgui.MathCATPreferencesDialog.FindFocus() == self.m_listBoxPreferencesTopic
+ MathCATgui.MathCATPreferencesDialog.FindFocus() == self._listBoxPreferencesTopic
):
- if self.m_listBoxPreferencesTopic.GetSelection() == 0:
- self.m_choiceImpairment.SetFocus()
- elif self.m_listBoxPreferencesTopic.GetSelection() == 1:
- self.m_choiceNavigationMode.SetFocus()
- elif self.m_listBoxPreferencesTopic.GetSelection() == 2:
- self.m_choiceBrailleMathCode.SetFocus()
+ if self._listBoxPreferencesTopic.GetSelection() == 0:
+ self._choiceImpairment.SetFocus()
+ elif self._listBoxPreferencesTopic.GetSelection() == 1:
+ self._choiceNavigationMode.SetFocus()
+ elif self._listBoxPreferencesTopic.GetSelection() == 2:
+ self._choiceBrailleMathCode.SetFocus()
return
if (event.GetModifiers() == wx.MOD_SHIFT) and (
- MathCATgui.MathCATPreferencesDialog.FindFocus() == self.m_buttonOK
+ MathCATgui.MathCATPreferencesDialog.FindFocus() == self._buttonOK
):
- if self.m_listBoxPreferencesTopic.GetSelection() == 0:
- self.m_choiceSpeechForChemical.SetFocus()
- elif self.m_listBoxPreferencesTopic.GetSelection() == 1:
- self.m_choiceSpeechAmountNavigation.SetFocus()
- elif self.m_listBoxPreferencesTopic.GetSelection() == 2:
- self.m_choiceBrailleHighlights.SetFocus()
+ if self._listBoxPreferencesTopic.GetSelection() == 0:
+ self._choiceSpeechForChemical.SetFocus()
+ elif self._listBoxPreferencesTopic.GetSelection() == 1:
+ self._choiceSpeechAmountNavigation.SetFocus()
+ elif self._listBoxPreferencesTopic.GetSelection() == 2:
+ self._choiceBrailleHighlights.SetFocus()
return
# continue handling keyboard event
event.Skip()
diff --git a/addon/globalPlugins/MathCAT/MathCATgui.py b/addon/globalPlugins/MathCAT/MathCATgui.py
index 0a3b6328..de214e58 100644
--- a/addon/globalPlugins/MathCAT/MathCATgui.py
+++ b/addon/globalPlugins/MathCAT/MathCATgui.py
@@ -31,7 +31,7 @@ def __init__(self, parent):
gbSizerMathCATPreferences.SetFlexibleDirection(wx.BOTH)
gbSizerMathCATPreferences.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
- self.m_panelCategories = wx.Panel(
+ self._panelCategories = wx.Panel(
self,
wx.ID_ANY,
wx.DefaultPosition,
@@ -40,8 +40,8 @@ def __init__(self, parent):
)
bSizerCategories = wx.BoxSizer(wx.VERTICAL)
- self.m_staticTextCategories = wx.StaticText(
- self.m_panelCategories,
+ self._staticTextCategories = wx.StaticText(
+ self._panelCategories,
wx.ID_ANY,
# Translators: A heading that labels three navigation pane tab names in the MathCAT dialog
_("Categories:"),
@@ -49,11 +49,11 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextCategories.Wrap(-1)
+ self._staticTextCategories.Wrap(-1)
- bSizerCategories.Add(self.m_staticTextCategories, 0, wx.ALL, 5)
+ bSizerCategories.Add(self._staticTextCategories, 0, wx.ALL, 5)
- m_listBoxPreferencesTopicChoices = [
+ listBoxPreferencesTopicChoices = [
# Translators: these are navigation pane headings for the MathCAT preferences dialog under the title "Categories"
_("Speech"),
# Translators: these are navigation pane headings for the MathCAT preferences dialog under the title "Categories"
@@ -61,48 +61,48 @@ def __init__(self, parent):
# Translators: these are navigation pane headings for the MathCAT preferences dialog under the title "Categories"
_("Braille"),
]
- self.m_listBoxPreferencesTopic = wx.ListBox(
- self.m_panelCategories,
+ self._listBoxPreferencesTopic = wx.ListBox(
+ self._panelCategories,
wx.ID_ANY,
wx.Point(-1, -1),
wx.Size(-1, -1),
- m_listBoxPreferencesTopicChoices,
+ listBoxPreferencesTopicChoices,
wx.LB_NO_SB | wx.LB_SINGLE,
)
- bSizerCategories.Add(self.m_listBoxPreferencesTopic, 0, wx.ALL, 5)
+ bSizerCategories.Add(self._listBoxPreferencesTopic, 0, wx.ALL, 5)
bSizerCategories.Add((0, 0), 1, wx.EXPAND, 5)
- self.m_bitmapLogo = wx.StaticBitmap(
- self.m_panelCategories,
+ self._bitmapLogo = wx.StaticBitmap(
+ self._panelCategories,
wx.ID_ANY,
wx.NullBitmap,
wx.DefaultPosition,
wx.Size(126, 85),
0,
)
- bSizerCategories.Add(self.m_bitmapLogo, 0, wx.ALL, 5)
+ bSizerCategories.Add(self._bitmapLogo, 0, wx.ALL, 5)
- self.m_panelCategories.SetSizer(bSizerCategories)
- self.m_panelCategories.Layout()
- bSizerCategories.Fit(self.m_panelCategories)
+ self._panelCategories.SetSizer(bSizerCategories)
+ self._panelCategories.Layout()
+ bSizerCategories.Fit(self._panelCategories)
gbSizerMathCATPreferences.Add(
- self.m_panelCategories,
+ self._panelCategories,
wx.GBPosition(0, 0),
wx.GBSpan(1, 1),
wx.EXPAND | wx.ALL,
5,
)
- self.m_simplebookPanelsCategories = wx.Simplebook(
+ self._simplebookPanelsCategories = wx.Simplebook(
self,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
0,
)
- self.m_panelSpeech = wx.Panel(
- self.m_simplebookPanelsCategories,
+ self._panelSpeech = wx.Panel(
+ self._simplebookPanelsCategories,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
@@ -112,8 +112,8 @@ def __init__(self, parent):
bSizerImpairment = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextImpairment = wx.StaticText(
- self.m_panelSpeech,
+ self._staticTextImpairment = wx.StaticText(
+ self._panelSpeech,
wx.ID_ANY,
# Translators: this is the text label for whom to target the speech for (options are below)
_("Generate speech for:"),
@@ -121,11 +121,11 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextImpairment.Wrap(-1)
+ self._staticTextImpairment.Wrap(-1)
- bSizerImpairment.Add(self.m_staticTextImpairment, 0, wx.ALL, 5)
+ bSizerImpairment.Add(self._staticTextImpairment, 0, wx.ALL, 5)
- m_choiceImpairmentChoices = [
+ impairmentChoices = [
# Translators: these are the categories of impairments that MathCAT supports
# Translators: Learning disabilities includes dyslexia and ADHD
_("Learning disabilities"),
@@ -134,23 +134,23 @@ def __init__(self, parent):
# Translators: target people who have low vision
_("Low vision"),
]
- self.m_choiceImpairment = wx.Choice(
- self.m_panelSpeech,
+ self._choiceImpairment = wx.Choice(
+ self._panelSpeech,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceImpairmentChoices,
+ impairmentChoices,
0,
)
- self.m_choiceImpairment.SetSelection(1)
- bSizerImpairment.Add(self.m_choiceImpairment, 0, wx.ALL, 5)
+ self._choiceImpairment.SetSelection(1)
+ bSizerImpairment.Add(self._choiceImpairment, 0, wx.ALL, 5)
bSizerSpeech.Add(bSizerImpairment, 1, wx.EXPAND, 5)
bSizerLanguage = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextLanguage = wx.StaticText(
- self.m_panelSpeech,
+ self._staticTextLanguage = wx.StaticText(
+ self._panelSpeech,
wx.ID_ANY,
# Translators: label for pull down allowing users to choose the speech language for math
_("Language:"),
@@ -158,28 +158,28 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextLanguage.Wrap(-1)
+ self._staticTextLanguage.Wrap(-1)
- bSizerLanguage.Add(self.m_staticTextLanguage, 0, wx.ALL, 5)
+ bSizerLanguage.Add(self._staticTextLanguage, 0, wx.ALL, 5)
- m_choiceLanguageChoices = ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]
- self.m_choiceLanguage = wx.Choice(
- self.m_panelSpeech,
+ languageChoices = ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]
+ self._choiceLanguage = wx.Choice(
+ self._panelSpeech,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceLanguageChoices,
+ languageChoices,
0,
)
- self.m_choiceLanguage.SetSelection(0)
- bSizerLanguage.Add(self.m_choiceLanguage, 0, wx.ALL, 5)
+ self._choiceLanguage.SetSelection(0)
+ bSizerLanguage.Add(self._choiceLanguage, 0, wx.ALL, 5)
bSizerSpeech.Add(bSizerLanguage, 1, wx.EXPAND, 5)
bSizerDecimalSeparator = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextDecimalSeparator = wx.StaticText(
- self.m_panelSpeech,
+ self._staticTextDecimalSeparator = wx.StaticText(
+ self._panelSpeech,
wx.ID_ANY,
# Translators: label for pull down to specify what character to use in numbers as the decimal separator
_("Decimal separator for numbers:"),
@@ -187,12 +187,12 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextDecimalSeparator.Wrap(-1)
+ self._staticTextDecimalSeparator.Wrap(-1)
- bSizerDecimalSeparator.Add(self.m_staticTextDecimalSeparator, 0, wx.ALL, 5)
+ bSizerDecimalSeparator.Add(self._staticTextDecimalSeparator, 0, wx.ALL, 5)
# Translators: options for decimal separator.
- m_choiceDecimalSeparatorChoices = [
+ decimalSeparatorChoices = [
# Translators: options for decimal separator -- "Auto" = automatically pick the choice based on the language
_("Auto"),
# options for decimal separator -- use "." (and use ", " for block separators)
@@ -203,23 +203,23 @@ def __init__(self, parent):
# Currently there is no UI for how it is done yet, but eventually there will be a dialog that pops up to set it
_("Custom"),
]
- self.m_choiceDecimalSeparator = wx.Choice(
- self.m_panelSpeech,
+ self._choiceDecimalSeparator = wx.Choice(
+ self._panelSpeech,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceDecimalSeparatorChoices,
+ decimalSeparatorChoices,
0,
)
- self.m_choiceDecimalSeparator.SetSelection(0)
- bSizerDecimalSeparator.Add(self.m_choiceDecimalSeparator, 0, wx.ALL, 5)
+ self._choiceDecimalSeparator.SetSelection(0)
+ bSizerDecimalSeparator.Add(self._choiceDecimalSeparator, 0, wx.ALL, 5)
bSizerSpeech.Add(bSizerDecimalSeparator, 1, wx.EXPAND, 5)
bSizerSpeechStyle = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextSpeechStyle = wx.StaticText(
- self.m_panelSpeech,
+ self._staticTextSpeechStyle = wx.StaticText(
+ self._panelSpeech,
wx.ID_ANY,
# Translators: label for pull down allowing users to choose the "style" (version, rules) of speech for math
_("Speech style:"),
@@ -227,28 +227,28 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextSpeechStyle.Wrap(-1)
+ self._staticTextSpeechStyle.Wrap(-1)
- bSizerSpeechStyle.Add(self.m_staticTextSpeechStyle, 0, wx.ALL, 5)
+ bSizerSpeechStyle.Add(self._staticTextSpeechStyle, 0, wx.ALL, 5)
- m_choiceSpeechStyleChoices = ["xxxxxxxxxxxxxxxx"]
- self.m_choiceSpeechStyle = wx.Choice(
- self.m_panelSpeech,
+ speechStyleChoices = ["xxxxxxxxxxxxxxxx"]
+ self._choiceSpeechStyle = wx.Choice(
+ self._panelSpeech,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceSpeechStyleChoices,
+ speechStyleChoices,
0,
)
- self.m_choiceSpeechStyle.SetSelection(0)
- bSizerSpeechStyle.Add(self.m_choiceSpeechStyle, 0, wx.ALL, 5)
+ self._choiceSpeechStyle.SetSelection(0)
+ bSizerSpeechStyle.Add(self._choiceSpeechStyle, 0, wx.ALL, 5)
bSizerSpeech.Add(bSizerSpeechStyle, 1, wx.EXPAND, 5)
bSizerSpeechAmount = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextSpeechAmount = wx.StaticText(
- self.m_panelSpeech,
+ self._staticTextSpeechAmount = wx.StaticText(
+ self._panelSpeech,
wx.ID_ANY,
# Translators: label for pull down to specify how verbose/terse the speech should be
_("Speech verbosity:"),
@@ -256,12 +256,12 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextSpeechAmount.Wrap(-1)
+ self._staticTextSpeechAmount.Wrap(-1)
- bSizerSpeechAmount.Add(self.m_staticTextSpeechAmount, 0, wx.ALL, 5)
+ bSizerSpeechAmount.Add(self._staticTextSpeechAmount, 0, wx.ALL, 5)
# Translators: options for speech verbosity.
- m_choiceSpeechAmountChoices = [
+ speechAmountChoices = [
# Translators: options for speech verbosity -- "terse" = use less words
_("Terse"),
# Translators: options for speech verbosity -- "medium" = try to be nether too terse nor too verbose words
@@ -269,23 +269,23 @@ def __init__(self, parent):
# Translators: options for speech verbosity -- "verbose" = use more words
_("Verbose"),
]
- self.m_choiceSpeechAmount = wx.Choice(
- self.m_panelSpeech,
+ self._choiceSpeechAmount = wx.Choice(
+ self._panelSpeech,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceSpeechAmountChoices,
+ speechAmountChoices,
0,
)
- self.m_choiceSpeechAmount.SetSelection(0)
- bSizerSpeechAmount.Add(self.m_choiceSpeechAmount, 0, wx.ALL, 5)
+ self._choiceSpeechAmount.SetSelection(0)
+ bSizerSpeechAmount.Add(self._choiceSpeechAmount, 0, wx.ALL, 5)
bSizerSpeech.Add(bSizerSpeechAmount, 1, wx.EXPAND, 5)
bSizerRelativeSpeed = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextRelativeSpeed = wx.StaticText(
- self.m_panelSpeech,
+ self._staticTextRelativeSpeed = wx.StaticText(
+ self._panelSpeech,
wx.ID_ANY,
# Translators: label for slider that specifies a percentage of the normal speech rate that should be used for math
_("Relative speech rate:"),
@@ -293,12 +293,12 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextRelativeSpeed.Wrap(-1)
+ self._staticTextRelativeSpeed.Wrap(-1)
- bSizerRelativeSpeed.Add(self.m_staticTextRelativeSpeed, 0, wx.ALL, 5)
+ bSizerRelativeSpeed.Add(self._staticTextRelativeSpeed, 0, wx.ALL, 5)
- self.m_sliderRelativeSpeed = wx.Slider(
- self.m_panelSpeech,
+ self._sliderRelativeSpeed = wx.Slider(
+ self._panelSpeech,
wx.ID_ANY,
100,
10,
@@ -307,15 +307,15 @@ def __init__(self, parent):
wx.DefaultSize,
wx.SL_HORIZONTAL,
)
- self.m_sliderRelativeSpeed.SetLineSize(9)
- bSizerRelativeSpeed.Add(self.m_sliderRelativeSpeed, 0, wx.ALL, 5)
+ self._sliderRelativeSpeed.SetLineSize(9)
+ bSizerRelativeSpeed.Add(self._sliderRelativeSpeed, 0, wx.ALL, 5)
bSizerSpeech.Add(bSizerRelativeSpeed, 1, wx.EXPAND, 5)
bSizerPauseFactor = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticPauseFactor = wx.StaticText(
- self.m_panelSpeech,
+ self._staticPauseFactor = wx.StaticText(
+ self._panelSpeech,
wx.ID_ANY,
# Translators: label for slider that specifies relative factor to increase or decrease pauses in the math speech
_("Pause factor:"),
@@ -323,12 +323,12 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticPauseFactor.Wrap(-1)
+ self._staticPauseFactor.Wrap(-1)
- bSizerPauseFactor.Add(self.m_staticPauseFactor, 0, wx.ALL, 5)
+ bSizerPauseFactor.Add(self._staticPauseFactor, 0, wx.ALL, 5)
- self.m_sliderPauseFactor = wx.Slider(
- self.m_panelSpeech,
+ self._sliderPauseFactor = wx.Slider(
+ self._panelSpeech,
wx.ID_ANY,
7,
0,
@@ -337,14 +337,14 @@ def __init__(self, parent):
wx.DefaultSize,
wx.SL_HORIZONTAL,
)
- bSizerPauseFactor.Add(self.m_sliderPauseFactor, 0, wx.ALL, 5)
+ bSizerPauseFactor.Add(self._sliderPauseFactor, 0, wx.ALL, 5)
bSizerSpeech.Add(bSizerPauseFactor, 1, wx.EXPAND, 5)
bSizerSpeechSound = wx.BoxSizer(wx.HORIZONTAL)
- self.m_checkBoxSpeechSound = wx.CheckBox(
- self.m_panelSpeech,
+ self._checkBoxSpeechSound = wx.CheckBox(
+ self._panelSpeech,
wx.ID_ANY,
# Translators: label for check box controling a beep sound
_("Make a sound when starting/ending math speech"),
@@ -352,14 +352,14 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- bSizerSpeechSound.Add(self.m_checkBoxSpeechSound, 0, wx.ALL, 5)
+ bSizerSpeechSound.Add(self._checkBoxSpeechSound, 0, wx.ALL, 5)
bSizerSpeech.Add(bSizerSpeechSound, 1, wx.EXPAND, 5)
bSizerSubjectArea = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextSubjectArea = wx.StaticText(
- self.m_panelSpeech,
+ self._staticTextSubjectArea = wx.StaticText(
+ self._panelSpeech,
wx.ID_ANY,
# Translators: label for pull down to specify a subject area (Geometry, Calculus, ...)
_("Subject area to be used when it cannot be determined automatically:"),
@@ -367,29 +367,29 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextSubjectArea.Wrap(-1)
+ self._staticTextSubjectArea.Wrap(-1)
- bSizerSubjectArea.Add(self.m_staticTextSubjectArea, 0, wx.ALL, 5)
+ bSizerSubjectArea.Add(self._staticTextSubjectArea, 0, wx.ALL, 5)
# Translators: a generic (non-specific) math subject area
- m_choiceSubjectAreaChoices = [_("General")]
- self.m_choiceSubjectArea = wx.Choice(
- self.m_panelSpeech,
+ subjectAreaChoices = [_("General")]
+ self._choiceSubjectArea = wx.Choice(
+ self._panelSpeech,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceSubjectAreaChoices,
+ subjectAreaChoices,
0,
)
- self.m_choiceSubjectArea.SetSelection(0)
- bSizerSubjectArea.Add(self.m_choiceSubjectArea, 0, wx.ALL, 5)
+ self._choiceSubjectArea.SetSelection(0)
+ bSizerSubjectArea.Add(self._choiceSubjectArea, 0, wx.ALL, 5)
bSizerSpeech.Add(bSizerSubjectArea, 1, wx.EXPAND, 5)
bSizerSpeechForChemical = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextSpeechForChemical = wx.StaticText(
- self.m_panelSpeech,
+ self._staticTextSpeechForChemical = wx.StaticText(
+ self._panelSpeech,
wx.ID_ANY,
# Translators: label for pull down to specify how verbose/terse the speech should be
_("Speech for chemical formulas:"),
@@ -397,35 +397,35 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextSpeechForChemical.Wrap(-1)
+ self._staticTextSpeechForChemical.Wrap(-1)
- bSizerSpeechForChemical.Add(self.m_staticTextSpeechForChemical, 0, wx.ALL, 5)
+ bSizerSpeechForChemical.Add(self._staticTextSpeechForChemical, 0, wx.ALL, 5)
- m_choiceSpeechForChemicalChoices = [
+ speechForChemicalChoices = [
# Translators: values for chemistry options with example speech in parenthesis
_("Spell it out (H 2 O)"),
# Translators: values for chemistry options with example speech in parenthesis (never interpret as chemistry)
_("Off (H sub 2 O)"),
]
- self.m_choiceSpeechForChemical = wx.Choice(
- self.m_panelSpeech,
+ self._choiceSpeechForChemical = wx.Choice(
+ self._panelSpeech,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceSpeechForChemicalChoices,
+ speechForChemicalChoices,
0,
)
- self.m_choiceSpeechForChemical.SetSelection(0)
- bSizerSpeechForChemical.Add(self.m_choiceSpeechForChemical, 0, wx.ALL, 5)
+ self._choiceSpeechForChemical.SetSelection(0)
+ bSizerSpeechForChemical.Add(self._choiceSpeechForChemical, 0, wx.ALL, 5)
bSizerSpeech.Add(bSizerSpeechForChemical, 1, wx.EXPAND, 5)
- self.m_panelSpeech.SetSizer(bSizerSpeech)
- self.m_panelSpeech.Layout()
- bSizerSpeech.Fit(self.m_panelSpeech)
- self.m_simplebookPanelsCategories.AddPage(self.m_panelSpeech, "a page", False)
- self.m_panelNavigation = wx.Panel(
- self.m_simplebookPanelsCategories,
+ self._panelSpeech.SetSizer(bSizerSpeech)
+ self._panelSpeech.Layout()
+ bSizerSpeech.Fit(self._panelSpeech)
+ self._simplebookPanelsCategories.AddPage(self._panelSpeech, "a page", False)
+ self._panelNavigation = wx.Panel(
+ self._simplebookPanelsCategories,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
@@ -435,7 +435,7 @@ def __init__(self, parent):
sbSizerNavigationMode = wx.StaticBoxSizer(
wx.StaticBox(
- self.m_panelNavigation,
+ self._panelNavigation,
wx.ID_ANY,
# Translators: label for pull down to specify one of three modes use to navigate math expressions
_("Navigation mode to use when beginning to navigate an equation:"),
@@ -443,7 +443,7 @@ def __init__(self, parent):
wx.VERTICAL,
)
- m_choiceNavigationModeChoices = [
+ navigationModeChoices = [
# Translators: names of different modes of navigation. "Enhanced" mode understands math structure
_("Enhanced"),
# Translators: "Simple" walks by character expect for things like fractions, roots, and scripts
@@ -451,18 +451,18 @@ def __init__(self, parent):
# Translators: "Character" moves around by character, automatically moving into fractions, etc
_("Character"),
]
- self.m_choiceNavigationMode = wx.Choice(
+ self._choiceNavigationMode = wx.Choice(
sbSizerNavigationMode.GetStaticBox(),
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceNavigationModeChoices,
+ navigationModeChoices,
0,
)
- self.m_choiceNavigationMode.SetSelection(1)
- sbSizerNavigationMode.Add(self.m_choiceNavigationMode, 0, wx.ALL, 5)
+ self._choiceNavigationMode.SetSelection(1)
+ sbSizerNavigationMode.Add(self._choiceNavigationMode, 0, wx.ALL, 5)
- self.m_checkBoxResetNavigationMode = wx.CheckBox(
+ self._checkBoxResetNavigationMode = wx.CheckBox(
sbSizerNavigationMode.GetStaticBox(),
wx.ID_ANY,
# Translators: label for checkbox that controls whether any changes to the navigation mode should be preserved
@@ -471,13 +471,13 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- sbSizerNavigationMode.Add(self.m_checkBoxResetNavigationMode, 0, wx.ALL, 5)
+ sbSizerNavigationMode.Add(self._checkBoxResetNavigationMode, 0, wx.ALL, 5)
bSizerNavigation.Add(sbSizerNavigationMode, 1, wx.EXPAND, 5)
sbSizerNavigationSpeech = wx.StaticBoxSizer(
wx.StaticBox(
- self.m_panelNavigation,
+ self._panelNavigation,
wx.ID_ANY,
# Translators: label for pull down to specify whether the expression is spoken or described (an overview)
_("Navigation speech to use when beginning to navigate an equation:"),
@@ -486,24 +486,24 @@ def __init__(self, parent):
)
# Translators: either "Speak" the expression or give a description (overview) of the expression
- m_choiceNavigationSpeechChoices = [
+ navigationSpeechChoices = [
# Translators: "Speak" the expression after moving to it
_("Speak"),
# Translators: "Describe" the expression after moving to it ("overview is a synonym")
_("Describe/overview"),
]
- self.m_choiceNavigationSpeech = wx.Choice(
+ self._choiceNavigationSpeech = wx.Choice(
sbSizerNavigationSpeech.GetStaticBox(),
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceNavigationSpeechChoices,
+ navigationSpeechChoices,
0,
)
- self.m_choiceNavigationSpeech.SetSelection(1)
- sbSizerNavigationSpeech.Add(self.m_choiceNavigationSpeech, 0, wx.ALL, 5)
+ self._choiceNavigationSpeech.SetSelection(1)
+ sbSizerNavigationSpeech.Add(self._choiceNavigationSpeech, 0, wx.ALL, 5)
- self.m_checkBoxResetNavigationSpeech = wx.CheckBox(
+ self._checkBoxResetNavigationSpeech = wx.CheckBox(
sbSizerNavigationSpeech.GetStaticBox(),
wx.ID_ANY,
# Translators: label for checkbox that controls whether any changes to the speak vs overview reading should be ignored
@@ -512,15 +512,15 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_checkBoxResetNavigationSpeech.SetValue(True)
- sbSizerNavigationSpeech.Add(self.m_checkBoxResetNavigationSpeech, 0, wx.ALL, 5)
+ self._checkBoxResetNavigationSpeech.SetValue(True)
+ sbSizerNavigationSpeech.Add(self._checkBoxResetNavigationSpeech, 0, wx.ALL, 5)
bSizerNavigation.Add(sbSizerNavigationSpeech, 1, wx.EXPAND, 5)
bSizerNavigationZoom = wx.BoxSizer(wx.VERTICAL)
- self.m_checkBoxAutomaticZoom = wx.CheckBox(
- self.m_panelNavigation,
+ self._checkBoxAutomaticZoom = wx.CheckBox(
+ self._panelNavigation,
wx.ID_ANY,
# Translators: label for checkbox that controls whether arrow keys move out of fractions, etc.,
# or whether you have to manually back out of the fraction, etc.
@@ -529,12 +529,12 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- bSizerNavigationZoom.Add(self.m_checkBoxAutomaticZoom, 0, wx.ALL, 5)
+ bSizerNavigationZoom.Add(self._checkBoxAutomaticZoom, 0, wx.ALL, 5)
bSizerSpeechAmountNavigation = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextSpeechAmountNavigation = wx.StaticText(
- self.m_panelNavigation,
+ self._staticTextSpeechAmountNavigation = wx.StaticText(
+ self._panelNavigation,
wx.ID_ANY,
# Translators: label for pull down to specify whether you want a terse or verbose reading of navigation commands
_("Speech amount for navigation:"),
@@ -542,12 +542,12 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextSpeechAmountNavigation.Wrap(-1)
+ self._staticTextSpeechAmountNavigation.Wrap(-1)
- bSizerSpeechAmountNavigation.Add(self.m_staticTextSpeechAmountNavigation, 0, wx.ALL, 5)
+ bSizerSpeechAmountNavigation.Add(self._staticTextSpeechAmountNavigation, 0, wx.ALL, 5)
# Translators: options for navigation verbosity.
- m_choiceSpeechAmountNavigationChoices = [
+ speechAmountNavigationChoices = [
# Translators: options for navigation verbosity -- "terse" = use less words
_("Terse"),
# Translators: options for navigation verbosity -- "medium" = try to be nether too terse nor too verbose words
@@ -555,16 +555,16 @@ def __init__(self, parent):
# Translators: options for navigation verbosity -- "verbose" = use more words
_("Verbose"),
]
- self.m_choiceSpeechAmountNavigation = wx.Choice(
- self.m_panelNavigation,
+ self._choiceSpeechAmountNavigation = wx.Choice(
+ self._panelNavigation,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceSpeechAmountNavigationChoices,
+ speechAmountNavigationChoices,
0,
)
- self.m_choiceSpeechAmountNavigation.SetSelection(0)
- bSizerSpeechAmountNavigation.Add(self.m_choiceSpeechAmountNavigation, 0, wx.ALL, 5)
+ self._choiceSpeechAmountNavigation.SetSelection(0)
+ bSizerSpeechAmountNavigation.Add(self._choiceSpeechAmountNavigation, 0, wx.ALL, 5)
bSizerNavigationZoom.Add(bSizerSpeechAmountNavigation, 1, wx.EXPAND, 5)
@@ -572,8 +572,8 @@ def __init__(self, parent):
bSizerCopyAs = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextCopyMathAs = wx.StaticText(
- self.m_panelNavigation,
+ self._staticTextCopyMathAs = wx.StaticText(
+ self._panelNavigation,
wx.ID_ANY,
# Translators: label for pull down to specify how math will be copied to the clipboard
_("Copy math as:"),
@@ -581,12 +581,12 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextCopyMathAs.Wrap(-1)
+ self._staticTextCopyMathAs.Wrap(-1)
- bSizerCopyAs.Add(self.m_staticTextCopyMathAs, 0, wx.ALL, 5)
+ bSizerCopyAs.Add(self._staticTextCopyMathAs, 0, wx.ALL, 5)
# Translators: options for copy math as.
- m_choiceCopyAsChoices = [
+ copyAsChoices = [
# Translators: options for Copy expression to clipboard as -- "MathML"
_("MathML"),
# Translators: options for Copy expression to clipboard as -- "LaTeX"
@@ -596,29 +596,29 @@ def __init__(self, parent):
# Translators: options for Copy expression to clipboard as -- speech text
_("Speech"),
]
- self.m_choiceCopyAs = wx.Choice(
- self.m_panelNavigation,
+ self._choiceCopyAs = wx.Choice(
+ self._panelNavigation,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceCopyAsChoices,
+ copyAsChoices,
0,
)
- self.m_choiceCopyAs.SetSelection(0)
- bSizerCopyAs.Add(self.m_choiceCopyAs, 0, wx.ALL, 5)
+ self._choiceCopyAs.SetSelection(0)
+ bSizerCopyAs.Add(self._choiceCopyAs, 0, wx.ALL, 5)
bSizerNavigation.Add(bSizerCopyAs, 1, wx.EXPAND, 5)
- self.m_panelNavigation.SetSizer(bSizerNavigation)
- self.m_panelNavigation.Layout()
- bSizerNavigation.Fit(self.m_panelNavigation)
- self.m_simplebookPanelsCategories.AddPage(
- self.m_panelNavigation,
+ self._panelNavigation.SetSizer(bSizerNavigation)
+ self._panelNavigation.Layout()
+ bSizerNavigation.Fit(self._panelNavigation)
+ self._simplebookPanelsCategories.AddPage(
+ self._panelNavigation,
"a page",
False,
)
- self.m_panelBraille = wx.Panel(
- self.m_simplebookPanelsCategories,
+ self._panelBraille = wx.Panel(
+ self._simplebookPanelsCategories,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
@@ -628,8 +628,8 @@ def __init__(self, parent):
bSizerBrailleMathCode = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextBrailleMathCode = wx.StaticText(
- self.m_panelBraille,
+ self._staticTextBrailleMathCode = wx.StaticText(
+ self._panelBraille,
wx.ID_ANY,
# Translators: label for pull down to specify which braille code to use
_("Braille math code for refreshable displays:"),
@@ -637,27 +637,27 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextBrailleMathCode.Wrap(-1)
+ self._staticTextBrailleMathCode.Wrap(-1)
- bSizerBrailleMathCode.Add(self.m_staticTextBrailleMathCode, 0, wx.ALL, 5)
- m_choiceBrailleMathCodeChoices = ["xxxxxxxxxxx"]
- self.m_choiceBrailleMathCode = wx.Choice(
- self.m_panelBraille,
+ bSizerBrailleMathCode.Add(self._staticTextBrailleMathCode, 0, wx.ALL, 5)
+ brailleMathCodeChoices = ["xxxxxxxxxxx"]
+ self._choiceBrailleMathCode = wx.Choice(
+ self._panelBraille,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceBrailleMathCodeChoices,
+ brailleMathCodeChoices,
0,
)
- self.m_choiceBrailleMathCode.SetSelection(1)
- bSizerBrailleMathCode.Add(self.m_choiceBrailleMathCode, 0, wx.ALL, 5)
+ self._choiceBrailleMathCode.SetSelection(1)
+ bSizerBrailleMathCode.Add(self._choiceBrailleMathCode, 0, wx.ALL, 5)
bSizerBraille.Add(bSizerBrailleMathCode, 1, wx.EXPAND, 5)
bSizerBrailleHighlights = wx.BoxSizer(wx.HORIZONTAL)
- self.m_staticTextBrailleHighlights = wx.StaticText(
- self.m_panelBraille,
+ self._staticTextBrailleHighlights = wx.StaticText(
+ self._panelBraille,
wx.ID_ANY,
# Translators: label for pull down to specify how braille dots should be modified when navigating/selecting subexprs
_("Highlight with dots 7 && 8 the current nav node:"),
@@ -665,11 +665,11 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- self.m_staticTextBrailleHighlights.Wrap(-1)
+ self._staticTextBrailleHighlights.Wrap(-1)
- bSizerBrailleHighlights.Add(self.m_staticTextBrailleHighlights, 0, wx.ALL, 5)
+ bSizerBrailleHighlights.Add(self._staticTextBrailleHighlights, 0, wx.ALL, 5)
- m_choiceBrailleHighlightsChoices = [
+ brailleHighlightsChoices = [
# Translators: options for using dots 7 and 8:
# Translators: "off" -- don't highlight
_("Off"),
@@ -680,16 +680,16 @@ def __init__(self, parent):
# Translators: "All" -- all the characters for the current navigation node use dots 7 & 8
_("All"),
]
- self.m_choiceBrailleHighlights = wx.Choice(
- self.m_panelBraille,
+ self._choiceBrailleHighlights = wx.Choice(
+ self._panelBraille,
wx.ID_ANY,
wx.DefaultPosition,
wx.DefaultSize,
- m_choiceBrailleHighlightsChoices,
+ brailleHighlightsChoices,
0,
)
- self.m_choiceBrailleHighlights.SetSelection(1)
- bSizerBrailleHighlights.Add(self.m_choiceBrailleHighlights, 0, wx.ALL, 5)
+ self._choiceBrailleHighlights.SetSelection(1)
+ bSizerBrailleHighlights.Add(self._choiceBrailleHighlights, 0, wx.ALL, 5)
bSizerBraille.Add(bSizerBrailleHighlights, 1, wx.EXPAND, 5)
@@ -703,20 +703,20 @@ def __init__(self, parent):
bSizerBraille.Add((0, 0), 1, wx.EXPAND, 5)
- self.m_panelBraille.SetSizer(bSizerBraille)
- self.m_panelBraille.Layout()
- bSizerBraille.Fit(self.m_panelBraille)
- self.m_simplebookPanelsCategories.AddPage(self.m_panelBraille, "a page", False)
+ self._panelBraille.SetSizer(bSizerBraille)
+ self._panelBraille.Layout()
+ bSizerBraille.Fit(self._panelBraille)
+ self._simplebookPanelsCategories.AddPage(self._panelBraille, "a page", False)
gbSizerMathCATPreferences.Add(
- self.m_simplebookPanelsCategories,
+ self._simplebookPanelsCategories,
wx.GBPosition(0, 1),
wx.GBSpan(1, 1),
wx.EXPAND | wx.ALL,
10,
)
- self.m_staticlineAboveButtons = wx.StaticLine(
+ self._staticlineAboveButtons = wx.StaticLine(
self,
wx.ID_ANY,
wx.DefaultPosition,
@@ -724,20 +724,20 @@ def __init__(self, parent):
wx.LI_HORIZONTAL,
)
gbSizerMathCATPreferences.Add(
- self.m_staticlineAboveButtons,
+ self._staticlineAboveButtons,
wx.GBPosition(1, 0),
wx.GBSpan(1, 2),
wx.EXPAND | wx.ALL,
5,
)
- self.m_panelButtons = wx.Panel(self, wx.ID_ANY, wx.Point(-1, -1), wx.DefaultSize, 0)
+ self._panelButtons = wx.Panel(self, wx.ID_ANY, wx.Point(-1, -1), wx.DefaultSize, 0)
bSizerButtons = wx.BoxSizer(wx.HORIZONTAL)
bSizerButtons.Add((0, 0), 1, wx.EXPAND, 5)
- self.m_buttonOK = wx.Button(
- self.m_panelButtons,
+ self._buttonOK = wx.Button(
+ self._panelButtons,
wx.ID_ANY,
# Translators: dialog "ok" button
_("OK"),
@@ -745,10 +745,10 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- bSizerButtons.Add(self.m_buttonOK, 0, wx.ALL, 5)
+ bSizerButtons.Add(self._buttonOK, 0, wx.ALL, 5)
- self.m_buttonCancel = wx.Button(
- self.m_panelButtons,
+ self._buttonCancel = wx.Button(
+ self._panelButtons,
wx.ID_ANY,
# Translators: dialog "cancel" button
_("Cancel"),
@@ -756,10 +756,10 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- bSizerButtons.Add(self.m_buttonCancel, 0, wx.ALL, 5)
+ bSizerButtons.Add(self._buttonCancel, 0, wx.ALL, 5)
- self.m_buttonApply = wx.Button(
- self.m_panelButtons,
+ self._buttonApply = wx.Button(
+ self._panelButtons,
wx.ID_ANY,
# Translators: dialog "apply" button
_("Apply"),
@@ -767,10 +767,10 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- bSizerButtons.Add(self.m_buttonApply, 0, wx.ALL, 5)
+ bSizerButtons.Add(self._buttonApply, 0, wx.ALL, 5)
- self.m_buttonReset = wx.Button(
- self.m_panelButtons,
+ self._buttonReset = wx.Button(
+ self._panelButtons,
wx.ID_ANY,
# Translators: button to reset all the preferences to their default values
_("Reset to defaults"),
@@ -778,10 +778,10 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- bSizerButtons.Add(self.m_buttonReset, 0, wx.ALL, 5)
+ bSizerButtons.Add(self._buttonReset, 0, wx.ALL, 5)
- self.m_buttonHelp = wx.Button(
- self.m_panelButtons,
+ self._buttonHelp = wx.Button(
+ self._panelButtons,
wx.ID_ANY,
# Translators: button to bring up a help page
_("Help"),
@@ -789,13 +789,13 @@ def __init__(self, parent):
wx.DefaultSize,
0,
)
- bSizerButtons.Add(self.m_buttonHelp, 0, wx.ALL, 5)
+ bSizerButtons.Add(self._buttonHelp, 0, wx.ALL, 5)
- self.m_panelButtons.SetSizer(bSizerButtons)
- self.m_panelButtons.Layout()
- bSizerButtons.Fit(self.m_panelButtons)
+ self._panelButtons.SetSizer(bSizerButtons)
+ self._panelButtons.Layout()
+ bSizerButtons.Fit(self._panelButtons)
gbSizerMathCATPreferences.Add(
- self.m_panelButtons,
+ self._panelButtons,
wx.GBPosition(2, 1),
wx.GBSpan(1, 2),
wx.EXPAND | wx.ALL,
@@ -809,54 +809,54 @@ def __init__(self, parent):
self.Centre(wx.BOTH)
# Connect Events
- self.Bind(wx.EVT_CHAR_HOOK, self.MathCATPreferencesDialogOnCharHook)
- self.Bind(wx.EVT_KEY_UP, self.MathCATPreferencesDialogOnKeyUp)
- self.m_listBoxPreferencesTopic.Bind(wx.EVT_LISTBOX, self.OnListBoxCategories)
- self.m_choiceLanguage.Bind(wx.EVT_CHOICE, self.OnLanguage)
- self.m_sliderRelativeSpeed.Bind(
+ self.Bind(wx.EVT_CHAR_HOOK, self.mathCATPreferencesDialogOnCharHook)
+ self.Bind(wx.EVT_KEY_UP, self.mathCATPreferencesDialogOnKeyUp)
+ self._listBoxPreferencesTopic.Bind(wx.EVT_LISTBOX, self.onListBoxCategories)
+ self._choiceLanguage.Bind(wx.EVT_CHOICE, self.onLanguage)
+ self._sliderRelativeSpeed.Bind(
wx.EVT_SCROLL_CHANGED,
- self.OnRelativeSpeedChanged,
+ self.onRelativeSpeedChanged,
)
- self.m_sliderPauseFactor.Bind(wx.EVT_SCROLL_CHANGED, self.OnPauseFactorChanged)
- self.m_buttonOK.Bind(wx.EVT_BUTTON, self.OnClickOK)
- self.m_buttonCancel.Bind(wx.EVT_BUTTON, self.OnClickCancel)
- self.m_buttonApply.Bind(wx.EVT_BUTTON, self.OnClickApply)
- self.m_buttonReset.Bind(wx.EVT_BUTTON, self.OnClickReset)
- self.m_buttonHelp.Bind(wx.EVT_BUTTON, self.OnClickHelp)
+ self._sliderPauseFactor.Bind(wx.EVT_SCROLL_CHANGED, self.onPauseFactorChanged)
+ self._buttonOK.Bind(wx.EVT_BUTTON, self.onClickOK)
+ self._buttonCancel.Bind(wx.EVT_BUTTON, self.onClickCancel)
+ self._buttonApply.Bind(wx.EVT_BUTTON, self.onClickApply)
+ self._buttonReset.Bind(wx.EVT_BUTTON, self.onClickReset)
+ self._buttonHelp.Bind(wx.EVT_BUTTON, self.onClickHelp)
def __del__(self):
pass
# Virtual event handlers, override them in your derived class
- def MathCATPreferencesDialogOnCharHook(self, event):
+ def mathCATPreferencesDialogOnCharHook(self, event):
event.Skip()
- def MathCATPreferencesDialogOnKeyUp(self, event):
+ def mathCATPreferencesDialogOnKeyUp(self, event):
event.Skip()
- def OnListBoxCategories(self, event):
+ def onListBoxCategories(self, event):
event.Skip()
- def OnLanguage(self, event):
+ def onLanguage(self, event):
event.Skip()
- def OnRelativeSpeedChanged(self, event):
+ def onRelativeSpeedChanged(self, event):
event.Skip()
- def OnPauseFactorChanged(self, event):
+ def onPauseFactorChanged(self, event):
event.Skip()
- def OnClickOK(self, event):
+ def onClickOK(self, event):
event.Skip()
- def OnClickCancel(self, event):
+ def onClickCancel(self, event):
event.Skip()
- def OnClickApply(self, event):
+ def onClickApply(self, event):
event.Skip()
- def OnClickReset(self, event):
+ def onClickReset(self, event):
event.Skip()
- def OnClickHelp(self, event):
+ def onClickHelp(self, event):
event.Skip()
diff --git a/addon/globalPlugins/MathCAT/__init__.py b/addon/globalPlugins/MathCAT/__init__.py
index 0c65cd50..3945b182 100644
--- a/addon/globalPlugins/MathCAT/__init__.py
+++ b/addon/globalPlugins/MathCAT/__init__.py
@@ -29,16 +29,16 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# MathCAT.__init__(self)
- self.add_MathCAT_menu()
+ self.addMathCATMenu()
- def add_MathCAT_menu(self):
+ def addMathCATMenu(self):
if not globalVars.appArgs.secure:
self.preferencesMenu = mainFrame.sysTrayIcon.preferencesMenu
# Translators: this show up in the NVDA preferences dialog. It opens the MathCAT preferences dialog
self.settings = self.preferencesMenu.Append(wx.ID_ANY, _("&MathCAT Settings..."))
- mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.on_settings, self.settings)
+ mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.onSettings, self.settings)
- def on_settings(self, evt):
+ def onSettings(self, evt):
mainFrame.popupSettingsDialog(UserInterface)
def terminate(self):