[orca/orca-gnome3: 74/87] Improved magnifiers integration



commit 42866d0af8591b07ed1a4931a1bc3e59421b9b4f
Author: José Ignacio �lvarez Ruiz <jialvarez emergya es>
Date:   Thu Mar 31 09:31:13 2011 +0200

    Improved magnifiers integration

 src/orca/orca.py           |   15 +++------------
 src/orca/orca_gui_prefs.py |   29 ++++++++++++++---------------
 2 files changed, 17 insertions(+), 27 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 0be6dfc..64651a5 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -541,19 +541,12 @@ if settings.useDBus:
     dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
     import dbusserver
 
-# NA: We're going to store the mag plugin
-# in a global variable called mag, so this
-# import isn't needed at this moment.
-#
-
 #try:
 #        import gsmag as mag
 #    except:
 #        import mag
 #else:
 #    import mag
-global mag
-mag = None
 
 import braille
 import httpserver
@@ -1604,12 +1597,10 @@ def loadUserSettings(script=None, inputEvent=None, skipReloadMessage=False):
             debug.println(debug.LEVEL_WARNING,
                           "Could not initialize connection to braille.")
 
-    if settings.enableMagnifier and 'mag' in activePlugins:
-        mag = _pluginManager.getPluginObject('mag')
-    elif settings.enableMagnifier and 'gsmag' in activePlugins:
+    if 'gsmag' in activePlugins:
         mag = _pluginManager.getPluginObject('gsmag')
-
-    print activePlugins
+    else:
+        mag = _pluginManager.getPluginObject('mag')
 
     if settings.enableMagnifier and ('mag' in activePlugins or 'gsmag' in activePlugins):
         try:
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 7bdd7ab..6541c05 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -35,10 +35,10 @@ import locale
 import time
 
 import acss
-try:
-    import gsmag as mag
-except:
-    import mag
+#try:
+#    import gsmag as mag
+#except:
+#    import mag
 import orca
 import orca_gtkbuilder
 import orca_state
@@ -51,13 +51,22 @@ import braille
 #import speechserver
 import text_attribute_names
 
-
 import orca_gui_profile
 
 _settingsManager = getattr(orca, '_settingsManager')
 _scriptManager = getattr(orca, '_scriptManager')
 _pluginManager = getattr(orca, '_pluginManager')
 
+# 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']]
+
+if 'gsmag' in activePlugins:
+    mag = _pluginManager.getPluginObject('gsmag')
+else:
+    mag = _pluginManager.getPluginObject('mag')
+
 global speech
 speech = _pluginManager.getPluginObject('speech')
 #if speech == None: import dummyspeech as speech
@@ -2366,11 +2375,9 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
             self.applyButtonClicked(self.get_widget('notebook'))
         elif plugin_name == 'gsmag' and not mag_exception:
             self.__updateMagTab(active)
-            self.__reloadGsmagModule(active)
             self.applyButtonClicked(self.get_widget('notebook'))
         elif plugin_name == 'mag' and not mag_exception:
             self.__updateMagTab(active)
-            self.__reloadMagModule(active)
             self.applyButtonClicked(self.get_widget('notebook'))
 # nacho's
 #        if active:
@@ -2412,14 +2419,6 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 #        speech = _pluginManager.getPluginObject('speech')
 #        if speech == None: import dummyspeech as speech
 
-    # We really need this method?
-    def __reloadMagModule(self, active):
-        mag.isActive = active
-
-    # We really need this method?
-    def __reloadGsmagModule(self, active):
-        gsmag.isActive = active
-
     def __updateMagTab(self, active):
         notebook = self.get_widget('notebook')
         gsmagTab = notebook.get_nth_page(4)



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