RE: Start to scripting Orca



Hi to all

Willem you have to firstly activate whatever toggle button you want, tasks,
resources, etc 
Then to add and entry you have to go to the toolbar by tabbing the
application and look for a "insert task" button so a new task is inserted
before you press it. 
Then you can go to the table showing the new task information, and press
spacebar over the columns you want to modify. In the toolbar also there's
another unlabeled toggle button that if you press shows a popup menu to add,
remove or whatever action on the selected item.

Hope this clarify 

Regards,

Javier.
        

-----Mensaje original-----
De: Willem van der Walt [mailto:wvdwalt csir co za] 
Enviado el: jueves, 06 de abril de 2006 13:18
Para: Rich Burridge
CC: Orca screen reader developers
Asunto: Re: Start to scripting Orca


Hi,
Thanks for the detailed answer
and the script.
I grabbed Orca from CVS.  The make install did not put the new planner.py 
script into its place, but when copied there it worked.
I am still rather lost in the program though.  I think I have successfully 
added a resource, but will first have to check if it is actually added as 
a resource in the saved project file.  Planner uses xml to store the data 
in, so it is easy to check.
I cannot seem to get to the text entry fields for entering tasks. Does the
no focus message mean that Orca is lost as well? Thanks again for all the
trouble you  took so far. Regards, Willem


On Wed, 5 Apr 2006, Rich Burridge wrote:

Willem van der Walt wrote:
I have just now tried to use planner, a project management tool.  It 
sounds
like it should be usable with some scripting.

Yes.

The problem is that I am new to gnome and orca of course.  What is
happening is that the thing says "toggel button pressed" or not pressed 
when arrowing up and down. 

I see/hear this too. Visually there is a column of toggle buttons with 
graphical images down the left side of the main planner window. They 
have text below them:

Gantt Chart
Tasks
Resources
Resource Usage

Unfortunately that text is not currently available to Orca to read.

Now if I look at the component hierarchy with at-poke, I can see that 
that panel on the left is filled with a load of fillers each 
containing a toggle button and a label. This will be enough to allow 
us to get to the text describing each toggle button.

Above the line, a description occurs according to the 7 key on the 
numpad.
As I understand it, one can now  write a script to automaticly speak the 
description together with the status of the button.

Unfortunately it's not going to be as simple as that. The person(s) 
that wrote planner should have used a LABEL_FOR relationship to 
associated the label with the toggle button. I've filed bug #337382
(http://bugzilla.gnome.org/show_bug.cgi?id=337382) against planner on 
this.

Having said that, we can easily workaround this with an Orca script 
for planner.

Is this correct and is there an example script which might already 
handle
this situation?

Not exactly, but there are one that would make a good starting point.
Evolution
has similar code in it. For something like this, I would start with that. 
More on this below.

  Can one copy an existing script to the name of a new application to 
have
orca call it when the new application is opened?

Yes. To do a proper job (i.e. so that others can take advantage of 
this
work),
one would need to create a new script in the .../orca/src/orca/scripts 
directory
called planner.py   It could start off as a copy of one of the other
scripts 
in
that directory. You would also need to modify the Makefile.am file in that
directory, to make sure that the new script name was added to the
orca_python_PYTHON definition. This means that it would automatically
get installed in a location where Python can find it.

So here's what needs to be done to get this to work. I'll create an 
initial planner.py script with the following in it.

class Script(default.Script):

  def __init__(self, app):

      default.Script.__init__(self, app)

Note that the real planner.py will have a load of extra things in it 
like the initial copyright message, plus comments, debug messages and 
import lines, but in order to try to keep it simple, I'll leave that 
out here.

Now what we are interested in is when the focus is on one of those 
four toggle buttons. To do this from within the planner.py script, we 
need to subclass the onFocus() method. When that method is called, we 
check the hierarchy of the component that currently has focus to see 
if it matches what we want. To find out what we want, I would have 
previously run Planner with Orca and hit Insert-F7 when the focus was 
at one of the toggle buttons in Planner. Doing
that I determined that the component hierarchy I needed to be looking for
is:

toggle button
filler
filler
panel
panel
filler
filler
frame
application

I only need to use enough of these to make it unique.

Also, if it's a focus event for planner but it isn't this kind, then 
we just
want to pass
it off to the parent class.

This gives the following code:

  def onFocus(self, event):

      rolesList = [rolenames.ROLE_TOGGLE_BUTTON, \
                   rolenames.ROLE_FILLER, \
                   rolenames.ROLE_FILLER, \
                   rolenames.ROLE_PANEL, \
                   rolenames.ROLE_PANEL]
      if util.isDesiredFocusedItem(event.source, rolesList):
          ... handle this focus event ...
          return

      default.Script.onFocus(self, event)


Now we need to fill in the ".. handle this focus event ..." part.

What we want to do is use the filler component that is the parent of 
the toggle button that current has focus. It's other child will be the 
label that describes this toggle button. We want to get a handle to 
that, extract the label and speak it. Here's the code that does that:

          filler = event.source.parent
          allLabels = atspi.findByRole(filler, rolenames.ROLE_LABEL)
          speech.speak(allLabels[0].name)
          return

We just use allLabels[0] because we know that there is only going to 
be one label found.

I've checked in the full version of this script in CVS HEAD for Orca. 
I've also attached it to this message. If you place this in the 
installed location for your Orca scripts, then it should work for you. 
Or just check out the very latest version of Orca from CVS HEAD and 
configure, build and install it.

As you navigate Planner with Orca, I expect you to find other places 
where it's not providing enough information. Hopefully we'll be able 
to file bugs against Planner so that they properly fix up these 
problems. We should also hopefully be able to provide script 
workarounds to improve the usability as well.

ps. Where does user questions for orca go?

This is a great place to ask questions like this. The mailing list is
archived.
We can now point people back to this email.



-- 
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
 
CSIR E-mail Legal Notice http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html

 
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html 
 
For electronic copies of the CSIR Copyright, Terms and Conditions and the
CSIR Legal Notice send a blank message with REQUEST LEGAL in the subject
line to HelpDesk csir co za 


This message has been scanned for viruses and dangerous content by
MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for
their support.

_______________________________________________
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]