Exemplo n.º 1
0
    def onTextInserted(self, event):
        """Called whenever text is inserted into gcalctool's text display.
        If the object is an instant message or chat, speak the text If we're
        not watching anything, do the default behavior.

        Arguments:
        - event: the text inserted Event
        """

        # This is an attempt to only read the display when enter or equals is
        # pressed - so when we get text insertions to the display, speak
        # them if the last key pressed was enter or equals.
        #
        # Always update the Braille display but only speak if the last
        # key pressed was enter or equals
        #
        if event.source == self._resultsDisplay:
            contents = self.getText(self._resultsDisplay, 0, -1)
            braille.displayMessage(contents)

            if (orca_state.lastInputEvent is None) \
                   or \
                   (not isinstance(orca_state.lastInputEvent,
                                   input_event.KeyboardEvent)):
                return

            if (orca_state.lastNonModifierKeyEvent.event_string == "space") \
                   or (orca_state.lastNonModifierKeyEvent.event_string \
                       == "Return") \
                   or (orca_state.lastNonModifierKeyEvent.event_string == "="):
                speech.speak(contents)
def decirInfoBateria(script, inputEvent=None):
  f=os.popen("acpi")
  speech.speak(f.read())
  f=os.popen("acpi")
  braille.displayMessage(f.read(80))
  f.close()
  return True
Exemplo n.º 3
0
def decirInfoBateria(script, inputEvent=None):
    f = os.popen("acpi")
    speech.speak(f.read())
    f = os.popen("acpi")
    braille.displayMessage(f.read(80))
    f.close()
    return True
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
    def onWindowActivated(self, event):
        """Called whenever one of gcalctool's toplevel windows is activated.

        Arguments:
        - event: the window activated Event
        """

        # If we haven't found the display, and this is a toplevel window,
        # look for the display in this window
        #
        if (self._resultsDisplay is None) \
               and (event.source.role == rolenames.ROLE_FRAME):

            # The widget hierarchy for gcalctool differs depending upon the
            # version.
            #
            # In GNOME 2.6 (gcalctool version 4.3.51 for example), the
            # display area was a text_view widget. This can be found by
            # looking for an accessible object with a role of ROLE_TEXT.
            #
            # For GNOME 2.10 and 2.12 there is a scrolled_window containing
            # the text_view display. This can be found by looking for an
            # accessible object with a role of ROLE_EDITBAR.
            #
            d = self.findByRole(event.source, rolenames.ROLE_TEXT)
            if len(d) == 0:
                d = self.findByRole(event.source, rolenames.ROLE_EDITBAR)

            # If d is an empty list at this point, we're unable to get the
            # gcalctool display. Inform the user.
            #
            if len(d) == 0:
                contents = "Unable to get calculator display"
                speech.speak(contents)
                braille.displayMessage(contents)
            else:
                self._resultsDisplay = d[0]
                contents = self.getText(self._resultsDisplay, 0, -1)
                braille.displayMessage(contents)

            # Call the default onWindowActivated function
            #
            default.Script.onWindowActivated(self, event)
Exemplo n.º 6
0
    def utterMessage(self, chatRoomName, message):
        """ Speak/braille a chat room message.
        messages are kept.

        Arguments:
        - chatRoomName: name of the chat room this message came from.
        - message: the chat room message.
        """

        global prefixChatMessage

        text = ""
        if prefixChatMessage:
            if chatRoomName and chatRoomName != "":
                text += _("Message from chat room %s") % chatRoomName + " "
        if message and message != "":
            text += message

        if text != "":
            braille.displayMessage(text)
            speech.speak(text)
Exemplo n.º 7
0
    def utterMessage(self, chatRoomName, message):
        """ Speak/braille a chat room message.
        messages are kept.

        Arguments:
        - chatRoomName: name of the chat room this message came from.
        - message: the chat room message.
        """

        global prefixChatMessage

        text = ""
        if prefixChatMessage:
            if chatRoomName and chatRoomName != "":
                text += _("Message from chat room %s") % chatRoomName + " "
        if message and message != "":
            text += message

        if text != "":
            braille.displayMessage(text)
            speech.speak(text)
Exemplo n.º 8
0
    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)
