Re: [orca-list] orca and scripts, part 3



this should also work if you install the depencys by yourself.
the script is just an .py file located here:
http://crivatec.de/page/uploads/Downloads/Accessible%20Games/$pkgname-$pkgver.tar.xz


Am 08.04.2015 um 00:53 schrieb Josh K:
unfortunately I am using a ubuntu mate system but its the latest.

follow me on twitter @joshknnd1982

On 4/7/2015 6:31 PM, chrys87 wrote:
If you are using an arch based system -> i just uploaded my working results on an OCR tool for the desktop.
https://aur.archlinux.org/packages/ocrdesktop/
its in an realy early stage. its an stand alone application caused by orca doesnt react in non ATK able windows and its also not the job of a screenreader to read something it could not read.

This tool can for know
    - OCR the whole desktop (ocr the current window is on my todo list)
    - you can browse with a textcursor on the OCRed text
- you can see a wordlist of the OCRed text (with its coordinates on the screen and the confidence) alt + v - you can emulate a Left (Alt + l) / Middle (Alt + m) / Right (alt + r), Double Click (alt + d) or just route the Mouse over the in the view selected text/entry (alt +r)
    - in the wordlist the typeahead does work.

currently i m working on have better ocr results and an OCR current window function.

refering to this:
https://mail.gnome.org/archives/orca-list/2015-January/msg00206.html

you can bind the application ocrdesktop.py to an shortcut

Am 07.04.2015 um 22:56 schrieb Josh K:
it would also be nice to be able to OCR the screen and click on OCR'ed objects like you can with NVDA. OCR is useful in some applications.

follow me on twitter @joshknnd1982

On 4/7/2015 4:51 PM, kk wrote:

That would be so great.
For a long time I am considering working on some modules.
Presentation via impress is one major aspect and improving pdf accessibility is another one. I tryed Unity just few hours before in my office and find that apart from the dash issue, there is nothing that would rather stop me from using it. I am about to get a new laptop a thinkpad t440p or an x240 (but a thinkpad for sure ), so thinking of having unity on it.
Happy hacking.
Krishnakant.

On Tuesday 07 April 2015 02:48 PM, José Vilmar Estácio de Souza wrote:

Hi.
I'm sorry for the delay in writing about the subject, but the work is consuming much of my time.
I'll be back soon.

On 04/04/2015 10:31 AM, kk wrote:

Hey, awaiting the 4th part and perhaps more.
I haven't seen some thing for a long time so was curious.
Happy hacking.
Krishnakant.


On Monday 12 January 2015 07:33 AM, José Vilmar Estácio de Souza wrote:
Today we will try to write a new simple function in orca. This new function will cause Orca say Hello world when a key is pressed.

I am assuming that:
1. You have read and understood the two e-mails on this subject written previously.
2. You already has git installed and configured in your machine.
3. You know python.
4. You know how to compile and install orca manually.
5. you have another copy of the orca installed so that you can use it if anything goes wrong.


The first thing that we need to define is where to write our new function, and to define this, we need to answer a simple question:
The say hello must be announced by orca in any application?
The answer is yes and in this case a good candidate is default.py because the script present in this file seems to be extended by all scripts. This means that the new function will be present in all scripts too.

Before we begin I strongly suggest that we create one branch in git to receive the changes that will be made in Orca. Although this is not necessary, I consider good practice in development.

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

$ git branch hello-world
$ git checkout  hello-world
Switched to branch 'hello-world'
$ git status
On branch hello-world
nothing to commit, working directory clean

We are working in a branch called hello-world.
Now edit the file src/orca/scripts/default.py and include in the end of the file the following code:

------

    def presentHelloWorld(self, inputEvent):
        """ Presents the Hello world message. """
        message = "Hello world from orca"
        self.presentMessage(message)
        return True
------

