def event_alert(self): if not config.conf["presentation"]["reportHelpBalloons"]: return speech.speakObject(self, reason=controlTypes.REASON_FOCUS) # Ideally, we wouldn't use getPropertiesBraille directly. braille.handler.message( braille.getPropertiesBraille(name=self.name, role=self.role))
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() # Simply calling `reportFocus` doesn't output the text in braille # and reporting with `ui.message` needs an extra translation string when reporting position info braille.handler.message(braille.getPropertiesBraille( name=self.name, role=self.role, positionInfo=self.positionInfo ))
def event_show(self): if not config.conf["presentation"]["reportTooltips"]: return speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS) # Ideally, we wouldn't use getPropertiesBraille directly. braille.handler.message( braille.getPropertiesBraille(name=self.name, role=self.role))
def event_UIA_elementSelected(self, obj, nextHandler): # Logic for IME candidate items is handled all within its own object # Therefore pass these events straight on. if isinstance(obj, ImeCandidateItem): return 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.UIAAutomationId == "CandidateList": return speech.cancelSpeech() # Sometimes, due to bad tree traversal or wrong item getting selected, # something other than the selected item sees this event. # In build 18262, emoji panel may open to People group and skin tone modifier gets selected. if obj.parent.UIAAutomationId == "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.UIAAutomationId != "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.getPropertiesBraille( 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_UIA_elementSelected(self): # Cancel speech to have speech announce the selection as soon as possible. # This is needed because L{reportFocus} does not cancel speech. # Therefore, if speech wouldn't be cancelled, # selection announcements would queue up when changing selection rapidly. speech.cancelSpeech() api.setNavigatorObject(self, isFocus=True) self.reportFocus() # Display results as flash messages. braille.handler.message(braille.getPropertiesBraille( name=self.name, role=self.role, positionInfo=self.positionInfo, description=self.description ))