except:\r
log.debugWarning("IAccessible2::scrollTo failed", exc_info=True)\r
\r
+ allowIAccessibleChildIDAndChildCountForPositionInfo=False #: if true position info should fall back to using the childID and the parent's accChildCount for position information if there is nothing better available.\r
+\r
def _get_positionInfo(self):\r
info={}\r
level=similarItemsInGroup=indexInGroup=0\r
gotVars=True\r
except COMError:\r
pass\r
- if indexInGroup==0:\r
+ if self.allowIAccessibleChildIDAndChildCountForPositionInfo and indexInGroup==0:\r
indexInGroup=self.IAccessibleChildID\r
- if indexInGroup>0 and similarItemsInGroup<indexInGroup:\r
- parent=self.parent=self.parent\r
- similarItemsInGroup=parent.childCount\r
+ if self.allowIAccessibleChildIDAndChildCountForPositionInfo and indexInGroup>0 and similarItemsInGroup<indexInGroup:\r
+ parent=self.parent\r
+ if parent:\r
+ similarItemsInGroup=parent.childCount\r
if level>0:\r
info['level']=level\r
if indexInGroup<=similarItemsInGroup and indexInGroup>0:\r
\r
class TaskListIcon(IAccessible):\r
\r
+ allowIAccessibleChildIDAndChildCountForPositionInfo=True\r
+\r
def _get_role(self):\r
return controlTypes.ROLE_ICON\r
\r
return value\r
\r
def _get_positionInfo(self):\r
- info=super(ListItem,self)._get_positionInfo()\r
+ index=self.IAccessibleChildID\r
totalCount=winUser.sendMessage(self.windowHandle,LVM_GETITEMCOUNT,0,0)\r
- info['similarItemsInGroup']=totalCount\r
- return info\r
+ return dict(indexInGroup=index,similarItemsInGroup=totalCount) \r
\r
def event_stateChange(self):\r
if self.hasFocus:\r