orca r4563 - in trunk: . src/orca
- From: wwalker svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r4563 - in trunk: . src/orca
- Date: Mon, 16 Feb 2009 21:50:08 +0000 (UTC)
Author: wwalker
Date: Mon Feb 16 21:50:08 2009
New Revision: 4563
URL: http://svn.gnome.org/viewvc/orca?rev=4563&view=rev
Log:
Fix for bug #419123 - Modified speech settings do not change immediately in preferences dialog
Modified:
trunk/ChangeLog
trunk/src/orca/acss.py
trunk/src/orca/gnomespeechfactory.py
trunk/src/orca/orca-setup.glade
trunk/src/orca/orca_console_prefs.py
trunk/src/orca/orca_gui_prefs.py
Modified: trunk/src/orca/acss.py
==============================================================================
--- trunk/src/orca/acss.py (original)
+++ trunk/src/orca/acss.py Mon Feb 16 21:50:08 2009
@@ -51,7 +51,7 @@
settings = {
FAMILY : None,
RATE : 50,
- GAIN : 5,
+ GAIN : 100,
AVERAGE_PITCH : 5,
PITCH_RANGE : 5,
STRESS : 5,
Modified: trunk/src/orca/gnomespeechfactory.py
==============================================================================
--- trunk/src/orca/gnomespeechfactory.py (original)
+++ trunk/src/orca/gnomespeechfactory.py Mon Feb 16 21:50:08 2009
@@ -111,7 +111,7 @@
all calls to the 'real' gnome speech speaker.
"""
- def __init__(self, gnome_speaker):
+ def __init__(self, gnome_speaker, voice):
# We know what we are doing here, so tell pylint not to flag
# the self._this() method call as an error. The disable-msg is
@@ -123,6 +123,7 @@
if settings.enableSpeechCallbacks:
gnome_speaker.registerSpeechCallback(self._this())
self.__callbacks = []
+ self.voiceInfo = [voice.name, voice.language, voice.gender]
def registerCallback(self, callback):
self.__callbacks.append(callback)
@@ -504,7 +505,7 @@
#
# pylint: disable-msg=W0212
- speaker = _Speaker(s._narrow(GNOME.Speech.Speaker))
+ speaker = _Speaker(s._narrow(GNOME.Speech.Speaker), voice)
# Turn off punctuation. We do this because we want to handle
# spoken punctuation on our own. Only do so if "punctuation mode"
@@ -521,17 +522,34 @@
speaker.registerCallback(self)
- parameters = speaker.getSupportedParameters()
- for parameter in parameters:
- if parameter.name == "rate":
- self.__rateInfo[speaker] = \
- [parameter.min, parameter.current, parameter.max]
- elif parameter.name == "pitch":
- self.__pitchInfo[speaker] = \
- [parameter.min, parameter.current, parameter.max]
- elif parameter.name == "volume":
- self.__volumeInfo[speaker] = \
- [parameter.min, parameter.current, parameter.max]
+ # Hack - see if we have created a new speaker for a new voice
+ # for the engine. If so, save away the min/current/max parameters.
+ # Otherwise, use the ones we saved away. The problem is that
+ # each time we get the parameters, the current one reflects the
+ # current value. We only want to save the value the first time
+ # because at that time, the current value is the default value.
+ #
+ saveParameters = True
+ for existingSpeaker in self.__speakers.values():
+ if existingSpeaker.voiceInfo == speaker.voiceInfo:
+ self.__rateInfo[speaker] = self.__rateInfo[existingSpeaker]
+ self.__pitchInfo[speaker] = self.__pitchInfo[existingSpeaker]
+ self.__volumeInfo[speaker] = self.__volumeInfo[existingSpeaker]
+ saveParameters = False
+ break
+
+ if saveParameters:
+ parameters = speaker.getSupportedParameters()
+ for parameter in parameters:
+ if parameter.name == "rate":
+ self.__rateInfo[speaker] = \
+ [parameter.min, parameter.current, parameter.max]
+ elif parameter.name == "pitch":
+ self.__pitchInfo[speaker] = \
+ [parameter.min, parameter.current, parameter.max]
+ elif parameter.name == "volume":
+ self.__volumeInfo[speaker] = \
+ [parameter.min, parameter.current, parameter.max]
if ACSS.RATE in acss:
self.__setRate(speaker, acss[ACSS.RATE])
Modified: trunk/src/orca/orca-setup.glade
==============================================================================
--- trunk/src/orca/orca-setup.glade (original)
+++ trunk/src/orca/orca-setup.glade Mon Feb 16 21:50:08 2009
@@ -19,6 +19,7 @@
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<signal name="destroy" handler="windowDestroyed" last_modification_time="Tue, 12 Sep 2006 19:10:48 GMT"/>
+ <signal name="close" handler="windowClosed" last_modification_time="Tue, 12 Sep 2006 19:10:48 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
@@ -568,7 +569,7 @@
<property name="digits">1</property>
<property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
<property name="inverted">False</property>
- <property name="adjustment">5 0 9 0.10000000149 1 0</property>
+ <property name="adjustment">5 0 10 0.10000000149 1 0</property>
<accessibility>
<atkrelation target="pitchLabel" type="labelled-by"/>
</accessibility>
@@ -1138,7 +1139,7 @@
<property name="digits">0</property>
<property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
<property name="inverted">False</property>
- <property name="adjustment">50 0 99 1 10 0</property>
+ <property name="adjustment">50 0 100 1 10 0</property>
<accessibility>
<atkrelation target="rateLabel" type="labelled-by"/>
</accessibility>
@@ -1166,7 +1167,7 @@
<property name="digits">1</property>
<property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
<property name="inverted">False</property>
- <property name="adjustment">9 0 9 0.10000000149 1 0</property>
+ <property name="adjustment">10 0 10 0.10000000149 1 0</property>
<accessibility>
<atkrelation target="volumeLabel" type="labelled-by"/>
</accessibility>
Modified: trunk/src/orca/orca_console_prefs.py
==============================================================================
--- trunk/src/orca/orca_console_prefs.py (original)
+++ trunk/src/orca/orca_console_prefs.py Mon Feb 16 21:50:08 2009
@@ -273,7 +273,7 @@
# range from 0-10 instead of 0-100.
#
defaultACSS[acss.ACSS.RATE] = 50
- defaultACSS[acss.ACSS.GAIN] = 9
+ defaultACSS[acss.ACSS.GAIN] = 100
defaultACSS[acss.ACSS.AVERAGE_PITCH] = 5
uppercaseACSS = acss.ACSS({acss.ACSS.AVERAGE_PITCH : 6})
hyperlinkACSS = acss.ACSS({})
Modified: trunk/src/orca/orca_gui_prefs.py
==============================================================================
--- trunk/src/orca/orca_gui_prefs.py (original)
+++ trunk/src/orca/orca_gui_prefs.py Mon Feb 16 21:50:08 2009
@@ -144,6 +144,9 @@
self.uppercaseVoice = None
self.window = None
self.workingFactories = None
+ self.savedGain = None
+ self.savedPitch = None
+ self.savedRate = None
def init(self):
"""Initialize the Orca configuration GUI. Read the users current
@@ -152,6 +155,26 @@
accordingly.
"""
+ # Restore the default rate/pitch/gain,
+ # in case the user played with the sliders.
+ #
+ try:
+ defaultVoice = settings.voices[settings.DEFAULT_VOICE]
+ except KeyError:
+ defaultVoice = {}
+ try:
+ self.savedGain = defaultVoice[acss.ACSS.GAIN]
+ except KeyError:
+ self.savedGain = 10.0
+ try:
+ self.savedPitch = defaultVoice[acss.ACSS.AVERAGE_PITCH]
+ except KeyError:
+ self.savedPitch = 5.0
+ try:
+ self.savedRate = defaultVoice[acss.ACSS.RATE]
+ except KeyError:
+ self.savedRate = 50.0
+
# ***** Key Bindings treeview initialization *****
self.keyBindView = self.widgets.get_widget("keyBindingsTreeview")
@@ -633,15 +656,15 @@
self._setSpeechFamiliesChoice(familyName)
rate = self._getRateForVoiceType(voiceType)
- if rate:
+ if rate != None:
self.get_widget("rateScale").set_value(rate)
pitch = self._getPitchForVoiceType(voiceType)
- if pitch:
+ if pitch != None:
self.get_widget("pitchScale").set_value(pitch)
volume = self._getVolumeForVoiceType(voiceType)
- if volume:
+ if volume != None:
self.get_widget("volumeScale").set_value(volume)
def _setSpeechFamiliesChoice(self, familyName):
@@ -2426,6 +2449,7 @@
rate = widget.get_value()
voiceType = self.get_widget("voiceTypes").get_active_text()
self._setRateForVoiceType(voiceType, rate)
+ settings.voices[settings.DEFAULT_VOICE][acss.ACSS.RATE] = rate
def pitchValueChanged(self, widget):
"""Signal handler for the "value_changed" signal for the pitchScale
@@ -2440,6 +2464,7 @@
pitch = widget.get_value()
voiceType = self.get_widget("voiceTypes").get_active_text()
self._setPitchForVoiceType(voiceType, pitch)
+ settings.voices[settings.DEFAULT_VOICE][acss.ACSS.AVERAGE_PITCH] = pitch
def volumeValueChanged(self, widget):
"""Signal handler for the "value_changed" signal for the voiceScale
@@ -2454,6 +2479,7 @@
volume = widget.get_value()
voiceType = self.get_widget("voiceTypes").get_active_text()
self._setVolumeForVoiceType(voiceType, volume)
+ settings.voices[settings.DEFAULT_VOICE][acss.ACSS.GAIN] = volume
def speechIndentationChecked(self, widget):
"""Signal handler for the "toggled" signal for the
@@ -3999,6 +4025,17 @@
orca.helpForOrca()
+ def restoreSettings(self):
+ """Restore the settings we saved away when opening the preferences
+ dialog."""
+ # Restore the default rate/pitch/gain,
+ # in case the user played with the sliders.
+ #
+ defaultVoice = settings.voices[settings.DEFAULT_VOICE]
+ defaultVoice[acss.ACSS.GAIN] = self.savedGain
+ defaultVoice[acss.ACSS.AVERAGE_PITCH] = self.savedPitch
+ defaultVoice[acss.ACSS.RATE] = self.savedRate
+
def applyButtonClicked(self, widget):
"""Signal handler for the "clicked" signal for the applyButton
GtkButton widget. The user has clicked the Apply button.
@@ -4013,6 +4050,8 @@
- widget: the component that generated the signal.
"""
+ self.restoreSettings()
+
enable = self.get_widget("speechSupportCheckbutton").get_active()
self.prefsDict["enableSpeech"] = enable
@@ -4062,8 +4101,7 @@
- widget: the component that generated the signal.
"""
- mag.finishLiveUpdating()
- self._cleanupSpeechServers()
+ self.windowClosed(widget)
self.get_widget("orcaSetupWindow").destroy()
def okButtonClicked(self, widget):
@@ -4083,6 +4121,19 @@
self._cleanupSpeechServers()
self.get_widget("orcaSetupWindow").destroy()
+ def windowClosed(self, widget):
+ """Signal handler for the "closed" signal for the orcaSetupWindow
+ GtkWindow widget. This is effectively the same as pressing the
+ cancel button, except the window is destroyed for us.
+
+ Arguments:
+ - widget: the component that generated the signal.
+ """
+
+ self.restoreSettings()
+ mag.finishLiveUpdating()
+ self._cleanupSpeechServers()
+
def windowDestroyed(self, widget):
"""Signal handler for the "destroyed" signal for the orcaSetupWindow
GtkWindow widget. Reset orca_state.orcaOS to None, so that the
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]