Important: The ------ are not part of the code.
Seems that the function must always return true.
The function presentMessage used in our function is a orca function.
The documentation of the presentMessage( function says:
def presentMessage(self, fullMessage, briefMessage=None, voice=None): """Convenience method to speak a message and 'flash' it in braille.

        Arguments:
- fullMessage: This can be a string or a list. This will be presented as the message for users whose flash or message verbosity level is
          verbose.
- briefMessage: This can be a string or a list. This will be presented as the message for users whose flash or message verbosity level is brief. Note that providing no briefMessage will result in the full message being used for either. Callers wishing to present nothing as the briefMessage should set briefMessage to an empty string. - voice: The voice to use when speaking this message. By default, the
          "system" voice will be used.
        """

Ok, our presentHelloWorld function is done but we need to tell orca that this function must be exposed as a command, so that a key can be binded to it. This is done in the function setupInputEventHandlers present in the file default.py, the same file that we are editing.

The documentation of this function is:

    def setupInputEventHandlers(self):
"""Defines InputEventHandler fields for this script that can be
        called by the key and braille bindings."""
In the function setupInputEventHandlers we have the following sequence:
        self.inputEventHandlers["presentDateHandler"] = \
            input_event.InputEventHandler(
                Script.presentDate,
                cmdnames.PRESENT_CURRENT_DATE)

We can include after that the following code:

self.inputEventHandlers["presentHelloWorldHandler"] = \
            input_event.InputEventHandler(
                Script.presentHelloWorld,
                cmdnames.PRESENT_HELLO_WORLD)

Pay attention to the indentation since it is crucial in python.

The next step is edit the src/orca/cmdnames.py and create the variable PRESENT_HELLO_WORLD. This variable contains a brief summary describing what the function does.
In the end of the file include the following code:


# Translators: this is for orca say hello world.
PRESENT_HELLO_WORLD = _("Say a hello message.")



To finish our function we need edit the file src/orcacommon_keyboardmap.py and include in that file the following:


    ("y", defaultModifierMask, ORCA_MODIFIER_MASK,
    "presentHelloWorldHandler"),

This lines must be included before the following text present in the end of the file.

    ("", defaultModifierMask, NO_MODIFIER_MASK,
    "shutdownHandler"),
)



The "presentHelloWorldHandler" is the same used in the setupInputEventHandlers.

We can also associate a key bind to our new function. Take a look in this file for examples. I am using in this example orca_key+y.


Ok, the function is ready, we can compile and install orca and test the new function.
Press orca_key+y to hear a simple Hello world.

Since the script is working, you can commit the changes to your branch, hello-world.

$ git status
On branch hello-world
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

    modified:   src/orca/cmdnames.py
    modified:   src/orca/common_keyboardmap.py
    modified:   src/orca/scripts/default.py

no changes added to commit (use "git add" and/or "git commit -a")
[hello-world cbb9973] A helloWorld function
 3 files changed, 17 insertions(+)

$ git commit -a -m'A helloWorld function'

[hello-world cbb9973] A helloWorld function
 3 files changed, 17 insertions(+)


That is it for while.
Thanks.

_______________________________________________
orca-list mailing list
orca-list gnome org
https://mail.gnome.org/mailman/listinfo/orca-list
Visit http://live.gnome.org/Orca for more information on Orca.
The manual is at http://library.gnome.org/users/gnome-access-guide/nightly/ats-2.html
The FAQ is at http://live.gnome.org/Orca/FrequentlyAskedQuestions
Log bugs and feature requests at http://bugzilla.gnome.org
Find out how to help at http://live.gnome.org/Orca/HowCanIHelp



_______________________________________________
orca-list mailing list
orca-list gnome org
https://mail.gnome.org/mailman/listinfo/orca-list
Visit http://live.gnome.org/Orca for more information on Orca.
The manual is at http://library.gnome.org/users/gnome-access-guide/nightly/ats-2.html
The FAQ is at http://live.gnome.org/Orca/FrequentlyAskedQuestions
Log bugs and feature requests at http://bugzilla.gnome.org
Find out how to help at http://live.gnome.org/Orca/HowCanIHelp

_______________________________________________
orca-list mailing list
orca-list gnome org
https://mail.gnome.org/mailman/listinfo/orca-list
Visit http://live.gnome.org/Orca for more information on Orca.
The manual is at http://library.gnome.org/users/gnome-access-guide/nightly/ats-2.html
The FAQ is at http://live.gnome.org/Orca/FrequentlyAskedQuestions
Log bugs and feature requests at http://bugzilla.gnome.org
Find out how to help at http://live.gnome.org/Orca/HowCanIHelp

_______________________________________________
orca-list mailing list
orca-list gnome org
https://mail.gnome.org/mailman/listinfo/orca-list
Visit http://live.gnome.org/Orca for more information on Orca.
The manual is at http://library.gnome.org/users/gnome-access-guide/nightly/ats-2.html
The FAQ is at http://live.gnome.org/Orca/FrequentlyAskedQuestions
Log bugs and feature requests at http://bugzilla.gnome.org
Find out how to help at http://live.gnome.org/Orca/HowCanIHelp




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