1 # vim:set et sts=4 sw=4:
5 # Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this program; if not, write to the
19 # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20 # Boston, MA 02111-1307 USA
28 "IBUS_ENGINE_FACTORY_IFACE",
31 "default_reply_handler",
32 "default_error_handler",
33 "DEFAULT_ASYNC_HANDLERS",
34 "CONFIG_GENERAL_SHORTCUT_TRIGGER",
35 "CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE",
36 "CONFIG_GENERAL_SHORTCUT_PREV_ENGINE",
37 "CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT",
38 "CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT",
39 "CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT",
48 display = os.environ["DISPLAY"]
49 if "." not in display:
54 __username = os.getlogin()
58 __username = os.getenv ("LOGNAME")
60 __username = os.getenv ("USER")
62 __username = os.getenv ("LNAME")
64 __username = os.getenv ("USERNAME")
66 IBUS_ADDR = "unix:path=/tmp/ibus-%s/ibus-%s" % (__username, display.replace(":", "-"))
67 # IBUS_ADDR = "tcp:host=localhost,port=7799"
69 IBUS_IFACE = "org.freedesktop.IBus"
70 IBUS_PATH = "/org/freedesktop/IBus"
71 IBUS_NAME = "org.freedesktop.IBus"
73 IBUS_CONFIG_IFACE = "org.freedesktop.ibus.Config"
74 IBUS_ENGINE_FACTORY_IFACE = "org.freedesktop.ibus.EngineFactory"
75 IBUS_ENGINE_IFACE = "org.freedesktop.ibus.Engine"
76 IBUS_PANEL_IFACE = "org.freedesktop.ibus.Panel"
78 def default_reply_handler( *args):
81 def default_error_handler(e):
82 print >> sys.stderr, e
84 DEFAULT_ASYNC_HANDLERS = {
85 "reply_handler" : default_reply_handler,
86 "error_handler" : default_error_handler
89 CONFIG_GENERAL_SHORTCUT_TRIGGER = "/general/keyboard_shortcut_trigger"
90 CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT = [
94 CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE = "/general/keyboard_shortcut_next_engine"
95 CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT = [
96 "Ctrl+Shift+Release+Shift_L",
97 "Ctrl+Shift+Release+Shift_R",
99 CONFIG_GENERAL_SHORTCUT_PREV_ENGINE = "/general/keyboard_shortcut_prev_engine"
100 CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT = []
104 def __init_main_loop():
106 if __mainloop == None:
108 __mainloop = gobject.MainLoop()
119 def main_iteration(may_block=False):
121 return __mainloop.get_context().iteration(may_block)