@@ -98,6 +98,7 @@ def set_ui_values(self):
9898 #set the rest of the UI elements
9999 self .m_choiceSpeechAmount .SetSelection (Speech_Verbosity .index (user_preferences ["Speech" ]["Verbosity" ]))
100100 self .m_sliderRelativeSpeed .SetValue (user_preferences ["Speech" ]["MathRate" ])
101+ self .m_sliderPauseFactor .SetValue (user_preferences ["Speech" ]["PauseFactor" ])
101102 self .m_checkBoxSpeechSound .SetValue (user_preferences ["Speech" ]["SpeechSound" ] == "Beep" )
102103 self .m_choiceSpeechForChemical .SetSelection (Speech_Chemistry .index (user_preferences ["Speech" ]["Chemistry" ]))
103104 self .m_choiceNavigationMode .SetSelection (Navigation_NavMode .index (user_preferences ["Navigation" ]["NavMode" ]))
@@ -122,6 +123,7 @@ def get_ui_values(self):
122123 user_preferences ["Speech" ]["SpeechStyle" ] = self .m_choiceSpeechStyle .GetStringSelection ()
123124 user_preferences ["Speech" ]["Verbosity" ] = Speech_Verbosity [self .m_choiceSpeechAmount .GetSelection ()]
124125 user_preferences ["Speech" ]["MathRate" ] = self .m_sliderRelativeSpeed .GetValue ()
126+ user_preferences ["Speech" ]["PauseFactor" ] = self .m_sliderPauseFactor .GetValue ()
125127 if self .m_checkBoxSpeechSound .GetValue ():
126128 user_preferences ["Speech" ]["SpeechSound" ] = "Beep"
127129 else :
@@ -201,6 +203,8 @@ def validate_user_preferences():
201203 UserInterface .validate ("Speech" , "Verbosity" , ["Terse" , "Medium" , "Verbose" ], "Medium" )
202204 # MathRate: 100 # Change from text speech rate (%)
203205 UserInterface .validate ("Speech" , "MathRate" , [0 ,200 ], 100 )
206+ # PauseFactor: 100 # TBC
207+ UserInterface .validate ("Speech" , "PauseFactor" , [0 ,400 ], 100 )
204208 # SpeechSound: None # make a sound when starting/ending math speech -- None, Beep
205209 UserInterface .validate ("Speech" , "SpeechSound" , ["None" , "Beep" ], "None" )
206210 # SpeechStyle: ClearSpeak # Any known speech style (falls back to ClearSpeak)
@@ -243,6 +247,13 @@ def OnRelativeSpeedChanged( self, event ):
243247 text = _ (u"<prosody rate='XXX%'>the square root of x squared plus y squared</prosody>" ).replace ("XXX" , str (rate ), 1 )
244248 speak ( ConvertSSMLTextForNVDA (text ) )
245249
250+ def OnPauseFactorChanged ( self , event ):
251+ from .MathCAT import ConvertSSMLTextForNVDA
252+ from speech import speak
253+ pausefactor = self .m_sliderPauseFactor .GetValue ()
254+ text = _ (f"the fraction with numerator <break time='{ 300 * pausefactor // 100 } ms'/> <mark name='M63i335o-4'/> <say-as interpret-as='characters'>x</say-as> to the <mark name='M63i335o-5'/> <say-as interpret-as='characters'>n</say-as> <phoneme alphabet='ipa' ph='θ'>-th</phoneme> power <break time='{ 128 * pausefactor // 100 } ms'/> <mark name='M63i335o-6'/> plus <mark name='M63i335o-7'/> 1 <break time='{ 300 * pausefactor // 100 } ms'/> and denominator <mark name='M63i335o-10'/> <say-as interpret-as='characters'>x</say-as> to the <mark name='M63i335o-11'/> <say-as interpret-as='characters'>n</say-as> <phoneme alphabet='ipa' ph='θ'>-th</phoneme> power <break time='{ 128 * pausefactor // 100 } ms'/> <mark name='M63i335o-12'/> minus <mark name='M63i335o-13'/> 1 <break time='{ 600 * pausefactor // 100 } ms'/>end fraction <break time='{ 150 * pausefactor // 100 } ms'/>" )
255+ speak ( ConvertSSMLTextForNVDA (text ) )
256+
246257 def OnClickOK (self ,event ):
247258 UserInterface .get_ui_values (self )
248259 UserInterface .write_user_preferences ()
0 commit comments