/usr/share/pyshared/ibus/panel.py is in python-ibus 1.4.1-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | # vim:set et sts=4 sw=4:
#
# ibus - The Input Bus
#
# Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2007-2010 Red Hat, Inc.
#
# This library 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 of the License, or (at your option) any later version.
#
# This library 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., 59 Temple Place, Suite 330,
# Boston, MA  02111-1307  USA
__all__ = (
        "PanelBase",
        "PanelItem",
        "PanelButton",
        "PanelToggleButton",
        "PanelMenu",
        "IBUS_SERVICE_PANEL",
        "IBUS_PATH_PANEL"
    )
IBUS_SERVICE_PANEL = "org.freedesktop.IBus.Panel"
IBUS_PATH_PANEL = "/org/freedesktop/IBus/Panel"
from serializable import *
from object import Object
import interface
import dbus
class PanelItem:
    pass
class PanelButton(PanelItem):
    pass
class PanelToggleButton(PanelButton):
    pass
class PanelMenu(PanelItem):
    pass
class PanelBase(Object):
    def __init__(self, bus):
        super(PanelBase, self).__init__()
        self.__bus = bus
        self.__proxy = PanelProxy(self, bus)
    def set_cursor_location(self, x, y, w, h):
        pass
    def update_preedit_text(self, text, cursor_pos, visible):
        pass
    def show_preedit_text(self):
        pass
    def hide_preedit_text(self):
        pass
    def update_auxiliary_text(self, text, visible):
        pass
    def show_auxiliary_text(self):
        pass
    def hide_auxiliary_text(self):
        pass
    def update_lookup_table(self, lookup_table, visible):
        pass
    def show_lookup_table(self):
        pass
    def hide_lookup_table(self):
        pass
    def show_candidate_window(self):
        pass
    def page_up_lookup_table(self):
        pass
    def page_down_lookup_table(self):
        pass
    def cursor_up_lookup_table(self):
        pass
    def cursor_down_lookup_table(self):
        pass
    def hide_candidate_window(self):
        pass
    def show_language_bar(self):
        pass
    def hide_language_bar(self):
        pass
    def register_properties(self, props):
        pass
    def update_property(self, prop):
        pass
    def focus_in(self, ic):
        pass
    def focus_out(self, ic):
        pass
    def state_changed(self):
        pass
    def reset(self):
        pass
    def start_setup(self):
        pass
    def page_up(self):
        self.__proxy.PageUp()
    def page_down(self):
        self.__proxy.PageDown()
    def cursor_up(self):
        self.__proxy.CursorUp()
    def cursor_down(self):
        self.__proxy.CursorDown()
    def candidate_clicked(self, index, button, state):
        self.__proxy.CandidateClicked(index, button, state)
    def property_activate(self, prop_name, prop_state):
        prop_name = dbus.String(prop_name)
        prop_state = dbus.Int32(prop_state)
        self.__proxy.PropertyActivate(prop_name, prop_state)
    def property_show(self, prop_name):
        prop_name = dbus.String(prop_name)
        self.__proxy.PropertyShow(prop_name)
    def property_hide(self, prop_name):
        prop_name = dbus.String(prop_name)
        self.__proxy.PropertyHide(prop_name)
class PanelProxy(interface.IPanel):
    def __init__ (self, panel, bus):
        super(PanelProxy, self).__init__(bus.get_dbusconn(), IBUS_PATH_PANEL)
        self.__bus = bus
        self.__panel = panel
        self.__focus_ic = None
    def SetCursorLocation(self, x, y, w, h):
        self.__panel.set_cursor_location(x, y, w, h)
    def UpdatePreeditText(self, text, cursor_pos, visible):
        text = deserialize_object(text)
        self.__panel.update_preedit_text(text, cursor_pos, visible)
    def ShowPreeditText(self):
        self.__panel.show_preedit_text()
    def HidePreeditText(self):
        self.__panel.hide_preedit_text()
    def UpdateAuxiliaryText(self, text, visible):
        text = deserialize_object(text)
        self.__panel.update_auxiliary_text(text, visible)
    def ShowAuxiliaryText(self):
        self.__panel.show_auxiliary_text()
    def HideAuxiliaryText(self):
        self.__panel.hide_auxiliary_text()
    def UpdateLookupTable(self, lookup_table, visible):
        lookup_table = deserialize_object(lookup_table)
        self.__panel.update_lookup_table(lookup_table, visible)
    def ShowLookupTable(self):
        self.__panel.show_lookup_table()
    def HideLookupTable(self):
        self.__panel.hide_lookup_table()
    def PageUpLookupTable(self):
        self.__panel.page_up_lookup_table()
    def PageDownLookupTable(self):
        self.__panel.page_down_lookup_table()
    def CursorUpLookupTable(self):
        self.__panel.cursor_up_lookup_table()
    def CursorDownLookupTable(self):
        self.__panel.cursor_down_lookup_table()
    def ShowCandidateWindow(self):
        self.__panel.show_candidate_window()
    def HideCandidateWindow(self):
        self.__panel.hide_candidate_window()
    def ShowLanguageBar(self):
        self.__panel.show_language_bar()
    def HideLanguageBar(self):
        self.__panel.hide_language_bar()
    def RegisterProperties(self, props):
        props = deserialize_object(props)
        self.__panel.register_properties(props)
    def UpdateProperty(self, prop):
        prop = deserialize_object(prop)
        self.__panel.update_property(prop)
    def FocusIn(self, ic):
        self.__panel.focus_in(ic)
    def FocusOut(self, ic):
        self.__panel.focus_out(ic)
    def StateChanged(self):
        self.__panel.state_changed()
    def Reset(self):
        self.__panel.reset()
    def StartSetup(self):
        self.__panel.start_setup()
    def Destroy(self):
        self.__panel.destroy()
def test():
    import gtk
    from bus import Bus
    from inputcontext import InputContext
    import factory
    import attribute
    import property
    import text
    import lookuptable
    class TestPanel(PanelBase):
        def __init__(self):
            self.__bus = Bus()
            self.__bus.connect("disconnected", gtk.main_quit)
            super(TestPanel, self).__init__(self.__bus)
            self.__bus.request_name(IBUS_SERVICE_PANEL, 0)
        def focus_in(self, ic):
            print "focus-in:", ic
            context = InputContext(self.__bus, ic)
            info = context.get_factory_info()
            print "factory:", info.name
        def focus_out(self, ic):
            print "focus-out:", ic
        def update_auxiliary_text(self, text, visible):
            print "update-auxiliary-text:", text.text
        def update_lookup_table(self, table, visible):
            print "update-lookup-table", table
    panel = TestPanel()
    gtk.main()
if __name__ == "__main__":
    test()
 |