[orca/570658] More work on image links



commit 06a50bf96f13fec3fe143114a891051952dbb167
Author: Willie Walker <william walker sun com>
Date:   Wed May 20 16:16:05 2009 -0400

    More work on image links
    
    Needed to handle images inside links and getting the basename
    from the link
---
 .../scripts/toolkits/Gecko/speech_generator.py     |   23 +++++++++++--------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/orca/scripts/toolkits/Gecko/speech_generator.py b/src/orca/scripts/toolkits/Gecko/speech_generator.py
index bd3fe08..f9a47c4 100644
--- a/src/orca/scripts/toolkits/Gecko/speech_generator.py
+++ b/src/orca/scripts/toolkits/Gecko/speech_generator.py
@@ -92,18 +92,21 @@ class SpeechGenerator(speechgenerator.SpeechGenerator):
             result.extend(speechgenerator.SpeechGenerator._getName(self,
                                                                    obj,
                                                                    **args))
+        link = None
         if role == pyatspi.ROLE_LINK:
-            # Handle empty alt tags.
+            link = obj
+        elif role == pyatspi.ROLE_IMAGE and not result:
+            link = self._script.getAncestor(obj,
+                                            [pyatspi.ROLE_LINK],
+                                            [pyatspi.ROLE_DOCUMENT_FRAME])
+        if link and (not result or len(result[0].strip()) == 0):
+            # If there's no text for the link, expose part of the
+            # URI to the user.
             #
-            if result and len(result[0].strip()):
-                pass
-            else:
-                # If there's no text for the link, expose part of the
-                # URI to the user.
-                #
-                basename = self._script.getLinkBasename(obj)
-                if basename:
-                    result.append(basename)
+            basename = self._script.getLinkBasename(link)
+            if basename:
+                result.append(basename)
+
         return result
 
     def _getLabel(self, obj, **args):



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