1
# vim:set et sts=4 sw=4:
2
# -*- coding: utf-8 -*-
4
# ibus-anthy - The Anthy engine for IBus
6
# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 2, or (at your option)
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31
self.__mainloop = gobject.MainLoop()
32
self.__bus = ibus.Bus()
33
self.__bus.connect("destroy", self.__bus_destroy_cb)
34
self.__engine = factory.EngineFactory(self.__bus)
35
self.__bus.register_factories([factory.FACTORY_PATH])
40
def __bus_destroy_cb(self, bus):
41
self.__mainloop.quit()
47
def print_help(out, v = 0):
48
print >> out, "-h, --help show this message."
49
print >> out, "-d, --daemonize daemonize ibus"
55
longopt = ["help", "daemonize"]
57
opts, args = getopt.getopt(sys.argv[1:], shortopt, longopt)
58
except getopt.GetoptError, err:
59
print_help(sys.stderr, 1)
62
if o in ("-h", "--help"):
63
print_help(sys.stdout)
64
elif o in ("-d", "--daemonize"):
67
print >> sys.stderr, "Unknown argument: %s" % o
68
print_help(sys.stderr, 1)
76
if __name__ == "__main__":