[orca/new-settings] Moved duplicated code from applyButtonClicked() and loadSelectedProfile() to a new method
- From: Juanje Ojeda Croissier <jojeda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/new-settings] Moved duplicated code from applyButtonClicked() and loadSelectedProfile() to a new method
- Date: Tue, 19 Oct 2010 06:06:13 +0000 (UTC)
commit ab65dd3d2165294905c97fafdf07b0d41fdc7788
Author: Juanje Ojeda <jojeda emergya es>
Date: Tue Oct 19 08:01:58 2010 +0200
Moved duplicated code from applyButtonClicked() and loadSelectedProfile() to a new method
src/orca/orca_gui_prefs.py | 91 +++++++++++++------------------------------
1 files changed, 28 insertions(+), 63 deletions(-)
---
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index c5b8277..0d8f5f1 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -33,6 +33,7 @@ import gobject
import pango # for ellipsize property constants of CellRendererText
import locale
import time
+import gconf
import acss
try:
@@ -4319,20 +4320,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
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.
- Write out the users preferences. If GNOME accessibility hadn't
- previously been enabled, warn the user that they will need to
- log out. Shut down any active speech servers that were started.
- Reload the users preferences to get the new speech, braille and
- key echo value to take effect. Do not dismiss the configuration
- window.
-
- Arguments:
- - widget: the component that generated the signal.
- """
-
+ def saveBasicSettings(self):
if not self._isInitialSetup:
self.restoreSettings()
@@ -4355,13 +4343,6 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
settings.SYSTEM_VOICE : acss.ACSS(self.systemVoice),
}
- if self._profilesCapable:
- activeProfile = self.getComboBoxList(self.profilesCombo)
- startingProfile = self.getComboBoxList(self.startingProfileCombo)
-
- self.prefsDict['activeProfile'] = activeProfile
- self.prefsDict['startingProfile'] = startingProfile
-
settings.setGKSUGrabDisabled(self.disableKeyGrabPref)
try:
@@ -4376,6 +4357,31 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
#
pass
+
+
+ def applyButtonClicked(self, widget):
+ """Signal handler for the "clicked" signal for the applyButton
+ GtkButton widget. The user has clicked the Apply button.
+ Write out the users preferences. If GNOME accessibility hadn't
+ previously been enabled, warn the user that they will need to
+ log out. Shut down any active speech servers that were started.
+ Reload the users preferences to get the new speech, braille and
+ key echo value to take effect. Do not dismiss the configuration
+ window.
+
+ Arguments:
+ - widget: the component that generated the signal.
+ """
+ self.saveBasicSettings()
+
+ if self._profilesCapable:
+ activeProfile = self.getComboBoxList(self.profilesCombo)
+ startingProfile = self.getComboBoxList(self.startingProfileCombo)
+
+ self.prefsDict['activeProfile'] = activeProfile
+ self.prefsDict['startingProfile'] = startingProfile
+
+
self.writeUserPreferences()
orca.loadUserSettings()
@@ -4542,55 +4548,14 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
print 'loading profile!'
- if not self._isInitialSetup:
- self.restoreSettings()
-
- enable = self.get_widget("speechSupportCheckButton").get_active()
- self.prefsDict["enableSpeech"] = enable
-
- if self.speechSystemsChoice:
- self.prefsDict["speechServerFactory"] = \
- self.speechSystemsChoice.__name__
-
- if self.speechServersChoice:
- self.prefsDict["speechServerInfo"] = \
- self.speechServersChoice.getInfo()
-
- if self.defaultVoice != None:
- self.prefsDict["voices"] = {
- settings.DEFAULT_VOICE : acss.ACSS(self.defaultVoice),
- settings.UPPERCASE_VOICE : acss.ACSS(self.uppercaseVoice),
- settings.HYPERLINK_VOICE : acss.ACSS(self.hyperlinkVoice)
- }
-
- settings.setGKSUGrabDisabled(self.disableKeyGrabPref)
+ self.saveBasicSettings()
- try:
- status = settings.setOrcaAutostart(self.enableAutostart)
- self.get_widget("autostartOrcaCheckButton").set_active(\
- settings.isOrcaAutostarted())
- except:
- # If we are pressing Apply or OK from an application preferences
- # dialog (rather than the general Orca preferences), then there
- # won't be a general pane, so we won't be able to adjust this
- # checkbox.
- #
- pass
-
- #self.writeUserPreferences()
- import gconf
gclient = gconf.client_get_default()
activeProfile = self.getComboBoxList(self.profilesCombo)
gclient.set_list('/apps/gnome-orca/activeProfile',
gconf.VALUE_STRING,
activeProfile)
- # TODO - JD/JO: Why is this call here? If it is not commented out,
- # returning to the Orca Preferences dialog after making a change
- # results in the original (non-changed) settings being displayed
- # in the Preferences dialog, even though the changed values have
- # correctly been written out.
- #
#orca.loadUserSettings()
self.prefsDict = _settingsManager.readPreferences()
self.init()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]