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

Re: [orca-list] Help with orca-customizations.py fileplease



I just realised: I had two functions with the same name. I've fixed that,
I'm just not sure how to assign the output of a bash command to a
variable in python? Any ideas?
I can get it to say hello world though... Kinda pointless I know.
So if anyone knows how I can assign the output of a shell command to the
message variable I would appreciate it.

Thanks very much

Daniel


On Sun, Nov 30, 2008 at 03:47:29PM +1100, Daniel Dalton wrote:
> Hi,
> 
> I'm not a python programmer, but I've written a shell script to get the
> weather for my home town... Anyway its a shell script and I need to run
> it with the command:
> weather.sh
> Anyway, I've tried to link it in to a python script so I can press
> insert W and orca will say the weather, but it's not working... As I
> said I'm not a programmer, but can someone who knows a little python
> please let me know how to fix it? I've attached my
> orca-customizations.py file...
> 
> Thanks in advance,
> 
> Daniel

> # setup custom key bindings.
> #
> import orca.input_event
> import orca.keybindings
> import orca.orca
> import orca.speech
> import orca.braille
> import re
> 
> # define keybindings object
> myKeyBindings = orca.keybindings.KeyBindings()
> 
> # define script for handling dates
> def sayDate(script, inputEvent=None):
>  import time
>  message = time.strftime("%A, %d %B %Y", time.localtime())
>  orca.speech.speak(message)
>  orca.braille.displayMessage(message)
>  return True
> 
> sayDateHandler = orca.input_event.InputEventHandler(sayDate, "presents the date.")
> 
> # assign orca key + d to our date function
> myKeyBindings.add(orca.keybindings.KeyBinding("d", 1 << orca.settings.MODIFIER_ORCA, 1 << orca.settings.MODIFIER_ORCA, sayDateHandler))
> 
> # define script for handling time
> def sayTime(script, inputEvent=None):
>  import time
>  message = time.strftime("%H:%M:%S", time.localtime())
>  orca.speech.speak(message)
>  orca.braille.displayMessage(message)
>  return True
> 
> sayTimeHandler = orca.input_event.InputEventHandler(sayTime, "presents the time.")
> 
> # assign orca key + t to our time script
> myKeyBindings.add(orca.keybindings.KeyBinding("t", 1 << orca.settings.MODIFIER_ORCA, 1 << orca.settings.MODIFIER_ORCA, sayTimeHandler))
> 
> # define script for handling time
> def sayTime(script, inputEvent=None):
>  import os
>  message = os.system("weather.sh")
>  orca.speech.speak(message)
>  orca.braille.displayMessage(message)
>  return True
> 
> sayWeatherHandler = orca.input_event.InputEventHandler(sayWeather, "presents the weather.")
> 
> # assign orca key + t to our time script
> myKeyBindings.add(orca.keybindings.KeyBinding("w", 1 << orca.settings.MODIFIER_ORCA, 1 << orca.settings.MODIFIER_ORCA, sayWeatherHandler))
> 
> 
> # add our new keybindings to orca
> orca.settings.keyBindingsMap["default"] = myKeyBindings
> 

> _______________________________________________
> Orca-list mailing list
> Orca-list gnome org
> http://mail.gnome.org/mailman/listinfo/orca-list
> Visit http://live.gnome.org/Orca for more information on Orca


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