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 "IBUS_NOTIFICATIONS_IFACE",
32 "default_reply_handler",
33 "default_error_handler",
34 "DEFAULT_ASYNC_HANDLERS",
35 "CONFIG_GENERAL_SHORTCUT_TRIGGER",
36 "CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE",
37 "CONFIG_GENERAL_SHORTCUT_PREV_ENGINE",
38 "CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT",
39 "CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT",
40 "CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT",
49 display = os.environ["DISPLAY"]
50 if "." not in display:
55 __username = os.getlogin()
59 __username = os.getenv ("LOGNAME")
61 __username = os.getenv ("USER")
63 __username = os.getenv ("LNAME")
65 __username = os.getenv ("USERNAME")
67 IBUS_ADDR = "unix:path=/tmp/ibus-%s/ibus-%s" % (__username, display.replace(":", "-"))
68 # IBUS_ADDR = "tcp:host=localhost,port=7799"
70 IBUS_IFACE = "org.freedesktop.IBus"
71 IBUS_PATH = "/org/freedesktop/IBus"
72 IBUS_NAME = "org.freedesktop.IBus"
74 IBUS_CONFIG_IFACE = "org.freedesktop.ibus.Config"
75 IBUS_ENGINE_FACTORY_IFACE = "org.freedesktop.ibus.EngineFactory"
76 IBUS_ENGINE_IFACE = "org.freedesktop.ibus.Engine"
77 IBUS_PANEL_IFACE = "org.freedesktop.ibus.Panel"
78 IBUS_NOTIFICATIONS_IFACE = "org.freedesktop.ibus.Notifications"
80 def default_reply_handler( *args):
83 def default_error_handler(e):
84 print >> sys.stderr, e
86 DEFAULT_ASYNC_HANDLERS = {
87 "reply_handler" : default_reply_handler,
88 "error_handler" : default_error_handler
91 CONFIG_GENERAL_SHORTCUT_TRIGGER = "/general/keyboard_shortcut_trigger"
92 CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT = [
96 CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE = "/general/keyboard_shortcut_next_engine"
97 CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT = [
98 "Ctrl+Shift+Release+Shift_L",
99 "Ctrl+Shift+Release+Shift_R",
101 CONFIG_GENERAL_SHORTCUT_PREV_ENGINE = "/general/keyboard_shortcut_prev_engine"
102 CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT = []
106 def __init_main_loop():
108 if __mainloop == None:
110 __mainloop = gobject.MainLoop()
121 def main_iteration(may_block=False):
123 return __mainloop.get_context().iteration(may_block)