[orca/new-settings] Add means to get just the customized settings and their values. (Refix for the orca-customizations i
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/new-settings] Add means to get just the customized settings and their values. (Refix for the orca-customizations i
- Date: Sat, 11 Dec 2010 14:44:38 +0000 (UTC)
commit c6312570e1b2bbeda316499522a5df7f0bad21ee
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Sat Dec 11 01:05:52 2010 -0500
Add means to get just the customized settings and their values. (Refix for the orca-customizations issues)
src/orca/default.py | 6 ++++--
src/orca/settings_manager.py | 36 +++++++++++++++++++++++++++++-------
2 files changed, 33 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/default.py b/src/orca/default.py
index 239e72b..4aa72c6 100644
--- a/src/orca/default.py
+++ b/src/orca/default.py
@@ -5063,8 +5063,10 @@ class Script(script.Script):
(as specified by the settings.userCustomizableSettings dictionary)."""
_settingsManager = getattr(orca, '_settingsManager')
-
- return _settingsManager.getGeneralSettings(_settingsManager.profile)
+ generalSettings = \
+ _settingsManager.getGeneralSettings(_settingsManager.profile)
+ generalSettings.update(_settingsManager.customizedSettings)
+ return generalSettings
def restoreOldAppSettings(self, prefsDict):
"""Restore a copy of all the previous saved application settings.
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index cdb3848..a689824 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -92,6 +92,8 @@ class SettingsManager(object):
if not self._loadBackend():
raise Exception('SettingsManager::_loadBackend fails.')
+ self.customizedSettings = None
+
# Load the backend and the default values
self._backend = self.backendModule.Backend()
self._setDefaultGeneral()
@@ -182,14 +184,32 @@ class SettingsManager(object):
def _setDefaultGeneral(self):
"""Get the general settings by default from orca.settings"""
- if not self.isFirstStart():
- self._loadUserCustomizations()
+ self._getCustomizedSettings()
self.defaultGeneral = {}
for key in settings.userCustomizableSettings:
- try:
- self.defaultGeneral[key] = getattr(settings, key)
- except:
- pass
+ value = self.customizedSettings.get(key)
+ if value == None:
+ try:
+ value = getattr(settings, key)
+ except:
+ pass
+ self.defaultGeneral[key] = value
+
+ def _getCustomizedSettings(self):
+ if self.customizedSettings != None:
+ return self.customizedSettings
+
+ originalSettings = {}
+ for key, value in settings.__dict__.items():
+ originalSettings[key] = value
+
+ self._loadUserCustomizations()
+
+ self.customizedSettings = {}
+ for key, value in originalSettings.items():
+ customValue = settings.__dict__.get(key)
+ if value != customValue:
+ self.customizedSettings[key] = customValue
def _loadUserCustomizations(self):
pathList = [settings.userPrefsDir]
@@ -293,7 +313,9 @@ class SettingsManager(object):
def _setSettingsRuntime(self, settingsDict):
for key, value in settingsDict.items():
setattr(settings, str(key), value)
- self._loadUserCustomizations()
+ self._getCustomizedSettings()
+ for key, value in self.customizedSettings.items():
+ setattr(settings, str(key), value)
def getGeneralSettings(self, profile='default'):
"""Return the current general settings.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]