def onWindowCreate(self, event): """Called whenever a window is created in the notify-osd application. Arguments: - event: the Event. """ try: ivalue = event.source.queryValue() value = ivalue.currentValue except NotImplementedError: value = -1 utterances = [] message = "" if value < 0: # Translators: This denotes a notification to the user of some sort. # utterances.append(_('Notification')) utterances.append(self.voices.get(settings.SYSTEM_VOICE)) message = '%s %s' % (event.source.name, event.source.description) utterances.append(message) utterances.append(self.voices.get(settings.DEFAULT_VOICE)) else: # A gauge notification, e.g. the Ubuntu volume notification that # appears when you press the multimedia keys. # message = '%s %d' % (event.source.name, value) utterances.append(message) utterances.append(self.voices.get(settings.SYSTEM_VOICE)) speech.speak(utterances, None, True) self.displayBrailleMessage(message, flashTime=settings.brailleFlashTime) notification_messages.saveMessage(message)
def onNameChanged(self, event): """Callback for object:property-change:accessible-name events.""" try: ivalue = event.source.queryValue() value = ivalue.currentValue except NotImplementedError: value = -1 utterances = [] message = "" if value < 0: utterances.append(messages.NOTIFICATION) utterances.append(self.voices.get(settings.SYSTEM_VOICE)) message = '%s %s' % (event.source.name, event.source.description) utterances.append(message) utterances.append(self.voices.get(settings.DEFAULT_VOICE)) else: # A gauge notification, e.g. the Ubuntu volume notification that # appears when you press the multimedia keys. # message = '%s %d' % (event.source.name, value) utterances.append(message) utterances.append(self.voices.get(settings.SYSTEM_VOICE)) speech.speak(utterances, None, True) self.displayBrailleMessage( message, flashTime=settings.brailleFlashTime) notification_messages.saveMessage(message)
def onNameChanged(self, event): """Callback for object:property-change:accessible-name events.""" try: ivalue = event.source.queryValue() value = ivalue.currentValue except NotImplementedError: value = -1 utterances = [] message = "" if value < 0: utterances.append(messages.NOTIFICATION) utterances.append(self.voices.get(settings.SYSTEM_VOICE)) message = '%s %s' % (event.source.name, event.source.description) utterances.append(message) utterances.append(self.voices.get(settings.DEFAULT_VOICE)) else: # A gauge notification, e.g. the Ubuntu volume notification that # appears when you press the multimedia keys. # message = '%s %d' % (event.source.name, value) utterances.append(message) utterances.append(self.voices.get(settings.SYSTEM_VOICE)) speech.speak(utterances, None, True) self.displayBrailleMessage(message, flashTime=settings.brailleFlashTime) notification_messages.saveMessage(message)
def onWindowCreated(self, event): """Callback for window:create accessibility events.""" hasRole = lambda x: x and x.getRole() == pyatspi.ROLE_LABEL allLabels = pyatspi.findAllDescendants(event.source, hasRole) texts = [self.utilities.displayedText(acc) for acc in allLabels] text = "%s %s" % (messages.NOTIFICATION, " ".join(texts)) speech.speak(text, None, True) self.displayBrailleMessage(text, flashTime=settings.brailleFlashTime) notification_messages.saveMessage(text)
def onWindowCreated(self, event): """Callback for window:create accessibility events.""" hasRole = lambda x: x and x.getRole() == pyatspi.ROLE_LABEL allLabels = pyatspi.findAllDescendants(event.source, hasRole) texts = [self.utilities.displayedText(acc) for acc in allLabels] text = '%s %s' % (messages.NOTIFICATION, ' '.join(texts)) speech.speak(text, None, True) self.displayBrailleMessage(text, flashTime=settings.brailleFlashTime) notification_messages.saveMessage(text)