[orca] Move the rest of the command line setting handling out of orca.py; fix old command line settings bug



commit db380ddba380dfbf12bd4ced0ef4ffa3ea0e0bd2
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon May 21 22:19:48 2012 -0400

    Move the rest of the command line setting handling out of orca.py; fix old command line settings bugs in the process

 src/orca/orca.py             |   22 +++++-----------------
 src/orca/orca_bin.py.in      |    4 ++--
 src/orca/settings_manager.py |    3 ++-
 3 files changed, 9 insertions(+), 20 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index fd9adf0..20a90c5 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -109,10 +109,6 @@ EXIT_CODE_HANG = 50
 #
 _userSettings = None
 
-# Command line options that override any other settings.
-#
-_commandLineSettings = {}
-
 # A subset of the original Xmodmap info prior to our stomping on it.
 # Right now, this is just for the user's chosen Orca modifier(s).
 #
@@ -435,13 +431,7 @@ def loadUserSettings(script=None, inputEvent=None, skipReloadMessage=False):
         except:
             debug.printException(debug.LEVEL_SEVERE)
 
-    # If any settings were added to the command line, they take
-    # precedence over everything else.
-    #
-    for key in _commandLineSettings:
-        setattr(settings, key, _commandLineSettings[key])
-
-    if settings.enableSpeech:
+    if _settingsManager.getSetting('enableSpeech'):
         try:
             speech.init()
             if reloaded and not skipReloadMessage:
@@ -461,7 +451,7 @@ def loadUserSettings(script=None, inputEvent=None, skipReloadMessage=False):
         debug.println(debug.LEVEL_CONFIGURATION,
                       "Speech module has NOT been initialized.")
 
-    if settings.enableBraille:
+    if _settingsManager.getSetting('enableBraille'):
         try:
             braille.init(_processBrailleEvent, settings.tty)
         except:
@@ -741,7 +731,7 @@ def quitOrca(script=None, inputEvent=None):
     Returns True to indicate the input event has been consumed.
     """
 
-    if settings.quitOrcaNoConfirmation:
+    if _settingsManager.getSetting("quitOrcaNoConfirmation"):
         shutdown()
     else:
         try:
@@ -781,7 +771,7 @@ def showSplashGUI(script=None, inputEvent=None):
                             globals(),
                             locals(),
                             [''])
-        if _commandLineSettings.get("showSplashWindow", True):
+        if _settingsManager.getSetting("showSplashWindow"):
             module.showSplashUI()
         else:
             module.hideSplashUI()
@@ -1013,7 +1003,7 @@ def cleanupGarbage():
         except:
             pass
 
-def main(settingsDict={}):
+def main():
     """The main entry point for Orca.  The exit codes for Orca will
     loosely be based on signals, where the exit code will be the
     signal used to terminate Orca (if a signal was used).  Otherwise,
@@ -1032,8 +1022,6 @@ def main(settingsDict={}):
     signal.signal(signal.SIGQUIT, shutdownOnSignal)
     signal.signal(signal.SIGSEGV, abortOnSignal)
 
-    _commandLineSettings.update(settingsDict)
-
     if not _settingsManager.isAccessibilityEnabled():
         _settingsManager.setAccessibility(True)
 
diff --git a/src/orca/orca_bin.py.in b/src/orca/orca_bin.py.in
index f0bbe69..5e6fe38 100644
--- a/src/orca/orca_bin.py.in
+++ b/src/orca/orca_bin.py.in
@@ -307,7 +307,7 @@ def main():
         print("Could not activate the settings manager. Exiting.")
         return 1
 
-    manager.activate(args.user_prefs)
+    manager.activate(args.user_prefs, settingsDict)
     sys.path.insert(0, manager.getPrefsDir())
 
     if args.profile:
@@ -330,7 +330,7 @@ def main():
                 'process with a new one.'))
         return 1
 
-    return orca.main(settingsDict)
+    return orca.main()
 
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index 8780b31..331acfa 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -111,9 +111,10 @@ class SettingsManager(object):
 
         debug.println(debug.LEVEL_FINEST, 'INFO: Settings manager initialized')
 
-    def activate(self, prefsDir=None):
+    def activate(self, prefsDir=None, customSettings={}):
         debug.println(debug.LEVEL_FINEST, 'INFO: Activating settings manager')
 
+        self.customizedSettings.update(customSettings)
         self._prefsDir = prefsDir \
             or os.path.join(GLib.get_user_data_dir(), "orca")
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]