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
|
# vim:set et sts=4 sw=4:
#
# ibus - The Input Bus
#
# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
#
# 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",
)
import ibus
from ibus import interface
class PanelItem:
pass
class PanelButton(PanelItem):
pass
class PanelToggleButton(PanelButton):
pass
class PanelMenu(PanelItem):
pass
class PanelBase(ibus.Object):
def __init__(self, bus, object_path):
super(PanelBase, self).__init__()
self.__proxy = PanelProxy(self, bus.get_dbusconn(), object_path)
def set_cursor_location(self, x, y, w, h):
pass
def update_preedit(self, text, attrs, cursor_pos, visible):
pass
def show_preedit(self):
pass
def hide_preedit(self):
pass
def update_aux_string(self, text, attrs, visible):
pass
def show_aux_string(self):
pass
def hide_aux_string(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 states_changed(self):
pass
def reset(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 property_activate(self, prop_name, prop_state):
self.__proxy.PropertyActivate(prop_name, prop_state)
def property_show(self, prop_name):
self.__proxy.PropertyShow(prop_name)
def property_hide(self, prop_name):
self.__proxy.PropertyHide(prop_name)
class PanelProxy(interface.IPanel):
def __init__ (self, panel, dbusconn, object_path):
super(PanelProxy, self).__init__(dbusconn, object_path)
self.__dbusconn = dbusconn
self.__panel = panel
def SetCursorLocation(self, x, y, w, h):
self.__panel.set_cursor_location(x, y, w, h)
def UpdatePreedit(self, text, attrs, cursor_pos, show):
attrs = ibus.attr_list_from_dbus_value(attrs)
self.__panel.update_preedit(text, attrs, cursor_pos, show)
def ShowPreedit(self):
self.__panel.show_preedit()
def HidePreedit(self):
self.__panel.hide_preedit()
def UpdateAuxString(self, text, attrs, show):
attrs = ibus.attr_list_from_dbus_value(attrs)
self.__panel.update_aux_string(text, attrs, show)
def ShowAuxString(self):
self.__panel.show_aux_string()
def HideAuxString(self):
self.__panel.hide_aux_string()
def UpdateLookupTable(self, lookup_table, show):
lookup_table = ibus.lookup_table_from_dbus_value(lookup_table)
self.__panel.update_lookup_table(lookup_table, show)
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 = ibus.prop_list_from_dbus_value(props)
self.__panel.register_properties(props)
def UpdateProperty(self, prop):
prop = ibus.property_from_dbus_value(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 StatesChanged(self):
self.__panel.states_changed()
def Reset(self):
self.__panel.reset()
def Destroy(self):
self.__panel.destroy()
|