def event_UIA_elementSelected(self, obj, nextHandler): # #7273: When this is fired on categories, the first emoji from the new category is selected but not announced. # Therefore, move the navigator object to that item if possible. # However, in recent builds, name change event is also fired. # For consistent experience, report the new category first by traversing through controls. # #8189: do not announce candidates list itself (not items), as this is repeated each time candidate items are selected. if obj.UIAElement.cachedAutomationID == "CandidateList": return speech.cancelSpeech() # Sometimes clipboard candidates list gets selected, so ask NvDA to descend one more level. if obj.UIAElement.cachedAutomationID == "TEMPLATE_PART_ClipboardItemsList": obj = obj.firstChild candidate = obj # Sometimes, due to bad tree traversal, something other than the selected item sees this event. parent = obj.parent if obj.UIAElement.cachedClassName == "ListViewItem" and isinstance(parent, UIA) and parent.UIAElement.cachedAutomationID != "TEMPLATE_PART_ClipboardItemsList": # The difference between emoji panel and suggestions list is absence of categories/emoji separation. # Turns out automation ID for the container is different, observed in build 17666 when opening clipboard copy history. candidate = obj.parent.previous if candidate is not None: # Emoji categories list. ui.message(candidate.name) obj = candidate.firstChild if obj is not None: api.setNavigatorObject(obj) obj.reportFocus() braille.handler.message(braille.getBrailleTextForProperties(name=obj.name, role=obj.role, positionInfo=obj.positionInfo)) # Cache selected item. self._recentlySelected = obj.name else: # Translators: presented when there is no emoji when searching for one in Windows 10 Fall Creators Update and later. ui.message(_("No emoji")) nextHandler()
def event_selection(self): if not self.appModule.selectedItem: api.getFocusObject().event_suggestionsOpened() # This is to ease finding the elp document if self.appModule.selectedItem != self: self.appModule.selectedItem = self # If autocompletion popup is open and you write some text in the # document, the selection event is not fired. For some reason, neither # nameChange, so we need this check: if self.appModule.selectedItemName != self.name: self.appModule.selectedItemName = self.name speech.cancelSpeech() # Reporting as focused should be sufficient self.reportFocus() # I picked up this from UIA SuggestionItem for rendering in braille. # Simply calling `reportFocus` doesn't outputs the text to braille devices # and reporting with `ui.message` needs an extra translation string when reporting position info braille.handler.message( braille.getBrailleTextForProperties( name=self.name, role=self.role, position=self.positionInfo))
def event_UIA_elementSelected(self, obj, nextHandler): # #7273: When this is fired on categories, the first emoji from the new category is selected but not announced. # Therefore, move the navigator object to that item if possible. # However, in recent builds, name change event is also fired. # For consistent experience, report the new category first by traversing through controls. speech.cancelSpeech() # And no, if running on build 17040 and if this is typing suggestion, do not announce candidate window changes, as it is duplicate announcement and is anoying. if obj.UIAElement.cachedAutomationID == "IME_Candidate_Window": return candidate = obj if obj.UIAElement.cachedClassName == "ListViewItem": # The difference between emoji panel and suggestions list is absence of categories/emoji separation. # If dealing with keyboard entry suggestions (build 17040 and later), return immediately. candidate = obj.parent.previous if candidate is None: return ui.message(candidate.name) obj = candidate.firstChild if obj is not None: api.setNavigatorObject(obj) obj.reportFocus() braille.handler.message( braille.getBrailleTextForProperties( name=obj.name, role=obj.role, positionInfo=obj.positionInfo)) else: # Translators: presented when there is no emoji when searching for one in Windows 10 Fall Creators Update and later. ui.message(_("No emoji")) nextHandler()
def event_alert(self): if not config.conf["presentation"]["reportHelpBalloons"]: return speech.speakObject(self, reason=controlTypes.REASON_FOCUS) # Ideally, we wouldn't use getBrailleTextForProperties directly. braille.handler.message( braille.getBrailleTextForProperties(name=self.name, role=self.role))
def event_UIA_elementSelected(self, obj, nextHandler): # #7273: When this is fired on categories, the first emoji from the new category is selected but not announced. # Therefore, move the navigator object to that item if possible. # However, in recent builds, name change event is also fired. # For consistent experience, report the new category first by traversing through controls. # #8189: do not announce candidates list itself (not items), as this is repeated each time candidate items are selected. if obj.UIAElement.cachedAutomationID == "CandidateList": return speech.cancelSpeech() # Sometimes, due to bad tree traversal or wrong item getting selected, something other than the selected item sees this event. # Sometimes clipboard candidates list gets selected, so ask NvDA to descend one more level. if obj.UIAElement.cachedAutomationID == "TEMPLATE_PART_ClipboardItemsList": obj = obj.firstChild # In build 18262, emoji panel may open to People group and skin tone modifier or the list housing them gets selected. elif obj.UIAElement.cachedAutomationID == "SkinTonePanelModifier_ListView": obj = obj.next elif obj.parent.UIAElement.cachedAutomationID == "SkinTonePanelModifier_ListView": # But this will point to nothing if emoji search results are not people. if obj.parent.next is not None: obj = obj.parent.next else: obj = obj.parent.parent.firstChild candidate = obj if obj and obj.UIAElement.cachedClassName == "ListViewItem" and obj.parent and isinstance( obj.parent, UIA ) and obj.parent.UIAElement.cachedAutomationID != "TEMPLATE_PART_ClipboardItemsList": # The difference between emoji panel and suggestions list is absence of categories/emoji separation. # Turns out automation ID for the container is different, observed in build 17666 when opening clipboard copy history. candidate = obj.parent.previous if candidate is not None: # Emoji categories list. ui.message(candidate.name) obj = candidate.firstChild if obj is not None: api.setNavigatorObject(obj) obj.reportFocus() braille.handler.message( braille.getBrailleTextForProperties( name=obj.name, role=obj.role, positionInfo=obj.positionInfo)) # Cache selected item. self._recentlySelected = obj.name else: # Translators: presented when there is no emoji when searching for one in Windows 10 Fall Creators Update and later. ui.message(_("No emoji")) nextHandler()
def event_selection(self): if not self.appModule.selectedItem: api.getFocusObject().event_suggestionsOpened() # This is to ease finding the elp document if self.appModule.selectedItem != self: self.appModule.selectedItem = self # If autocompletion popup is open and you write some text in the # document, the selection event is not fired. For some reason, neither # nameChange, so we need this check: if self.appModule.selectedItemName != self.name: self.appModule.selectedItemName = self.name speech.cancelSpeech() # Reporting as focused should be sufficient self.reportFocus() # I picked up this from UIA SuggestionItem for rendering in braille. # Simply calling `reportFocus` doesn't outputs the text to braille devices # and reporting with `ui.message` needs an extra translation string when reporting position info braille.handler.message( braille.getBrailleTextForProperties(name=self.name, role=self.role, position=self.positionInfo))
def event_alert(self): if not config.conf["presentation"]["reportHelpBalloons"]: return speech.speakObject(self, reason=controlTypes.REASON_FOCUS) # Ideally, we wouldn't use getBrailleTextForProperties directly. braille.handler.message(braille.getBrailleTextForProperties(name=self.name, role=self.role))