1111import addonHandler
1212from logHandler import log # logging
1313from typing import List , Dict , Union , Callable
14- from .MathCAT import ConvertSSMLTextForNVDA
14+ from .MathCAT import convertSSMLTextForNVDA
1515from speech import speak
1616from zipfile import ZipFile
1717
@@ -72,8 +72,8 @@ def __init__(self, parent):
7272 self ._listBoxPreferencesTopic .SetSelection (0 )
7373 userPreferences ["NVDAAddOn" ] = {"LastCategory" : "0" }
7474 # populate the languages and braille codes
75- UserInterface .GetLanguages (self )
76- UserInterface .GetBrailleCodes (self )
75+ UserInterface .getLanguages (self )
76+ UserInterface .getBrailleCodes (self )
7777 # set the ui items to match the preferences
7878 UserInterface .setUIValues (self )
7979
@@ -88,7 +88,7 @@ def pathToBrailleFolder():
8888 return os .path .join (os .path .dirname (os .path .abspath (__file__ )), "Rules" , "Braille" )
8989
9090 @staticmethod
91- def LanguagesDict () -> Dict [str , str ]:
91+ def languagesDict () -> Dict [str , str ]:
9292 languages = {
9393 "aa" : "Afar" ,
9494 "ab" : "Аҧсуа" ,
@@ -291,13 +291,13 @@ def getRulesFiles(
291291
292292 return ruleFiles
293293
294- def GetLanguages (self ):
294+ def getLanguages (self ):
295295 def addRegionalLanguages (subDir : str , language : str ) -> List [str ]:
296296 # the language variants are in folders named using ISO 3166-1 alpha-2
297297 # codes https://en.wikipedia.org/wiki/ISO_3166-2
298298 # check if there are language variants in the language folder
299299 if subDir != "SharedRules" :
300- languagesDict = UserInterface .LanguagesDict ()
300+ languagesDict = UserInterface .languagesDict ()
301301 # add to the listbox the text for this language variant together with the code
302302 regionalCode = language + "-" + subDir .upper ()
303303 if languagesDict .get (regionalCode , "missing" ) != "missing" :
@@ -310,7 +310,7 @@ def addRegionalLanguages(subDir: str, language: str) -> List[str]:
310310 return []
311311
312312 # initialise the language list
313- languagesDict = UserInterface .LanguagesDict ()
313+ languagesDict = UserInterface .languagesDict ()
314314 # clear the language names in the dialog
315315 self ._choiceLanguage .Clear ()
316316 # Translators: menu item -- use the language of the voice chosen in the NVDA speech settings dialog
@@ -331,12 +331,12 @@ def addRegionalLanguages(subDir: str, language: str) -> List[str]:
331331 else :
332332 self ._choiceLanguage .Append (language + " (" + language + ")" )
333333
334- def GetLanguageCode (self ):
334+ def getLanguageCode (self ):
335335 lang_selection = self ._choiceLanguage .GetStringSelection ()
336336 lang_code = lang_selection [lang_selection .find ("(" ) + 1 : lang_selection .find (")" )]
337337 return lang_code
338338
339- def GetSpeechStyles (self , thisSpeechStyle : str ):
339+ def getSpeechStyles (self , thisSpeechStyle : str ):
340340 """Get all the speech styles for the current language.
341341 This sets the SpeechStyles dialog entry"""
342342 from speech import getCurrentLanguage
@@ -370,7 +370,7 @@ def getSpeechStyleFromDirectory(dir: str, lang: str) -> list[str]:
370370 # clear the SpeechStyle choices
371371 self ._choiceSpeechStyle .Clear ()
372372 # get the currently selected language code
373- languageCode = UserInterface .GetLanguageCode (self )
373+ languageCode = UserInterface .getLanguageCode (self )
374374
375375 if languageCode == "Auto" :
376376 # list the speech styles for the current voice rather than have none listed
@@ -402,7 +402,7 @@ def getSpeechStyleFromDirectory(dir: str, lang: str) -> list[str]:
402402 # that didn't work, choose the first in the list
403403 self ._choiceSpeechStyle .SetSelection (0 )
404404
405- def GetBrailleCodes (self ):
405+ def getBrailleCodes (self ):
406406 # initialise the braille code list
407407 self ._choiceBrailleMathCode .Clear ()
408408 # populate the available braille codes in the dialog
@@ -438,7 +438,7 @@ def setUIValues(self):
438438 self ._choiceLanguage .SetSelection (0 )
439439 try :
440440 # now get the available SpeechStyles from the folder structure and set to the preference setting is possible
441- self .GetSpeechStyles (str (userPreferences ["Speech" ]["SpeechStyle" ]))
441+ self .getSpeechStyles (str (userPreferences ["Speech" ]["SpeechStyle" ]))
442442 except Exception as e :
443443 log .exception (f"MathCAT: An exception occurred in set_ui_values (getting SpeechStyle): { e } " )
444444 self ._choiceSpeechStyle .Append (
@@ -511,7 +511,7 @@ def getUIValues(self):
511511 global userPreferences
512512 # read the values from the UI and update the user preferences dictionary
513513 userPreferences ["Speech" ]["Impairment" ] = Speech_Impairment [self ._choiceImpairment .GetSelection ()]
514- userPreferences ["Speech" ]["Language" ] = self .GetLanguageCode ()
514+ userPreferences ["Speech" ]["Language" ] = self .getLanguageCode ()
515515 userPreferences ["Other" ]["DecimalSeparator" ] = Speech_DecimalSeparator [
516516 self ._choiceDecimalSeparator .GetSelection ()
517517 ]
@@ -695,17 +695,17 @@ def writeUserPreferences():
695695 # write values to the user preferences file, NOT the default
696696 yaml .dump (userPreferences , stream = f , allow_unicode = True )
697697
698- def OnRelativeSpeedChanged (self , event ):
698+ def onRelativeSpeedChanged (self , event ):
699699 rate = self ._sliderRelativeSpeed .GetValue ()
700700 # Translators: this is a test string that is spoken. Only translate "the square root of x squared plus y squared"
701701 text = _ ("<prosody rate='XXX%'>the square root of x squared plus y squared</prosody>" ).replace (
702702 "XXX" ,
703703 str (rate ),
704704 1 ,
705705 )
706- speak (ConvertSSMLTextForNVDA (text ))
706+ speak (convertSSMLTextForNVDA (text ))
707707
708- def OnPauseFactorChanged (self , event ):
708+ def onPauseFactorChanged (self , event ):
709709 rate = self ._sliderRelativeSpeed .GetValue ()
710710 pfSlider = self ._sliderPauseFactor .GetValue ()
711711 pauseFactor = (
@@ -730,44 +730,44 @@ def OnPauseFactorChanged(self, event):
730730 pause_factor_300 = 300 * pauseFactor // 100 ,
731731 pause_factor_600 = 600 * pauseFactor // 100 ,
732732 )
733- speak (ConvertSSMLTextForNVDA (text ))
733+ speak (convertSSMLTextForNVDA (text ))
734734
735- def OnClickOK (self , event ):
735+ def onClickOK (self , event ):
736736 UserInterface .getUIValues (self )
737737 UserInterface .writeUserPreferences ()
738738 self .Destroy ()
739739
740- def OnClickCancel (self , event ):
740+ def onClickCancel (self , event ):
741741 self .Destroy ()
742742
743- def OnClickApply (self , event ):
743+ def onClickApply (self , event ):
744744 UserInterface .getUIValues (self )
745745 UserInterface .writeUserPreferences ()
746746
747- def OnClickReset (self , event ):
747+ def onClickReset (self , event ):
748748 UserInterface .loadDefaultPreferences ()
749749 UserInterface .validateUserPreferences ()
750750 UserInterface .setUIValues (self )
751751
752- def OnClickHelp (self , event ):
752+ def onClickHelp (self , event ):
753753 webbrowser .open ("https://nsoiffer.github.io/MathCAT/users.html" )
754754
755- def OnListBoxCategories (self , event ):
755+ def onListBoxCategories (self , event ):
756756 # the category changed, now show the appropriate dialogue page
757757 self ._simplebookPanelsCategories .SetSelection (self ._listBoxPreferencesTopic .GetSelection ())
758758
759- def OnLanguage (self , event ):
759+ def onLanguage (self , event ):
760760 # the language changed, get the SpeechStyles for the new language
761- UserInterface .GetSpeechStyles (self , self ._choiceSpeechStyle .GetStringSelection ())
761+ UserInterface .getSpeechStyles (self , self ._choiceSpeechStyle .GetStringSelection ())
762762
763- def MathCATPreferencesDialogOnCharHook (self , event : wx .KeyEvent ):
763+ def mathCATPreferencesDialogOnCharHook (self , event : wx .KeyEvent ):
764764 # designed choice is that Enter is the same as clicking OK, and Escape is the same as clicking Cancel
765765 keyCode = event .GetKeyCode ()
766766 if keyCode == wx .WXK_ESCAPE :
767- UserInterface .OnClickCancel (self , event )
767+ UserInterface .onClickCancel (self , event )
768768 return
769769 if keyCode == wx .WXK_RETURN :
770- UserInterface .OnClickOK (self , event )
770+ UserInterface .onClickOK (self , event )
771771 if keyCode == wx .WXK_TAB :
772772 if event .GetModifiers () == wx .MOD_CONTROL :
773773 # cycle the category forward
@@ -776,7 +776,7 @@ def MathCATPreferencesDialogOnCharHook(self, event: wx.KeyEvent):
776776 newCategory = 0
777777 self ._listBoxPreferencesTopic .SetSelection (newCategory )
778778 # update the ui to show the new page
779- UserInterface .OnListBoxCategories (self , event )
779+ UserInterface .onListBoxCategories (self , event )
780780 # set the focus into the category list box
781781 self ._listBoxPreferencesTopic .SetFocus ()
782782 # jump out so the tab key is not processed
@@ -788,7 +788,7 @@ def MathCATPreferencesDialogOnCharHook(self, event: wx.KeyEvent):
788788 newCategory = 2
789789 self ._listBoxPreferencesTopic .SetSelection (newCategory )
790790 # update the ui to show the new page
791- UserInterface .OnListBoxCategories (self , event )
791+ UserInterface .onListBoxCategories (self , event )
792792 # update the ui to show the new page
793793 self ._listBoxPreferencesTopic .SetFocus ()
794794 # jump out so the tab key is not processed
0 commit comments