Exemplo n.º 9
0
    def onStateChanged(self, event):
        """Called whenever an object's state changes.

        Arguments:
        - event: the Event
        """
        obj = event.source

        self._debug("onStateChanged: '%s' %s (%d, %d)" % \
                    (obj.name, event.type, event.detail1, event.detail2))

        # Handle tooltip popups.
        #
        if obj.role == rolenames.ROLE_TOOL_TIP:
            if event.type.startswith("object:state-changed:showing") and \
               event.detail1 == 1:
                braille.displayMessage(obj.name)
                speech.speak(obj.name)
            # Delete the cached accessible to force the AT-SPI to update
            # the accessible cache. Otherwise, the event references the
            # previous popup object.
            #
            atspi.Accessible.deleteAccessible(obj._acc)

        # If focus moves to something within a panel and focus was not
        # already in the containing panel, the panel will issue its
        # own state-changed:focused event with detail1 == 1 after the
        # event for the item with focus.  The panel is not focused,
        # plus the extraneous event results in unnecessary chattiness
        # and updates the braille display to "panel."
        #
        elif obj.role == rolenames.ROLE_PANEL and \
             event.type.startswith("object:state-changed:focused") and \
             event.detail1 == 1 and not \
             event.source.state.count(atspi.Accessibility.STATE_FOCUSED):
            return

        else:
            default.Script.onStateChanged(self, event)
Exemplo n.º 10
0
    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 decirHoraYFecha(script, inputEvent=None):
  speech.speak(strftime("Son las %H y %M, %A, %d de %B de %Y",localtime()))
  braille.displayMessage(strftime("%H:%M | %d/%m/%Y",localtime()))

  return True
Exemplo n.º 12
0
    def onNameChanged(self, event):
        """Called whenever a property on an object changes.

        Arguments:
        - event: the Event
        """

        debug.printObjectEvent(self.debugLevel, event, event.source.toString())

        if event.source.role == rolenames.ROLE_FRAME:

            # If we've changed folders, announce the new folder name and
            # the number of items in it (see bug #350674).
            #
            # Unfortunately we get two of what appear to be idential events
            # when the accessible name of the frame changes. We only want to
            # speak/braille the new folder name if its different then last
            # time, so, if the Location bar is showing, look to see if the
            # same toggle button (with the same name) in the "path view" is
            # checked. If it isn't, then this is a new folder, so announce it.
            #
            # If the Location bar isn't showing, then just do a comparison of
            # the new folder name with the old folder name and if they are
            # different, announce it. Note that this doesn't do the right
            # thing when navigating directory hierarchies such as
            # /path/to/same/same/same.
            #
            allTokens = event.source.name.split(" - ")
            newFolderName = allTokens[0]

            allPanels = self.findByRole(event.source, rolenames.ROLE_PANEL)
            rolesList = [rolenames.ROLE_PANEL, \
                         rolenames.ROLE_FILLER, \
                         rolenames.ROLE_PANEL, \
                         rolenames.ROLE_TOOL_BAR, \
                         rolenames.ROLE_PANEL, \
                         rolenames.ROLE_FRAME, \
                         rolenames.ROLE_APPLICATION]
            locationBarFound = False
            for panel in allPanels:
                if self.isDesiredFocusedItem(panel, rolesList):
                    locationBarFound = True
                    break

            shouldAnnounce = False
            if locationBarFound:
                for i in range(0, panel.childCount):
                    child = panel.child(i)
                    if child.role == rolenames.ROLE_TOGGLE_BUTTON and \
                       child.state.count(atspi.Accessibility.STATE_CHECKED):
                        if not self.isSameObject(child, self.pathChild):
                            self.pathChild = child
                            shouldAnnounce = True
                            break

            else:
                if self.oldFolderName != newFolderName:
                    shouldAnnounce = True

            if shouldAnnounce:
                string = newFolderName
                string += self.getItemCount(event.source)
                debug.println(debug.LEVEL_INFO, string)
                speech.speak(string)
                braille.displayMessage(string)

            self.oldFolderName = newFolderName
            return

        # Pass the event onto the parent class to be handled in the default way.
        #
        default.Script.onNameChanged(self, event)
Exemplo n.º 13
0
def decirHoraYFecha(script, inputEvent=None):
    speech.speak(strftime("Son las %H y %M, %A, %d de %B de %Y", localtime()))
    braille.displayMessage(strftime("%H:%M | %d/%m/%Y", localtime()))

    return True