Re: [orca-list] Creating a wiki page to share Orca customizations? (wasRe: OCR Current Window)



Hi,
It sounds like an awesome idea. I was wondering also, for the sake of keeping the customizations file size to 
a reasonable size, could a script be written that would load multiple customization files from a sub 
directory? This would have several benefits, you could put one thing per file, and people could get the 
customizations they want, and not the others, the files would be smaller and easier to read, making it easier 
to debug etc.
So, I guess my question is, could a  customizations.py file be written that searches a subdirectory and loads 
all the .py files there as part of itself?
I will try to contribute to the scripts when the wiki page is created. Python isn't a strong point of mine, 
and python3 even more so, but I guess it's time to learn.
thanks
Storm
On Tue, Jan 27, 2015 at 11:19:45PM +0100, chrys87 wrote:
Hi list,

I think this is a good point. Here curses some "howtos" to script your orca installation. i already post some scripts so its not lost to the whole world. I would be able to host a wiki on my root server with grant access to anybody who need. should i do this? is this "near enough" to the gnome orca project? what does the majority think here$? whats the best way to provide our knowledge and scripts? i think we should document the great of extensibility that orca provide.

this is a importent topic i think.
but now i enjoy my pizza :).

cheers from germany

chrys

Am 26.01.2015 um 23:37 schrieb Joanmarie Diggs:
Hey Chrys, all.

This reminds me: It would be cool to have all of these collected
somewhere (like a wiki) so that people can share them. Any volunteers?

--joanie

On 01/26/2015 05:28 PM, chrys87 wrote:
Hi Guys,
i play a little arround with tesserwrap. i dont know if it really make
sense but maybe someone need this.
i wrote a little orca-cust for taking a screen shot of the current
window and pass it through tesseract. just press
orca + m
orca will start reading the content of the window (maybe the image
program or browser with pictures or an other not accessible content) and
set it to the clipboard.
You need tesseract tesserwrap, your tesseract-language-pack and orca >=
3.14

hier is the cust script for those who are interested in:

# Requiere: tesserwrap, tesseract, orca >=3.14
# -*- coding: utf-8 -*-

#Python
import os
from PIL import Image
import locale

#tesseract
from tesserwrap import tesseract

#GTK/GDK
from gi.repository import Gtk, Gdk

# Orca
import orca.orca
import orca.input_event
import orca.settings
import orca.keybindings
import orca.speech
import orca.braille

#Settings-
#this is need by arch for correct braille
orca.settings.tty = 1
#Settings+

#Bind Function to key-
myKeyBindings = orca.keybindings.KeyBindings()

def DefineShortcut(pHandle,pShortcut):
    myKeyBindings.add(orca.keybindings.KeyBinding(
        pShortcut,
        1 << orca.keybindings.MODIFIER_ORCA,
        1 << orca.keybindings.MODIFIER_ORCA,
        pHandle))
    orca.settings.keyBindingsMap["default"] = myKeyBindings
#Bind Function to key+

#OCRPath-
def ocr_path(path):
    img = Image.open(path)
    tr = tesseract("/usr/share")
    new_string = tr.ocr_image(img)
    return new_string
#OCRPath+

#Set to Clipboard
def setTextToClipboard(text):
    ClipboardObj = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
    ClipboardObj.set_text(text, -1)

#Display Message-
#Speak or Braille
def outputMessage(Message):
    if (orca.settings.enableSpeech):
        orca.speech.speak(Message)
    if (orca.settings.enableBraille):
        orca.braille.displayMessage(Message)
#Display Message+

#OCR Current Window-
def ocrWindow(script, inputEvent=None):
    os.popen('gnome-screenshot -w -f "/tmp/orca-currwindow.png"').read()
    locale.setlocale(locale.LC_NUMERIC, 'C')
    OCRText = ocr_path("/tmp/orca-currwindow.png")
    setTextToClipboard(OCRText)
    outputMessage(OCRText)
    return True
#OCR Current Window+

# define OcrHandler-
ocrWindowHandler = orca.input_event.InputEventHandler(
    ocrWindow, "OCR Current window") #OCR the current window
# define OcrHandler+


DefineShortcut(ocrWindowHandler,"m"); #Shortcut Orca + m

_______________________________________________
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

--
Powered by Arch Linux! I am registered Linux user number 508465: https://linuxcounter.net/user/508465.html
My blog, Thoughts of a Dragon: http://www.stormdragon.tk/
get my public PGP key: gpg --keyserver wwwkeys.pgp.net --recv-key 43DDC193
How to load Windows on your machine in 2 minutes or less: http://www.youtube.com/watch?v=FVbf9tOGwno
"Mighty Elric, Mightier Sword. Sorcerer and Swordsman, slayer of kin, Lord of a dying race. King of ruin, dragon 
master, Champion of Doom."
Domine - Chronicles of the Black Sword


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