@@ -54,17 +54,17 @@ def load_user_preferences():
5454 global user_preferences
5555 #merge user file values into the user preferences data structure
5656 if os .path .exists (path_to_user_preferences ()):
57- with open (path_to_user_preferences ()) as f :
57+ with open (path_to_user_preferences (), encoding = 'utf-8' ) as f :
5858 # merge with the default preferences, overwriting with the user's values
5959 user_preferences .update (yaml .load (f , Loader = yaml .FullLoader ))
6060
6161def write_user_preferences ():
6262 if not os .path .exists (path_to_user_preferences_folder ()):
6363 #create a folder for the user preferences
6464 os .mkdir (path_to_user_preferences_folder ())
65- with open (path_to_user_preferences (), 'w' ) as f :
65+ with open (path_to_user_preferences (), 'w' , encoding = "utf-8" ) as f :
6666 #write values to the user preferences file, NOT the default
67- yaml .dump (user_preferences , f )
67+ yaml .dump (user_preferences , stream = f , allow_unicode = True )
6868
6969class UserInterface (MathCATgui .MathCATPreferencesDialog ):
7070
@@ -105,6 +105,7 @@ def set_ui_values(self):
105105 #now get the available SpeechStyles from the folder structure and set to the preference setting is possible
106106 UserInterface .GetSpeechStyles (self , user_preferences ["Speech" ]["SpeechStyle" ])
107107 self .m_choiceSpeechAmount .SetSelection (Speech_Verbosity .index (user_preferences ["Speech" ]["Verbosity" ]))
108+ self .m_sliderRelativeSpeed .SetValue (user_preferences ["Speech" ]["MathRate" ])
108109 self .m_choiceSpeechForChemical .SetSelection (Speech_Chemistry .index (user_preferences ["Speech" ]["Chemistry" ]))
109110 self .m_choiceNavigationMode .SetSelection (Navigation_NavMode .index (user_preferences ["Navigation" ]["NavMode" ]))
110111 self .m_checkBoxResetNavigationMode .SetValue (user_preferences ["Navigation" ]["ResetNavMode" ])
@@ -127,6 +128,7 @@ def get_ui_values(self):
127128 user_preferences ["Speech" ]["Language" ] = self .m_choiceLanguage .GetStringSelection ()
128129 user_preferences ["Speech" ]["SpeechStyle" ] = self .m_choiceSpeechStyle .GetStringSelection ()
129130 user_preferences ["Speech" ]["Verbosity" ] = Speech_Verbosity [self .m_choiceSpeechAmount .GetSelection ()]
131+ user_preferences ["Speech" ]["MathRate" ] = self .m_sliderRelativeSpeed .GetValue ()
130132 user_preferences ["Speech" ]["Chemistry" ] = Speech_Chemistry [self .m_choiceSpeechForChemical .GetSelection ()]
131133 user_preferences ["Navigation" ]["NavMode" ] = Navigation_NavMode [self .m_choiceNavigationMode .GetSelection ()]
132134 user_preferences ["Navigation" ]["ResetNavMode" ] = self .m_checkBoxResetNavigationMode .GetValue ()
@@ -195,6 +197,31 @@ def MathCATPreferencesDialogOnCharHook(self,event):
195197 keyCode = event .GetKeyCode ()
196198 if keyCode == wx .WXK_ESCAPE :
197199 UserInterface .OnClickCancel (self ,event )
200+ return
198201 if keyCode == wx .WXK_RETURN :
199202 UserInterface .OnClickOK (self ,event )
200- event .Skip ()
203+ if keyCode == wx .WXK_TAB and (event .GetModifiers () == wx .MOD_CONTROL ):
204+ #cycle the category forward
205+ new_category = self .m_listBoxPreferencesTopic .GetSelection () + 1
206+ if new_category == 3 :
207+ new_category = 0
208+ self .m_listBoxPreferencesTopic .SetSelection (new_category )
209+ #update the ui to show the new page
210+ UserInterface .OnListBoxCategories (self ,event )
211+ #set the focus into the category list box
212+ self .m_listBoxPreferencesTopic .SetFocus ()
213+ #jump out so the tab key is not processed
214+ return
215+ if keyCode == wx .WXK_TAB and (event .GetModifiers () == wx .MOD_CONTROL | wx .MOD_SHIFT ):
216+ #cycle the category back
217+ new_category = self .m_listBoxPreferencesTopic .GetSelection () - 1
218+ if new_category == - 1 :
219+ new_category = 2
220+ self .m_listBoxPreferencesTopic .SetSelection (new_category )
221+ #update the ui to show the new page
222+ UserInterface .OnListBoxCategories (self ,event )
223+ #update the ui to show the new page
224+ self .m_listBoxPreferencesTopic .SetFocus ()
225+ #jump out so the tab key is not processed
226+ return
227+
0 commit comments