def onTextInserted(self, event): """Called whenever text is inserted into an object. Arguments: - event: the Event """ obj = event.source self._debug("onTextInserted: name='%s', role='%s', parent='%s'" \ % (obj.name, obj.role, obj.parent.role)) parent = obj.parent if parent.role == rolenames.ROLE_AUTOCOMPLETE: # Thunderbird does not present all the text in an # autocompletion text entry. This is a workaround. # speech.stop() utterances = [] [text, caretOffset, startOffset] = self.getTextLineAtCaret(obj) utterances.append(text) self._debug("onTextInserted: utterances='%s'" % utterances) speech.speakUtterances(utterances) else: Gecko.Script.onTextInserted(self, event)
def presentStatusBar(self, obj): """Presents information about the metacity status bar.""" # We have to stop speech, as Metacity has a key grab and we're not # getting keys # speech.stop() # If the window was iconified, then obj.name will be surrounded by # brackets. If this is the case, remove them before comparing the # name against the various window names. See bug #522797 for more # details. # objName = obj.name if objName and len(objName): if objName[0] == "[" and objName[-1] == "]": objName = objName[1:-1] try: text = obj.name except: text = objName self.displayBrailleMessage(text) speech.speak(text)
def presentStatusBar(self, obj): """Presents information about the metacity status bar.""" # We have to stop speech, as Metacity has a key grab and we're not # getting keys # speech.stop() # If the window was iconified, then obj.name will be surronded by # brackets. If this is the case, remove them before comparing the # name against the various window names. See bug #522797 for more # details. # objName = obj.name if objName and len(objName): if objName[0] == "[" and objName[-1] == "]": objName = objName[1:-1] try: text = obj.name except: text = objName self.displayBrailleMessage(text) speech.speak(text)
def presentStatusBar(self, obj): """Presents information about the metacity status bar.""" # We have to stop speech, as Metacity has a key grab and we're not # getting keys # speech.stop() # If the window was iconified, then obj.name will be surronded by # brackets. If this is the case, remove them before comparing the # name against the various window names. See bug #522797 for more # details. # objName = obj.name if objName and len(objName): if objName[0] == "[" and objName[-1] == "]": objName = objName[1:-1] # Do we know about this window? Traverse through our list of apps # and go through the toplevel windows in each to see if we know # about this one. If we do, it's accessible. If we don't, it is # not. # found = False for app in self.utilities.knownApplications(): i = 0 try: childCount = app.childCount except: continue while i < childCount: try: win = app.getChildAtIndex(i) except: win = None if win is None: print("app error " + app.name) elif win.name == objName: found = True i = i + 1 try: text = obj.name except: text = objName # Translators: the "Workspace " and "Desk " strings are # the prefix of what metacity shows when you press # Ctrl+Alt and the left or right arrow keys to switch # between workspaces. The goal here is to find a match # with that prefix. # if text.startswith(_("Workspace ")) or text.startswith(_("Desk ")): pass elif not found: text += ". " + messages.INACCESSIBLE self.displayBrailleMessage(text) speech.speak(text)
def onActiveDescendantChanged(self, event): """Callback for object:active-descendant-changed accessibility events.""" if not event.any_data: return # Unity's result accessible object does not technically get focus, so # we only check that its parent has focus. if not event.source.getState().contains(pyatspi.STATE_FOCUSED): return if self.stopSpeechOnActiveDescendantChanged(event): speech.stop() if event.source.getState().contains(pyatspi.STATE_MANAGES_DESCENDANTS) and \ event.source.getRole() == pyatspi.ROLE_TOOL_BAR: orca.setLocusOfFocus(event, event.any_data, True, True)
def presentStatusBar(self, obj): """Presents information about the gtk-window-decorator status bar. Arguments: - obj: the accessible status bar. """ objName = obj.name if not (objName and len(objName)): return # gtk-window-decorator sometimes abbreviates the names, placing # '...' at the end. Strip the ending off so that we can compare # the beginning of the window names with the objName. # index = objName.rfind('...') if index >= 0: objName = objName[0:index] # Do we know about this window? Traverse through our list of apps # and go through the toplevel windows in each to see if we know # about this one. If we do, it's accessible. If we don't, it is # not. # found = False for app in self.utilities.knownApplications(): for child in app: if child.name.startswith(objName): found = True break text = obj.name if not found: # Translators: inaccessible means that the application cannot # be read by Orca. This usually means the application is not # friendly to the assistive technology infrastructure. # text += ". " + _("inaccessible") self.displayBrailleMessage(text) speech.stop() speech.speak(text)
def presentStatusBar(self, obj): """Presents information about the metacity status bar.""" # We have to stop speech, as Metacity has a key grab and we're not # getting keys # speech.stop() # Do we know about this window? Traverse through our list of apps # and go through the toplevel windows in each to see if we know # about this one. If we do, it's accessible. If we don't, it is # not. # found = False for app in self.getKnownApplications(): i = 0 while i < app.childCount: win = app.child(i) if win is None: print "app error " + app.name elif win.name == obj.name: found = True i = i + 1 text = obj.name # Translators: the "Workspace " and "Desk " strings are # the prefix of what metacity shows when you press # Ctrl+Alt and the left or right arrow keys to switch # between workspaces. The goal here is to find a match # with that prefix. # if text.startswith(_("Workspace ")) or text.startswith(_("Desk ")): pass elif not found: # Translators: inaccessible means that the application cannot # be read by Orca. This usually means the application is not # friendly to the assistive technology infrastructure. # text += ". " + _("inaccessible") braille.displayMessage(text) speech.speak(text)
def clearDynamicRowHeaders(self, inputEvent): """Clear the dynamic row headers. Arguments: - inputEvent: if not None, the input event that caused this action. """ cell = orca_state.locusOfFocus if cell and cell.parent.getRole() == pyatspi.ROLE_TABLE_CELL: cell = cell.parent row, column, table = self.utilities.getRowColumnAndTable(cell) try: del self.dynamicRowHeaders[hash(table)] speech.stop() self.presentMessage(messages.DYNAMIC_ROW_HEADER_CLEARED) except: pass return True
def onActiveDescendantChanged(self, event): """Called when an object who manages its own descendants detects a change in one of its children. Arguments: - event: the Event """ # If the user arrows into the "recent searches" portion of the # categories tree, the tree will stop claiming STATE_FOCUSED, # but continue to emit active-descendant-changed events. (Doing # an equality check seems to be safe here.) # if not event.source.getState().contains(pyatspi.STATE_FOCUSED) \ and orca_state.locusOfFocus \ and orca_state.locusOfFocus.parent != event.source: return # There can be cases when the object that fires an # active-descendant-changed event has no children. In this case, # use the object that fired the event, otherwise, use the child. # child = event.any_data if child: if self.stopSpeechOnActiveDescendantChanged(event): speech.stop() orca.setLocusOfFocus(event, child) else: orca.setLocusOfFocus(event, event.source) # We'll tuck away the activeDescendant information for future # reference since the AT-SPI gives us little help in finding # this. # if orca_state.locusOfFocus \ and (orca_state.locusOfFocus != event.source): self.pointOfReference['activeDescendantInfo'] = \ [orca_state.locusOfFocus.parent, orca_state.locusOfFocus.getIndexInParent()]
def onNameChanged(self, event): # Since we haven't feed back informationb when the # "work online/offline" status changes, we speech/braille the # statusbar content which is the the information that sets the # work online or work offline mode. # if event.source.role != rolenames.ROLE_STATUSBAR: default.Script.onNameChanged(self, event) return rolesList = [rolenames.ROLE_PUSH_BUTTON, rolenames.ROLE_FILLER, rolenames.ROLE_FILLER, rolenames.ROLE_FRAME] # We only speak the statusbar's changes when the application is # with the focus and is the "work online/offline button is focused. # if self.isDesiredFocusedItem(orca_state.locusOfFocus, rolesList): speech.stop() speech.speak(event.source.name) braille.displayMessage(event.source.name)
def onNameChanged(self, event): # Since we haven't feed back informationb when the # "work online/offline" status changes, we speech/braille the # statusbar content which is the the information that sets the # work online or work offline mode. # if event.source.role != rolenames.ROLE_STATUSBAR: default.Script.onNameChanged(self, event) return rolesList = [ rolenames.ROLE_PUSH_BUTTON, rolenames.ROLE_FILLER, rolenames.ROLE_FILLER, rolenames.ROLE_FRAME ] # We only speak the statusbar's changes when the application is # with the focus and is the "work online/offline button is focused. # if self.isDesiredFocusedItem(orca_state.locusOfFocus, rolesList): speech.stop() speech.speak(event.source.name) braille.displayMessage(event.source.name)
def presentStatusBar(self, obj): """Presents information about the gtk-window-decorator status bar. Arguments: - obj: the accessible status bar. """ objName = obj.name if not (objName and len(objName)): return # gtk-window-decorator sometimes abbreviates the names, placing # '...' at the end. Strip the ending off so that we can compare # the beginning of the window names with the objName. # index = objName.rfind('...') if index >= 0: objName = objName[0:index] # Do we know about this window? Traverse through our list of apps # and go through the toplevel windows in each to see if we know # about this one. If we do, it's accessible. If we don't, it is # not. # found = False for app in self.utilities.knownApplications(): for child in app: if child.name.startswith(objName): found = True break text = obj.name if not found: text += ". " + messages.INACCESSIBLE self.displayBrailleMessage(text) speech.stop() speech.speak(text)
def onNameChanged(self, event): # Since we haven't feed back informationb when the # "work online/offline" status changes, we speech/braille the # statusbar content which is the the information that sets the # work online or work offline mode. # if event.source.getRole() != pyatspi.ROLE_STATUS_BAR: default.Script.onNameChanged(self, event) return rolesList = [ pyatspi.ROLE_PUSH_BUTTON, pyatspi.ROLE_FILLER, pyatspi.ROLE_FILLER, pyatspi.ROLE_FRAME ] # We only speak the statusbar's changes when the application is # with the focus and is the "work online/offline button is focused. # if self.utilities.hasMatchingHierarchy(orca_state.locusOfFocus, rolesList): speech.stop() speech.speak(event.source.name) self.displayBrailleMessage(event.source.name)
def onNameChanged(self, event): # Since we haven't feed back informationb when the # "work online/offline" status changes, we speech/braille the # statusbar content which is the the information that sets the # work online or work offline mode. # if event.source.getRole() != pyatspi.ROLE_STATUS_BAR: default.Script.onNameChanged(self, event) return rolesList = [pyatspi.ROLE_PUSH_BUTTON, pyatspi.ROLE_FILLER, pyatspi.ROLE_FILLER, pyatspi.ROLE_FRAME] # We only speak the statusbar's changes when the application is # with the focus and is the "work online/offline button is focused. # if self.utilities.hasMatchingHierarchy( orca_state.locusOfFocus, rolesList): speech.stop() speech.speak(event.source.name) self.displayBrailleMessage(event.source.name)
def onActiveDescendantChanged(self, event): """Called when an object who manages its own descendants detects a change in one of its children. Arguments: - event: the Event """ # The tree table on the left side of Ekiga's Preferences dialog # has STATE_FOCUSABLE, but not STATE_FOCUSED. The default script # will ignore these events as a result. See bug 574221. # window = self.utilities.topLevelObject(event.source) if not window or window.getRole() != pyatspi.ROLE_DIALOG: return default.Script.onActiveDescendantChanged(self, event) # There can be cases when the object that fires an # active-descendant-changed event has no children. In this case, # use the object that fired the event, otherwise, use the child. # child = event.any_data if child: speech.stop() orca.setLocusOfFocus(event, child) else: orca.setLocusOfFocus(event, event.source) # We'll tuck away the activeDescendant information for future # reference since the AT-SPI gives us little help in finding # this. # if orca_state.locusOfFocus \ and (orca_state.locusOfFocus != event.source): self.pointOfReference['activeDescendantInfo'] = \ [orca_state.locusOfFocus.parent, orca_state.locusOfFocus.getIndexInParent()]