@@ -37,6 +37,10 @@ def path_to_user_preferences():
3737 #the user preferences file is stored at: C:\Users\<user-name>AppData\Roaming\MathCAT\prefs.yaml
3838 return path_to_user_preferences_folder () + "\\ prefs.yaml"
3939
40+ def path_to_languages_folder ():
41+ #the user preferences file is stored at: MathCAT\Rules\Languages
42+ return os .path .expanduser ('~' )+ "\\ AppData\\ Roaming\\ nvda\\ addons\\ mathCAT\\ globalPlugins\\ MathCAT\\ Rules\\ Languages"
43+
4044def load_default_preferences ():
4145 global user_preferences
4246 #load default preferences into the user preferences data structure (overwites existing)
@@ -65,21 +69,20 @@ def write_user_preferences():
6569 yaml .dump (user_preferences , f )
6670
6771class UserInterface (MathCATgui .MathCATPreferencesDialog ):
68-
6972 def GetLanguages (self ):
7073 #clear the language choices
7174 self .m_choiceLanguage .Clear ()
7275 #populate the language choices
73- for f in os .listdir (os . path . expanduser ( '~' ) + " \\ AppData \\ Roaming \\ nvda \\ addons \\ mathCAT \\ globalPlugins \\ MathCAT \\ Rules \\ Languages" ):
74- if os .path .isdir (os . path . expanduser ( '~' )+ "\\ AppData \\ Roaming \\ nvda \\ addons \\ mathCAT \\ globalPlugins \\ MathCAT \\ Rules \\ Languages \\ " + f ):
76+ for f in os .listdir (path_to_languages_folder () ):
77+ if os .path .isdir (path_to_languages_folder ( )+ "\\ " + f ):
7578 self .m_choiceLanguage .Append (f )
7679
7780 def GetSpeechStyles (self , this_SpeechStyle ):
7881 #clear the SpeechStyle choices
7982 self .m_choiceSpeechStyle .Clear ()
8083 #get the currently selected language
8184 this_language = self .m_choiceLanguage .GetStringSelection ()
82- this_path = os . path . expanduser ( '~' )+ "\\ AppData \\ Roaming \\ nvda \\ addons \\ mathCAT \\ globalPlugins \\ MathCAT \\ Rules \\ Languages \\ " + this_language + "\\ *_Rules.yaml"
85+ this_path = path_to_languages_folder ( )+ "\\ " + this_language + "\\ *_Rules.yaml"
8386 #populate the m_choiceSpeechStyle choices
8487 for f in glob .glob (this_path ):
8588 fname = os .path .basename (f )
@@ -190,6 +193,8 @@ def MathCATPreferencesDialogOnCharHook(self,event):
190193 UserInterface .OnClickCancel (self ,event )
191194 if keyCode == wx .WXK_RETURN :
192195 UserInterface .OnClickOK (self ,event )
196+ #if keyCode == wx.WXK_TAB and wx.KeyboardState.GetModifiers():
197+ # print("Tab")
193198 event .Skip ()
194199
195200app = wx .App (False )
0 commit comments