OSDN Git Service

Dialog NVDAObject behavior: When fetching text, don't add a space when the text of...
authorJames Teh <jamie@jantrid.net>
Fri, 27 Jan 2012 00:16:05 +0000 (10:16 +1000)
committerJames Teh <jamie@jantrid.net>
Fri, 27 Jan 2012 00:16:05 +0000 (10:16 +1000)
Fixes spurious announcement of property pages and dialogs in some cases when there is no text, such as the property page just below the top level frame in recent Firefox builds.

source/NVDAObjects/behaviors.py

index 2e5364a..47b1f2b 100755 (executable)
@@ -76,7 +76,9 @@ class Dialog(NVDAObject):
                                continue\r
                        #For particular objects, we want to descend in to them and get their children's message text\r
                        if childRole in (controlTypes.ROLE_PROPERTYPAGE,controlTypes.ROLE_PANE,controlTypes.ROLE_PANEL,controlTypes.ROLE_WINDOW,controlTypes.ROLE_GROUPING,controlTypes.ROLE_PARAGRAPH,controlTypes.ROLE_SECTION,controlTypes.ROLE_TEXTFRAME,controlTypes.ROLE_UNKNOWN):\r
-                               textList.append(cls.getDialogText(child))\r
+                               childText=cls.getDialogText(child)\r
+                               if childText:\r
+                                       textList.append(childText)\r
                                continue\r
                        # We only want text from certain controls.\r
                        if not (\r
@@ -100,7 +102,8 @@ class Dialog(NVDAObject):
                        childText=child.makeTextInfo(textInfos.POSITION_ALL).text\r
                        if not childText or childText.isspace() and child.TextInfo!=NVDAObjectTextInfo:\r
                                childText=child.basicText\r
-                       textList.append(childText)\r
+                       if childText:\r
+                               textList.append(childText)\r
                return " ".join(textList)\r
 \r
        def _get_description(self):\r