Re: Start to scripting Orca



Hi Javier:

Rather than providing custom global keystrokes for Orca, such as a
keystroke to speak/braille the time, scripts are generally intended to
provide specific output behavior for an application.  Scripts can, of
course, also provide custom keystrokes to control Orca and to interact
with the application, but we generally want to rely upon the built-in
keyboard navigation of the desktop and applications.

As such, if you want to begin writing scripts, the better thing to would
be to pick an application you really want better access to and start
writing a script for that.  But, if you really want a global keystroke
for telling the time, then you can add something like the following to
your ~/.orca/user-settings.py. This particular example sets up Insert+t
to say "Hello World."

# Set up custom keybindings.
#
import orca.braille
import orca.input_event
import orca.keybindings
import orca.orca
import orca.speech

from orca.orca_i18n import _

def sayHello(script, inputEvent=None):

    message = _("Hello World")

    # Say/braille something.
    #
    orca.speech.speak(message)
    orca.braille.displayMessage(message)

    # Consume the event so it will not go to an application.
    #
    return True

sayHelloHandler = orca.input_event.InputEventHandler(
    sayHello,
    _("Says hello to this fine world."))

myKeyBindings = orca.keybindings.KeyBindings()
myKeyBindings.add(orca.keybindings.KeyBinding(
    "t",
    1 << orca.orca.MODIFIER_ORCA,
    1 << orca.orca.MODIFIER_ORCA,
    sayHelloHandler))

keyBindingsMap = {}
keyBindingsMap["default"] = myKeyBindings

Hope this helps,

Will

On Wed, 2006-04-05 at 13:13 +0200, "Dorado MartÃnez, Francisco Javier"
wrote:
Hi to everyone 

I want to begin writing some code for Orca.
I intent to create a showTimeAndDate script that will say and braille the
current time and date.
I have a question:
Where should I put this script? I think into orca.py or perhaps util.py

Please Any help

Thanks 

Javier

 
_______________________________________________
Orca-list mailing list
Orca-list gnome org
http://mail.gnome.org/mailman/listinfo/orca-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]