[orca/new-settings] Fix for the load startingProfile at the Orca launching
- From: Juanje Ojeda Croissier <jojeda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/new-settings] Fix for the load startingProfile at the Orca launching
- Date: Fri, 29 Oct 2010 12:19:35 +0000 (UTC)
commit 0e2d2c006483749d2fc92f5a905cacbb1b808b41
Author: Juanje Ojeda <jojeda emergya es>
Date: Fri Oct 29 14:19:14 2010 +0200
Fix for the load startingProfile at the Orca launching
src/orca/orca.py | 4 +---
src/orca/orca_gui_prefs.py | 7 +++++--
src/orca/settings_manager.py | 15 +++++++++++++--
3 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 0d52995..dfc6d77 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -1141,10 +1141,8 @@ def loadUserSettings(script=None, inputEvent=None):
except:
debug.printException(debug.LEVEL_SEVERE)
else:
+ _profile = _settingsManager.profile
try:
- #TODO: Temporal hack, we need to get it right
- _userSettings = _settingsManager.getGeneralSettings()
- _profile = _userSettings.get('startingProfile')[1]
_userSettings = _settingsManager.getGeneralSettings(_profile)
if _debugSwitch:
debug.debugLevel = debug.LEVEL_ALL
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 8c9782c..ce4b9b6 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -143,7 +143,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
if prefsDict is None:
generalSettings = _settingsManager.getGeneralSettings()
- activeProfile = generalSettings.get('activeProfile')
+ activeProfile = generalSettings.get('startingProfile')
else:
activeProfile = prefsDict['activeProfile']
@@ -4424,6 +4424,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
self.prefsDict['profile'] = activeProfile
self.prefsDict['activeProfile'] = activeProfile
self.prefsDict['startingProfile'] = startingProfile
+ _settingsManager.setStartingProfile('startingProfile')
self.prefsDict['firstStart'] = False
@@ -4599,6 +4600,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
activeProfile = self.getComboBoxList(self.profilesCombo)
self.prefsDict['activeProfile'] = activeProfile
_settingsManager.setProfile(activeProfile[1])
+ prefsDict = _settingsManager.getGeneralSettings(activeProfile[1])
self._initGUIState()
@@ -5344,7 +5346,8 @@ def showPreferencesUI():
except:
pass
- prefsDict = _settingsManager.getGeneralSettings()
+ startingProfile = _settingsManager.profile
+ prefsDict = _settingsManager.getGeneralSettings(startingProfile)
orca_state.prefsUIFile = \
os.path.join(orca_platform.prefix,
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index 5faa0bf..7736308 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -49,7 +49,7 @@ class SettingsManager():
cls.__instance = object.__new__(cls, *args, **kwargs)
return cls.__instance
- def __init__(self, backend='yaml', profile='default'):
+ def __init__(self, backend='yaml'):
"""Initialize a SettingsManager Object.
If backend isn't defined then uses default backend, in this
case gconf-backend.
@@ -61,7 +61,7 @@ class SettingsManager():
self.backendModule = None
self._backend = None
- self.profile = profile
+ self.profile = None
self.backendName = backend
# Dictionaries for store the default values
@@ -98,6 +98,7 @@ class SettingsManager():
self._setDefaultKeybindings()
self.defaultGeneralValues = getRealValues(self.defaultGeneral)
self.general = self.defaultGeneralValues.copy()
+ self.general.update(self._backend.getGeneral())
self.pronunciations = self.defaultPronunciations.copy()
self.keybindings = self.defaultKeybindings.copy()
@@ -109,6 +110,8 @@ class SettingsManager():
self._createDefaults()
# Set the active profile and load its stored settings
+ if self.profile is None:
+ self.profile = self.general.get('startingProfile')[1]
self.setProfile(self.profile)
def _loadBackend(self):
@@ -240,6 +243,13 @@ class SettingsManager():
except:
return False
+ def setStartingProfile(self, profile='default'):
+ self.defaultGeneral['startingProfile'] = profile
+ self._backend.saveDefaultSettings(self.defaultGeneral,
+ self.defaultPronunciations,
+ self.defaultKeybindings)
+
+
def setProfile(self, profile='default'):
"""Set a specific profile as the active one.
Also the settings from that profile will be loading
@@ -247,6 +257,7 @@ class SettingsManager():
self.profile = profile
self._loadProfileSettings(profile)
self._mergeSettings()
+ self._setSettingsRuntime(self.general)
def getPreferences(self, profile='default'):
general = self.getGeneralSettings(profile)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]