Created
April 13, 2010 19:16
-
-
Save fitoria/364976 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Name: pyconfig-orca | |
| Description: Programa que permite modificar la configuracion de gnome por medio del modulo gconf de python | |
| Version:0.1 | |
| License: GPLv3 | |
| Copyright: Copyright (C) 2009 Distrito Socialista Tecnologico AIT PDVSA Mérida | |
| Author: Ernesto Nadir Crespo Avila | |
| Email: ernesto@libreaccesibilidad.org | |
| """ | |
| import gconf | |
| import pyttsx | |
| class Conf: | |
| def __init__(self): | |
| self.gconfClient = gconf.client_get_default() | |
| self.aplicaciones = ("orca", "gnome-terminal","oowriter","firefox","nautilus","ooimpress","pidgin","oocalc","gedit","gnome-calculator","rhythmbox") | |
| self.comando = "/apps/metacity/keybinding_commands/command_" | |
| self.asignacion_teclado = "/apps/metacity/global_keybindings/run_command_" | |
| self.teclas = {"orca":"<Super>o","gnome-terminal":"<Super>t","oowriter":"<Super>w","firefox":"<Super>n","nautilus":"<Super>h","ooimpress":"<Super>i","pidgin":"<Super>p","oocalc":"<Super>x","gedit":"<Super>e","gnome-calculator":"<Super>c","rhythmbox":"<Super>m"} | |
| def modificar(self): | |
| cont = 1 | |
| for aplicacion in self.aplicaciones: | |
| ruta1 = "%s%s" %(self.comando,cont) | |
| ruta2 = "%s%s" %(self.asignacion_teclado,cont) | |
| self.gconfClient.set_string(ruta1, "%s" %aplicacion) | |
| self.gconfClient.set_string(ruta2, "%s" %self.teclas[aplicacion]) | |
| cont = cont +1 | |
| def listar(self): | |
| cont = 1 | |
| for aplicacion in self.aplicaciones: | |
| ruta1 = "%s%s" %(self.comando,cont) | |
| ruta2 = "%s%s" %(self.asignacion_teclado,cont) | |
| print self.gconfClient.get_string(ruta1),self.gconfClient.get_string(ruta2) | |
| cont = cont +1 | |
| if __name__ == "__main__": | |
| def mensaje(): | |
| print "pyconfig-orca options " | |
| print "option : --help : Print this help" | |
| print "option : --list : List gconf for gnome-orca" | |
| print "option : --change : Change gconf for gnome-orca" | |
| engine = pyttsx.init() | |
| engine.setProperty('voice', "spanish-latin-american") | |
| engine.say("pyconfig-orca options") | |
| engine.say("option: --help : Print this help") | |
| engine.say("option: --list : List gconf for gnome-orca") | |
| engine.say("option : --change : Change gconf for gnome-orca") | |
| engine.setProperty | |
| import sys | |
| config = Conf() | |
| if len(sys.argv) == 1 : | |
| mensaje() | |
| elif len(sys.argv) == 2: | |
| if sys.argv[1] == "--list" : | |
| config.listar() | |
| elif sys.argv[1] == "--change": | |
| config.modificar() | |
| elif sys.argv[1] == "--help" : | |
| mensaje() | |
| else: | |
| mensaje() | |
| else: | |
| mensaje() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment