[orca/orca-gnome3: 67/87] Integrating pluglib in Orca's boot sequence #1



commit 2669ba787351c95e07cc4a5828cf25709e5cc0aa
Author: Javier Hernández Antúnez <jhernandez emergya es>
Date:   Thu Mar 24 23:45:36 2011 +0100

    Integrating pluglib in Orca's boot sequence #1

 src/orca/orca.py |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index e962a92..544b274 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -552,7 +552,14 @@ import httpserver
 import keynames
 import keybindings
 import orca_state
-import speech
+
+# JH: We're going to store the speech plugin
+# in a global variable called speech, so this
+# import isn't needed at this moment.
+#
+#import speech
+global speech
+
 import notification_messages
 
 from input_event import BrailleEvent
@@ -1472,6 +1479,10 @@ def _restoreXmodmap(keyList=[]):
 
     os.system("echo '%s' | xmodmap - > /dev/null 2>&1" % "\n".join(toRestore))
 
+def activeStartingPlugins(plugins):
+    for plug in plugins:
+        _pluginManager.enablePlugin(plug)
+
 def loadUserSettings(script=None, inputEvent=None, skipReloadMessage=False):
     """Loads (and reloads) the user settings module, reinitializing
     things such as speech if necessary.
@@ -1480,6 +1491,7 @@ def loadUserSettings(script=None, inputEvent=None, skipReloadMessage=False):
     """
 
     global _userSettings
+    global speech
 
     # Shutdown the output drivers and give them a chance to die.
 
@@ -1526,7 +1538,16 @@ def loadUserSettings(script=None, inputEvent=None, skipReloadMessage=False):
     for key in _commandLineSettings:
         setattr(settings, key, _commandLineSettings[key])
 
-    if settings.enableSpeech:
+    # Here, we're getting plugins for settingsManager
+    plugins = _settingsManager.getPlugins()
+    # What plugins will be enabled?
+    activePlugins = [plug for plug in plugins if plugins[plug]['active']]
+
+    # Enable starting plugins
+    activeStartingPlugins(activePlugins)
+
+    if settings.enableSpeech and 'speech' in activePlugins:
+        speech = _pluginManager.getPluginObject('speech')
         try:
             speech.init()
             if reloaded and not skipReloadMessage:



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