Re: [orca-list] Creating new scripts
- From: Willie Walker <walker willie gmail com>
- To: Michael Whapples <mwhapples aim com>
- Cc: Orca-list <Orca-list gnome org>
- Subject: Re: [orca-list] Creating new scripts
- Date: Tue, 9 Feb 2010 10:35:26 -0500
Hi Michael:
I am wondering what is the best way to start writing a new script? I have read a number of docs suggested
by Willie Walker, they were useful. My question is more, do I copy the default script and modify the copy
or is there a way I can tell a completely new script to subclass/extend the default script?
Subclassing default.py or one of its subclasses would be the way to go. Copying default.py just duplicates
code and sets up a maintenance mess. :-) You might take a look under the src/orca/scripts/apps directory
for some real life examples.
Also is it a bit of guess work on choosing the best event to listen to? This is related to the bug I
mention in my last message, I have set myself the challenge to get orca to speak the label when the content
changes but at-spi reports three events which look suitable (one for the text being inserted, one for text
being deleted and one for visible data changing, I guess its probably the visible data changed one).
Yeah - there is a bit of guesswork and sleuthing that needs to be done for choosing the best event (or set of
events) to listen to. The way we typically do this is by turning the debug level on to maximum output and
then scouring the debug log. If the event model of AT-SPI were tightly spec'd, we might be able to get away
with a state machine. However, it is not tightly spec'd. So, we tend to look for sentinel events, and we
try to look for ones that are more specific than general.
For your specific example, the visible data changing one tends to be way too generic, so the text change
event route is probably better. To figure out which one to use, you can poke at the object in the event
handler and check to see if its state is consistent with what is on the screen - there's no specified order
for events, so you just need to play.
Note also that we generally try to keep event handling somewhat stateless in that we try to keep as little
stored history inside Orca as possible. There is some stateful stuff in there (e.g., what was the last object
with focus?), but we do try to keep the need for that down to a minimum.
Will
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]