[orca-list] orca and scripts, part 2



I wrote previously that orca loads a script for each application and if orca does not find a script associated to the application that generated the event, a script called default.py is loaded. Also I wrote that there is a function in the script to process each event generate by at-spi.

We could assume then that every time we had to write a script for a new application we would have to write functions to process all events.
This is not true because a script can extend another script.

Take a look in the script used by orca when gedit is loaded.
orca/scripts/apps/gedit/script.py

Two important lines:
import orca.scripts.toolkits.gtk as gtk
class Script(gtk.Script):

Now take a look in the file orca/scripts/toolkits/gtk/script.py.
import orca.scripts.default as default
class Script(default.Script):

And finally take a look in the file orca/scripts/default.py.

import orca.script as script
class Script(script.Script):

You could also take a look in the file orca/script.py.


The script used to process events generated by gedit extends a class named Script present in the gtk script. The class Script from the gtk script extends a class named Script present in the default script. The class Script present in default script extends a class Script present in script called script.

Thus the script to gedit need not implement functions to process all events generated because the implementation has already been made in the scripts that were extended.

Only new events or events that require a different processing need to be implemented.


If I need to implement a new function that is used by all applications, probably I'll do it in the default.py file.

I will stop here, but hopefully in the next email we implement a hello world function.
Questions?
Thanks.



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