예제 #1
0
def showPreferencesUI():
    """Uses the console to query the user for Orca preferences."""

    prefsDict = {}

    if not setupSpeech(prefsDict):
        prefsDict["enableSpeech"] = False
        prefsDict["enableEchoByWord"] = False
        prefsDict["enableKeyEcho"] = False

    # Translators: this is prompting for whether the user wants to use a
    # refreshable braille display (an external hardware device) or not.
    #
    answer = sayAndPrint(_("Enable Braille?  Enter y or n: "), True, True,
                         speechServerChoice, speechVoiceChoice)
    prefsDict["enableBraille"] = checkYes(answer)

    # Translators: the braille monitor is a graphical display on the screen
    # that is used for debugging and demoing purposes.  It presents what
    # would be (or is being) shown on the external refreshable braille
    # display.
    #
    answer = sayAndPrint(_("Enable Braille Monitor?  Enter y or n: "), True,
                         True, speechServerChoice, speechVoiceChoice)
    prefsDict["enableBrailleMonitor"] = checkYes(answer)

    logoutNeeded = orca_prefs.writePreferences(prefsDict)
    if logoutNeeded:
        sayAndPrint(
            _("Accessibility support for GNOME has just been enabled."),
            logoutNeeded, False, speechServerChoice, speechVoiceChoice)
        sayAndPrint(
            _("You need to log out and log back in for the change to take effect."
              ), False, False, speechServerChoice, speechVoiceChoice)

        if desktopRunning:
            answer = sayAndPrint(
                _("Do you want to logout now?  Enter y or n: "), False, True,
                speechServerChoice, speechVoiceChoice)
            if checkYes(answer):
                sayAndPrint(_("Setup complete. Logging out now."), False,
                            False, speechServerChoice, speechVoiceChoice)
                time.sleep(2)

                import bonobo
                import gobject

                gobject.threads_init()
                gobject.idle_add(logoutUser)
                bonobo.main()

    answer = sayAndPrint(_("Setup complete.  Press Return to continue."),
                         not logoutNeeded, True, speechServerChoice,
                         speechVoiceChoice)

    for [factory, servers] in workingFactories:
        factory.SpeechServer.shutdownActiveServers()
예제 #2
0
        # we only care when the whole word has been printed
        if not word or word[-1] not in ' \n\t': return
        word = word[:-1]

        corrections = spell.check(word)
        if corrections:
            print word, 'is misspelled?', chr(7)
            for w, suggestions in corrections:
                print '  ', w, '->', ', '.join(suggestions)
        else:
            return

        global ev_count
        ev_count -= 1
        if ev_count == 0:
            bonobo.main_quit()


listener = MyListener()
objref = listener._this()
listener._default_POA().the_POAManager.activate()

registry.registerGlobalEventListener(objref, 'object:text-changed')

bonobo.main()

registry.deregisterGlobalEventListener(objref, 'object:text-changed')

registry.unref()
def showPreferencesUI():
    """Uses the console to query the user for Orca preferences."""

    prefsDict = {}

    if not setupSpeech(prefsDict):
        prefsDict["enableSpeech"]     = False
        prefsDict["enableEchoByWord"] = False
        prefsDict["enableKeyEcho"]    = False

    # Translators: this is prompting for whether the user wants to use a
    # refreshable braille display (an external hardware device) or not.
    #
    answer = sayAndPrint(_("Enable Braille?  Enter y or n: "),
                         True,
                         True,
                         speechServerChoice,
                         speechVoiceChoice)
    prefsDict["enableBraille"] = checkYes(answer)

    # Translators: the braille monitor is a graphical display on the screen
    # that is used for debugging and demoing purposes.  It presents what
    # would be (or is being) shown on the external refreshable braille
    # display.
    #
    answer = sayAndPrint(_("Enable Braille Monitor?  Enter y or n: "),
                         True,
                         True,
                         speechServerChoice,
                         speechVoiceChoice)
    prefsDict["enableBrailleMonitor"] = checkYes(answer)

    logoutNeeded = orca_prefs.writePreferences(prefsDict)
    if logoutNeeded:
        sayAndPrint(_("Accessibility support for GNOME has just been enabled."),
                    logoutNeeded,
                    False,
                    speechServerChoice,
                    speechVoiceChoice)
        sayAndPrint(_("You need to log out and log back in for the change to take effect."),
                    False,
                    False,
                    speechServerChoice,
                    speechVoiceChoice)

        if desktopRunning:
            answer = sayAndPrint(_("Do you want to logout now?  Enter y or n: "),
                                 False,
                                 True,
                                 speechServerChoice,
                                 speechVoiceChoice)
            if checkYes(answer):
                sayAndPrint(_("Setup complete. Logging out now."),
                            False,
                            False,
                            speechServerChoice,
                            speechVoiceChoice)
                time.sleep(2)

                import bonobo
                import gobject

                gobject.threads_init()
                gobject.idle_add(logoutUser)
                bonobo.main()

    answer = sayAndPrint(_("Setup complete.  Press Return to continue."),
                         not logoutNeeded,
                         True,
                         speechServerChoice,
                         speechVoiceChoice)

    for [factory, servers] in workingFactories:
        factory.SpeechServer.shutdownActiveServers()
예제 #4
0
파일: registry.py 프로젝트: GNOME/at-spi
    if gil:
      def releaseGIL():
        try:
          time.sleep(1e-5)
        except KeyboardInterrupt, e:
          # store the exception for later
          releaseGIL.keyboard_exception = e
          self.stop()
        return True
      # make room for an exception if one occurs during the 
      releaseGIL.keyboard_exception = None
      i = gobject.idle_add(releaseGIL)
      
    # enter the main loop
    try:
      bonobo.main()
    finally:
      # clear all observers
      for name, ob in self.observers.items():
        ob.unregister(self.reg, name)
      if gil:
        gobject.source_remove(i)
        if releaseGIL.keyboard_exception is not None:
          # raise an keyboard exception we may have gotten earlier
          raise releaseGIL.keyboard_exception

  def stop(self, *args):
    '''Quits the main loop.'''
    try:
      bonobo.main_quit()
    except RuntimeError: