1
1
# -*- coding: UTF-8 -*-
2
- #A part of Dual Voice for NVDA
3
- #Copyright (C) 2015-2020 Seyed Mahmood Taghavi Shahri
4
- #https://mahmood-taghavi.github.io/dual_voice/
5
- #This file is covered by the GNU General Public License version 3.
6
- #See the file COPYING for more details.
2
+ # A part of Dual Voice for NVDA
3
+ # Copyright (C) 2015-2021 Seyed Mahmood Taghavi Shahri
4
+ # https://mahmood-taghavi.github.io/dual_voice/
5
+ # This file is covered by the GNU General Public License version 3.
6
+ # See the file COPYING for more details.
7
7
8
8
import wx
9
9
import gui
14
14
#import languageHandler
15
15
from logHandler import log
16
16
import speech
17
- from synthDriverHandler import SynthDriver
18
17
from synthDrivers import _realtime
18
+ import synthDriverHandler
19
19
20
20
class DualVoiceLanguageSettingsDialog (gui .SettingsDialog ):
21
21
title = _ ('The Dual Voice settings' )
@@ -24,9 +24,9 @@ def __init__(self, parent):
24
24
25
25
def makeSettings (self , sizer ):
26
26
synthInfo = _ ('Your current speech synthesizer is the %s. Please select the Dual Voice as the speech synthesizer in the NVDA speech settings.' )
27
- synthName = speech .getSynth ().description
27
+ synthName = synthDriverHandler .getSynth ().description
28
28
synthInfo = synthInfo .replace ('%s' , synthName )
29
- if ('dual_sapi5' not in speech .getSynth ().name ):
29
+ if ('dual_sapi5' not in synthDriverHandler .getSynth ().name ):
30
30
infoLabel = wx .StaticText (self , label = synthInfo )
31
31
else :
32
32
## find the primary voice and show it in a label
@@ -41,11 +41,11 @@ def makeSettings(self, sizer):
41
41
infoLabel .Wrap (self .GetSize ()[0 ])
42
42
sizer .Add (infoLabel )
43
43
###
44
- if ('dual_sapi5' in speech .getSynth ().name ):
44
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
45
45
sVoicesLabel = wx .StaticText (self , label = _ ('Secondary &voice:' ))
46
46
sizer .Add (sVoicesLabel )
47
47
self ._sVoicesChoice = wx .Choice (self , choices = _realtime .list_VoiceName )
48
- if ('dual_sapi5' in speech .getSynth ().name ):
48
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
49
49
check = _realtime .sapi5SecondVoice in _realtime .list_VoiceAttribName
50
50
if check :
51
51
index = _realtime .list_VoiceAttribName .index (_realtime .sapi5SecondVoice )
@@ -62,7 +62,7 @@ def makeSettings(self, sizer):
62
62
sizer .Add (self ._sVoicesChoice )
63
63
##
64
64
self ._secondIsLatinCheckBox = wx .CheckBox (self , label = _ ('&Use the secondary voice for reading Latin text instead of non-Latin.' ))
65
- if ('dual_sapi5' in speech .getSynth ().name ):
65
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
66
66
self ._secondIsLatinCheckBox .SetValue (_realtime .sapi5SecondIsLatin )
67
67
self ._secondIsLatinCheckBox .Bind (wx .EVT_CHECKBOX , self .onSIsLatinCheck )
68
68
sizer .Add (self ._secondIsLatinCheckBox )
@@ -71,33 +71,33 @@ def makeSettings(self, sizer):
71
71
sizer .Add (sRateLabel )
72
72
self ._sRateSlider = wx .Slider (self , value = 50 , minValue = 0 , maxValue = 100 , style = wx .SL_HORIZONTAL )
73
73
self ._sRateSlider .Bind (wx .EVT_SLIDER , self .OnSRateSliderScroll )
74
- if ('dual_sapi5' in speech .getSynth ().name ):
74
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
75
75
self ._sRateSlider .SetValue (_realtime .sapi5SecondRate )
76
76
sizer .Add (self ._sRateSlider )
77
77
##
78
78
sPitchLabel = wx .StaticText (self , label = _ ('&Pitch:' ))
79
79
sizer .Add (sPitchLabel )
80
80
self ._sPitchSlider = wx .Slider (self , value = 50 , minValue = 0 , maxValue = 100 , style = wx .SL_HORIZONTAL )
81
81
self ._sPitchSlider .Bind (wx .EVT_SLIDER , self .OnSPitchSliderScroll )
82
- if ('dual_sapi5' in speech .getSynth ().name ):
82
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
83
83
self ._sPitchSlider .SetValue (_realtime .sapi5SecondPitch )
84
84
sizer .Add (self ._sPitchSlider )
85
85
##
86
86
sVolumeLabel = wx .StaticText (self , label = _ ('V&olume:' ))
87
87
sizer .Add (sVolumeLabel )
88
88
self ._sVolumeSlider = wx .Slider (self , value = 100 , minValue = 0 , maxValue = 100 , style = wx .SL_HORIZONTAL )
89
89
self ._sVolumeSlider .Bind (wx .EVT_SLIDER , self .OnSVolumeSliderScroll )
90
- if ('dual_sapi5' in speech .getSynth ().name ):
90
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
91
91
self ._sVolumeSlider .SetValue (_realtime .sapi5SecondVolume )
92
92
sizer .Add (self ._sVolumeSlider )
93
93
##
94
94
self ._nonLatinPriorityCheckBox = wx .CheckBox (self , label = _ ('&Prioritize non-Latin text over Latin text.' ))
95
- if ('dual_sapi5' in speech .getSynth ().name ):
95
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
96
96
self ._nonLatinPriorityCheckBox .SetValue (_realtime .sapi5NonLatinPriority )
97
97
self ._nonLatinPriorityCheckBox .Bind (wx .EVT_CHECKBOX , self .nonLatinPriorityCheck )
98
98
sizer .Add (self ._nonLatinPriorityCheckBox )
99
99
self ._considerContextCheckBox = wx .CheckBox (self , label = _ ('Read &numbers and punctuations based on surrounding text.' ))
100
- if ('dual_sapi5' in speech .getSynth ().name ):
100
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
101
101
self ._considerContextCheckBox .SetValue (_realtime .sapi5ConsiderContext )
102
102
self ._considerContextCheckBox .Bind (wx .EVT_CHECKBOX , self .considerContextCheck )
103
103
sizer .Add (self ._considerContextCheckBox )
@@ -109,7 +109,7 @@ def makeSettings(self, sizer):
109
109
#self._typingAreaTextCtrl.SetValue(_realtime.list_VoiceName[0])
110
110
self ._typingAreaTextCtrl .SetValue (_realtime .typingArea )
111
111
sizer .Add (self ._typingAreaTextCtrl )
112
- if ('dual_sapi5' not in speech .getSynth ().name ):
112
+ if ('dual_sapi5' not in synthDriverHandler .getSynth ().name ):
113
113
sVoicesLabel .Disable ()
114
114
self ._sVoicesChoice .Disable ()
115
115
sRateLabel .Disable ()
@@ -128,7 +128,7 @@ def makeSettings(self, sizer):
128
128
129
129
def onOk (self , event ):
130
130
# Update Configurations
131
- if ('dual_sapi5' in speech .getSynth ().name ):
131
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
132
132
_realtime .typingArea = self ._typingAreaTextCtrl .GetValue ()
133
133
config .conf ["dual_voice" ]["sapi5SecondVoice" ] = _realtime .sapi5SecondVoice
134
134
config .conf ["dual_voice" ]["sapi5SecondRate" ] = _realtime .sapi5SecondRate
@@ -142,7 +142,7 @@ def onOk(self, event):
142
142
143
143
def onCancel (self , event ):
144
144
# Restore Configurations
145
- if ('dual_sapi5' in speech .getSynth ().name ):
145
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
146
146
_realtime .sapi5SecondVoice = config .conf ["dual_voice" ]["sapi5SecondVoice" ]
147
147
_realtime .sapi5SecondRate = config .conf ["dual_voice" ]["sapi5SecondRate" ]
148
148
_realtime .sapi5SecondPitch = config .conf ["dual_voice" ]["sapi5SecondPitch" ]
@@ -154,30 +154,30 @@ def onCancel(self, event):
154
154
155
155
156
156
def onSVoiceChange (self , event ):
157
- if ('dual_sapi5' in speech .getSynth ().name ):
157
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
158
158
_realtime .sapi5SecondVoice = _realtime .list_VoiceAttribName [self ._sVoicesChoice .GetSelection ()]
159
159
_realtime .problemisticSapi5SecondVoice = ''
160
160
161
161
def OnSRateSliderScroll (self , event ):
162
- if ('dual_sapi5' in speech .getSynth ().name ):
162
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
163
163
_realtime .sapi5SecondRate = self ._sRateSlider .GetValue ()
164
164
165
165
def OnSPitchSliderScroll (self , event ):
166
- if ('dual_sapi5' in speech .getSynth ().name ):
166
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
167
167
_realtime .sapi5SecondPitch = self ._sPitchSlider .GetValue ()
168
168
169
169
def OnSVolumeSliderScroll (self , event ):
170
- if ('dual_sapi5' in speech .getSynth ().name ):
170
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
171
171
_realtime .sapi5SecondVolume = self ._sVolumeSlider .GetValue ()
172
172
173
173
def onSIsLatinCheck (self , event ):
174
- if ('dual_sapi5' in speech .getSynth ().name ):
174
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
175
175
_realtime .sapi5SecondIsLatin = self ._secondIsLatinCheckBox .GetValue ()
176
176
177
177
def nonLatinPriorityCheck (self , event ):
178
- if ('dual_sapi5' in speech .getSynth ().name ):
178
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
179
179
_realtime .sapi5NonLatinPriority = self ._nonLatinPriorityCheckBox .GetValue ()
180
180
181
181
def considerContextCheck (self , event ):
182
- if ('dual_sapi5' in speech .getSynth ().name ):
182
+ if ('dual_sapi5' in synthDriverHandler .getSynth ().name ):
183
183
_realtime .sapi5ConsiderContext = self ._considerContextCheckBox .GetValue ()
0 commit comments