[orca] Temporary fix for the problem with script loading of version 2 and 3 of Yelp.



commit 2f41420d7530640e24ebd14716a68950cdce90a9
Author: Alejandro Leiva <aleiva emergya es>
Date:   Tue Mar 22 01:07:03 2011 +0100

    Temporary fix for the problem with script loading of version 2 and 3 of Yelp.

 src/orca/scripts/apps/yelp/__init__.py |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/src/orca/scripts/apps/yelp/__init__.py b/src/orca/scripts/apps/yelp/__init__.py
index aacda7d..6370bdc 100644
--- a/src/orca/scripts/apps/yelp/__init__.py
+++ b/src/orca/scripts/apps/yelp/__init__.py
@@ -25,19 +25,30 @@ __date__      = "$Date$"
 __copyright__ = "Copyright (c) 2011 The Orca Team."
 __license__   = "LGPL"
 
+import sys
+
 import pyatspi
 from orca.script_utilities import Utilities
 
+def unloadYelpScript(version):
+    if 'orca.scripts.apps.yelp.yelp_' + version in sys.modules:
+        del(sys.modules['orca.scripts.apps.yelp.yelp_' + version])
+
+
 def getScript(app):
     """Returns the correct version of the Yelp script based on toolkit."""
     docFrames = Utilities.descendantsWithRole(app, pyatspi.ROLE_DOCUMENT_FRAME)
-    print docFrames
+    toolkit = ""
     if docFrames:
         attrs = dict([a.split(':', 1) for a in docFrames[0].getAttributes()])
         toolkit = attrs.get('toolkit', '')
-        if toolkit == 'WebKitGtk':
-            from yelp_v3 import script
-            return script.Script(app)
 
-    from yelp_v2 import script
-    return script.Script(app)
+    if toolkit == 'WebKitGtk':
+        unloadYelpScript('v2')
+        from yelp_v3 import script
+        print sys.modules
+        return script.Script(app)
+    else:
+        from yelp_v2 import script
+        print sys.modules
+        return script.Script(app)



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