#!/usr/bin/python # # Caribou - text entry and UI navigation application # # Copyright (C) 2009 Adaptive Technology Resource Centre # * Contributor: Ben Konrath # Copyright (C) 2009 Eitan Isaacson # Copyright (C) 2009 Sun Microsystems, Inc. # * Contributor: Willie Walker # Copyright (C) 2009 Flavio Percoco # * Contributor: Flavio Percoco # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; either version 2.1 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License # for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA from optparse import OptionParser import gettext import sys import pyatspi import os # We can't rely on prefix if we're installed by relocated RPM. Instead, we # use __file__ and for now hope that lib is relative to bin. _dirname = os.path.dirname(__file__) sys.prefix = os.path.normpath(os.path.join(_dirname, '..')) libs = os.path.join(sys.prefix, 'lib', 'python@PYTHON_VERSION@', 'site-packages') # point to the proper site-packages path sys.path.insert(1, libs) # This might be run from the build dir. if os.path.abspath(_dirname) != "@prefix@/bin": srcdir = os.path.normpath(os.path.join(_dirname, '..')) sys.path.insert(1, srcdir) import caribou.common import caribou.ui caribou.data_path = os.path.abspath(os.path.join(_dirname, "@top_srcdir@", "data")) else: import caribou.common import caribou.ui caribou.data_path = os.path.join("@prefix@", "share", "caribou") import caribou.ui.window as window import caribou.ui.keyboard as keyboard import caribou.ui.main as main _ = gettext.gettext if __name__ == "__main__": import signal signal.signal(signal.SIGINT, signal.SIG_DFL) parser = OptionParser(usage="usage: %prog [options]", version="%prog @VERSION@") parser.add_option("-d", "--debug", action="store_true", dest="debug", default=False, help="print debug messages on stdout") (options, args) = parser.parse_args() main.debug = options.debug caribou = main.Caribou() caribou.window.hide() try: pyatspi.Registry.start() except KeyboardInterrupt: caribou.clean_exit() pyatspi.Registry.stop()