[orca/new-settings] Added import profile feature from command line
- From: Alejandro Leiva <aleiva src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/new-settings] Added import profile feature from command line
- Date: Thu, 28 Oct 2010 17:22:12 +0000 (UTC)
commit 10369ede8b31118cc771668e989a41b216e73c49
Author: Javier Hernández Antúnez <jhernandez emergya es>
Date: Thu Oct 28 18:48:41 2010 +0200
Added import profile feature from command line
src/orca/orca.py | 23 ++++++++++++++++++++---
src/orca/settings_manager.py | 6 ++----
2 files changed, 22 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 096ca51..f635a79 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -1902,6 +1902,12 @@ def usageString():
#
info[-1] += _("Prevent use of option")
+ # Translators: this is the Orca command line option to import to Orca
+ # a user profile from a given file
+ #
+ info.append("-i, --import-file=filename " + \
+ _("Import a profile from a given orca profile file"))
+
# Translators: this is the Orca command line option that will quit Orca.
# The user would run the Orca shell script again from a terminal window.
# If this command line option is specified, the script will quit any
@@ -1922,7 +1928,7 @@ def usageString():
# Translators: this is the Orca command line option to tell Orca to
# replace any existing Orca process(es) that might be running.
#
- info.append("--replace " +\
+ info.append("--replace " + \
_("Replace a currently running Orca"))
# Translators: this is text being sent to a terminal and we want to
@@ -1986,8 +1992,9 @@ def validateOptions(arglist, invalid=[]):
# n is for no setup
# t is for text setup
# v is for version
+ # i is for importing a user profile
#
- shortopts = "?stnvlmd:e:u:"
+ shortopts = "?stnvlmd:e:u:i:"
longopts = ["help",
"user-prefs-dir=",
"enable=",
@@ -2000,7 +2007,8 @@ def validateOptions(arglist, invalid=[]):
"debug",
"debug-file=",
"version",
- "replace"]
+ "replace",
+ "import-file="]
try:
opts, args = getopt.getopt(arglist, shortopts, longopts)
@@ -2162,6 +2170,15 @@ def main():
pyatspi.Registry.getDesktop(0))
names = [app.name for app in apps]
printMessageAndExit("\n".join(names))
+ if opt in ("-i", "--import-file"):
+ userProfileFile = val
+ if _settingsManager.importProfile(val):
+ msg = _("Profile import success")
+ printMessageAndExit(msg)
+ else:
+ msg = _("Unable to import profile")
+ printMessageAndExit(msg)
+
except:
debug.printException(debug.LEVEL_OFF)
usage()
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index 6e6837e..594a908 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -379,10 +379,8 @@ class SettingsManager():
keybindings = prefs['keybindings']
profile = prefs['profile']
- if self.saveSettings(general, pronunciations, keybindings):
- return True
- else:
- return False
+ self.saveSettings(general, pronunciations, keybindings)
+ return True
def getVoiceKey(voice):
voicesKeys = getattr(settings, 'voicesKeys')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]