OSDN Git Service

IAccessible NVDAObjects name property: Use IAccessibleText When accname is not provid...
authorPeter Vágner <peter.v@datagate.sk>
Fri, 4 Dec 2009 09:51:20 +0000 (10:51 +0100)
committerPeter Vágner <peter.v@datagate.sk>
Fri, 4 Dec 2009 09:51:20 +0000 (10:51 +0100)
Default appmodule: Fixed a problem with reportCurrentLine script which was failing on the controls described above.

source/NVDAObjects/IAccessible/__init__.py
source/NVDAObjects/IAccessible/mozilla.py
source/appModules/_default.py

index fbf4876..38727dc 100644 (file)
@@ -552,6 +552,16 @@ the NVDAObject for IAccessible
                        res=self.IAccessibleObject.accName(self.IAccessibleChildID)\r
                except:\r
                        res=None\r
+               if not res and hasattr(self,'IAccessibleTextObject'):\r
+                       try:\r
+                               res=self.makeTextInfo(textInfos.POSITION_CARET).text\r
+                               if res:\r
+                                       return\r
+                       except (NotImplementedError, RuntimeError):\r
+                               try:\r
+                                       res=self.makeTextInfo(textInfos.POSITION_ALL).text\r
+                               except (NotImplementedError, RuntimeError):\r
+                                       res=None\r
                return res if isinstance(res,basestring) and not res.isspace() else None\r
 \r
        def _get_value(self):\r
@@ -1331,7 +1341,6 @@ _staticMap={
        ("MozillaContentWindowClass",oleacc.ROLE_SYSTEM_LISTITEM):"mozilla.ListItem",\r
        ("MozillaContentWindowClass",oleacc.ROLE_SYSTEM_DOCUMENT):"mozilla.Document",\r
        ("MozillaWindowClass",oleacc.ROLE_SYSTEM_DOCUMENT):"mozilla.Document",\r
-       ("MozillaUIWindowClass",IAccessibleHandler.IA2_ROLE_LABEL):"mozilla.Label",\r
        ("ConsoleWindowClass",oleacc.ROLE_SYSTEM_WINDOW):"ConsoleWindowClass",\r
        (None,oleacc.ROLE_SYSTEM_LIST):"List",\r
        (None,oleacc.ROLE_SYSTEM_COMBOBOX):"ComboBox",\r
index 363b4b1..c03d48e 100755 (executable)
@@ -76,14 +76,6 @@ class ListItem(Mozilla):
                        del children[0]\r
                return children\r
 \r
-class Label(Mozilla):\r
-\r
-       def _get_name(self):\r
-               name=super(Label,self)._get_name()\r
-               if not name or name=="":\r
-                       name=self.makeTextInfo(textInfos.POSITION_ALL).text\r
-               return name\r
-\r
 class ComboBox(Mozilla):\r
 \r
        shouldAllowIAccessibleFocusEvent=True\r
index dd07c59..e161459 100755 (executable)
@@ -55,7 +55,7 @@ class AppModule(appModuleHandler.AppModule):
                        obj=virtualBuffer\r
                try:\r
                        info=obj.makeTextInfo(textInfos.POSITION_CARET)\r
-               except NotImplementedError:\r
+               except (NotImplementedError, RuntimeError):\r
                        info=obj.makeTextInfo(textInfos.POSITION_FIRST)\r
                info.expand(textInfos.UNIT_LINE)\r
                if scriptHandler.getLastScriptRepeatCount()==0:\r