def _iterNodesByType(self, itemType, direction="next", pos=None): superIter = super(WebAccessBmdti, self)._iterNodesByType(itemType, direction, pos) if itemType == "focusable": # `VirtualBuffer._iterNodesByType` does not support yielding # multiple focusable elements: It causes a core freeze. # TODO: This does not support yielding items made focusable by mutation. try: yield next(superIter) except StopIteration: return mgr = self.webAccess.ruleManager if not mgr: for item in superIter: yield item return zone = self.webAccess.zone if (zone and direction == "up" and isinstance(pos, textInfos.offsets.OffsetsTextInfo) and pos._startOffset == pos._endOffset == zone.endOffset): pos = pos.copy() pos.move(textInfos.UNIT_CHARACTER, -1) criteria = self.__getCriteriaForMutatedControlType(itemType) mutatedIter = self.__iterMutatedControlsByCriteria( criteria, itemType, direction, pos) for item in browseMode.mergeQuickNavItemIterators( (mutatedIter, superIter), direction): if zone: if item.textInfo._startOffset < zone.startOffset: if direction == "next": continue else: return elif item.textInfo._startOffset >= zone.endOffset: if direction == "previous": continue else: return if not isinstance(item, WebAccessMutatedQuickNavItem): controlId = None if isinstance(item, virtualBuffers.VirtualBufferQuickNavItem): docHandle, controlId = item.vbufFieldIdentifier elif isinstance(item, browseMode.TextInfoQuickNavItem): try: obj = item.textInfo.NVDAObjectAtStart controlId = obj.IA2UniqueID except: log.exception() if controlId is None: log.error((u"Could not determine controlId for item: {}" ).format(item)) elif mgr.getMutatedControl(controlId): # Avoid iterating twice over mutated controls. continue yield item
def _iterNodesByType(self,nodeType,direction="next",pos=None): if nodeType=="heading": return browseMode.mergeQuickNavItemIterators([UIATextAttributeQuickNavIterator("heading%d"%level,self,pos,UIAHandler.UIA_StyleIdAttributeId,UIAHandler.StyleId_Heading1+(level-1),direction,HeadingUIATextRangeQuickNavItem) for level in xrange(1,7)],direction) elif nodeType.startswith("heading"): level=int(nodeType[7:]) return UIATextAttributeQuickNavIterator(nodeType,self,pos,UIAHandler.UIA_StyleIdAttributeId,UIAHandler.StyleId_Heading1+(level-1),direction,HeadingUIATextRangeQuickNavItem) elif nodeType=="link": condition=UIAHandler.handler.clientObject.createPropertyCondition(UIAHandler.UIA_ControlTypePropertyId,UIAHandler.UIA_HyperlinkControlTypeId) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="checkBox": condition=UIAHandler.handler.clientObject.createPropertyCondition(UIAHandler.UIA_ControlTypePropertyId,UIAHandler.UIA_CheckBoxControlTypeId) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="radioButton": condition=UIAHandler.handler.clientObject.createPropertyCondition(UIAHandler.UIA_ControlTypePropertyId,UIAHandler.UIA_RadioButtonControlTypeId) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="comboBox": condition=UIAHandler.handler.clientObject.createPropertyCondition(UIAHandler.UIA_ControlTypePropertyId,UIAHandler.UIA_ComboBoxControlTypeId) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="graphic": condition=UIAHandler.handler.clientObject.createPropertyCondition(UIAHandler.UIA_ControlTypePropertyId,UIAHandler.UIA_ImageControlTypeId) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="table": condition=UIAHandler.handler.clientObject.createPropertyCondition(UIAHandler.UIA_ControlTypePropertyId,UIAHandler.UIA_TableControlTypeId) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="separator": condition=UIAHandler.handler.clientObject.createPropertyCondition(UIAHandler.UIA_ControlTypePropertyId,UIAHandler.UIA_SeparatorControlTypeId) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="focusable": condition=UIAHandler.handler.clientObject.createPropertyCondition(UIAHandler.UIA_IsKeyboardFocusablePropertyId,True) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="list": condition=createUIAMultiPropertyCondition({UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_ListControlTypeId,UIAHandler.UIA_IsKeyboardFocusablePropertyId:False}) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="container": condition=createUIAMultiPropertyCondition({UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_ListControlTypeId,UIAHandler.UIA_IsKeyboardFocusablePropertyId:False},{UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_TableControlTypeId}) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="edit": condition=createUIAMultiPropertyCondition({UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_EditControlTypeId,UIAHandler.UIA_ValueIsReadOnlyPropertyId:False}) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="formField": condition=createUIAMultiPropertyCondition({UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_EditControlTypeId,UIAHandler.UIA_ValueIsReadOnlyPropertyId:False},{UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_ListControlTypeId,UIAHandler.UIA_IsKeyboardFocusablePropertyId:True},{UIAHandler.UIA_ControlTypePropertyId:[UIAHandler.UIA_CheckBoxControlTypeId,UIAHandler.UIA_RadioButtonControlTypeId,UIAHandler.UIA_ComboBoxControlTypeId,UIAHandler.UIA_ButtonControlTypeId]}) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) elif nodeType=="nonTextContainer": condition=createUIAMultiPropertyCondition({UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_ListControlTypeId,UIAHandler.UIA_IsKeyboardFocusablePropertyId:True},{UIAHandler.UIA_ControlTypePropertyId:UIAHandler.UIA_ComboBoxControlTypeId}) return UIAControlQuicknavIterator(nodeType,self,pos,condition,direction) raise NotImplementedError
def _iterNodesByType(self, nodeType, direction="next", pos=None): if nodeType == "annotation": comments = UIATextAttributeQuicknavIterator( CommentUIATextInfoQuickNavItem, nodeType, self, pos, direction=direction) revisions = UIATextAttributeQuicknavIterator( RevisionUIATextInfoQuickNavItem, nodeType, self, pos, direction=direction) return browseMode.mergeQuickNavItemIterators([comments, revisions], direction) return super(WordBrowseModeDocument, self)._iterNodesByType(nodeType, direction=direction, pos=pos)
def _iterNodesByType(self,nodeType,direction="next",pos=None): if nodeType=="annotation": comments=UIATextAttributeQuicknavIterator(CommentUIATextInfoQuickNavItem,nodeType,self,pos,direction=direction) revisions=UIATextAttributeQuicknavIterator(RevisionUIATextInfoQuickNavItem,nodeType,self,pos,direction=direction) return browseMode.mergeQuickNavItemIterators([comments,revisions],direction) return super(WordBrowseModeDocument,self)._iterNodesByType(nodeType,direction=direction,pos=pos)