def ForwardKeyEvent (self, keyval, is_press, state): pass
@signal (signature="saaiib")
- def UpdatePreedit (self, text, attrs, cursor_pos, show): pass
-
- # below signals are optional. The engine could create and maintain panel by self.
- @signal (signature="v")
- def UpdateProperties (self, properties): pass
+ def UpdatePreedit (self, text, attrs, cursor_pos, visible): pass
@signal (signature="svb")
- def UpdateAuxString (self, text, attrs, show): pass
-
- @signal ()
- def ShowAuxStringChanged (self): pass
-
- @signal ()
- def HideAuxStringChanged (self): pass
+ def UpdateAuxString (self, text, attrs, visible): pass
@signal (signature="vb")
- def UpdateLookupTable (self, lookup_table, show): pass
-
- @signal ()
- def ShowLookupTable (self): pass
+ def UpdateLookupTable (self, lookup_table, visible): pass
- @signal ()
- def HideLookupTable (self): pass
+ @signal (signature="v")
+ def UpdateProperties (self, properties): pass
def SetCursorLocation (self, x, y, w, h): pass
@method (in_signature="svub")
- def UpdatePreedit (self, text, attrs, cursor_pos, show): pass
-
- @method ()
- def ShowPreeditString (self): pass
-
- @method ()
- def HidePreeditString (self): pass
+ def UpdatePreedit (self, text, attrs, cursor_pos, visible): pass
@method (in_signature="svb")
- def UpdateAuxString (self, text, attrs, show): pass
-
- @method ()
- def ShowAuxString (self): pass
-
- @method ()
- def HideAuxString (self): pass
+ def UpdateAuxString (self, text, attrs, visible): pass
@method (in_signature="vb")
- def UpdateLookupTable (self, lookup_table, show): pass
+ def UpdateLookupTable (self, lookup_table, visible): pass
- @method ()
- def ShowCandidateWindow (self): pass
-
- @method ()
- def HideCandidateWindow (self): pass
+ @method (in_signature="v")
+ def UpdateProperties (self, props): pass
@method ()
def ShowLanguageBar (self): pass
self._client_handlers.append (id)
id = client.connect ("update-lookup-table", self._update_lookup_table_cb)
self._client_handlers.append (id)
+ id = client.connect ("update-properties", self._update_properties_cb)
+ self._client_handlers.append (id)
self._panel.reset ()
self._focused_client = client
self._panel.update_lookup_table (lookup_table, show)
- def _show_lookup_table_cb (self, client, lookup_table):
+ def _update_properties_cb (self, client, properties):
assert self._focused_client == client
- self._panel.show_candidate_window ()
-
- def _hide_lookup_table_cb (self, client, lookup_table):
- assert self._focused_client == client
-
- self._panel.hide_candidate_window ()
+ self._panel.update_properties (properties)
def _client_destroy_cb (self, client):
if client == self._focused_client:
assert panel == self._panel
if self._focused_client:
self._focused_client.page_up ()
-
+
def _panel_page_down_cb (self, panel):
assert panel == self._panel
if self._focused_client:
gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
(gobject.TYPE_PYOBJECT, gobject.TYPE_BOOLEAN)),
+ "update-properties" : (
+ gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
+ (gobject.TYPE_PYOBJECT, )),
}
def __init__ (self, name, ibusconn):
def commit_string (self, text):
self._ibusconn.emit_dbus_signal ("CommitString", text)
- def update_preedit (self, text, attrs, cursor_pos, show):
+ def update_preedit (self, text, attrs, cursor_pos, visible):
if self._use_preedit:
- self._ibusconn.emit_dbus_signal ("UpdatePreedit", text, attrs, cursor_pos, show)
+ self._ibusconn.emit_dbus_signal ("UpdatePreedit", text, attrs, cursor_pos, visible)
else:
# show preedit on panel
- self.emit ("update-preedit", text, attrs, cursor_pos, show)
+ self.emit ("update-preedit", text, attrs, cursor_pos, visible)
def set_engine (self, engine):
if self._engine == engine:
def _commit_string_cb (self, engine, text):
self.commit_string (text)
- def _update_preedit_cb (self, engine, text, attrs, cursor_pos, show):
- self.update_preedit (text, attrs, cursor_pos, show)
+ def _update_preedit_cb (self, engine, text, attrs, cursor_pos, visible):
+ self.update_preedit (text, attrs, cursor_pos, visible)
- def _update_aux_string_cb (self, engine, text, attrs, show):
+ def _update_aux_string_cb (self, engine, text, attrs, visible):
self._aux_string = text
self._aux_attrs = attrs
- self.emit ("update-aux-string", text, attrs, show)
+ self.emit ("update-aux-string", text, attrs, visible)
- def _update_lookup_table_cb (self, engine, lookup_table, show):
+ def _update_lookup_table_cb (self, engine, lookup_table, visible):
self._lookup_table = lookup_table
- self.emit ("update-lookup-table", lookup_table, show)
+ self.emit ("update-lookup-table", lookup_table, visible)
+
+ def _update_properties_cb (self, props):
+ self.emit ("update-properties", props)
def _remove_engine_handlers (self):
assert self._engine != None
self._engine_handler_ids.append (id)
id = self._engine.connect ("update-lookup-table", self._update_lookup_table_cb)
self._engine_handler_ids.append (id)
+ # id = self._engine.connect ("register-properties", self._register_properties_cb)
+ # self._engine_handler_ids.append (id)
+ id = self._engine.connect ("update-properties", self._update_properties_cb)
+ self._engine_handler_ids.append (id)
+
gobject.type_register (Client)
gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
(gobject.TYPE_PYOBJECT, gobject.TYPE_BOOLEAN)),
+ "register-properties" : (
+ gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
+ (gobject.TYPE_PYOBJECT, )),
+ "update-properties" : (
+ gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE,
+ (gobject.TYPE_PYOBJECT, )),
}
def __init__ (self, factory, ibusconn, object_path):
args = message.get_args_list ()
self.emit ("update-lookup-table", args[0], args[1])
return True
+ elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "RegisterProperties"):
+ args = message.get_args_list ()
+ self.emit ("register-properties", args[0])
+ return True
+ elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "UpdateProperties"):
+ args = message.get_args_list ()
+ self.emit ("update-properties", args[0])
+ return True
else:
return False
def set_cursor_location (self, x, y, w, h):
self._panel.SetCursorLocation (x, y, w, h)
- def update_preedit (self, text, attrs, cursor_pos, show):
- self._panel.UpdatePreedit (text, attrs, cursor_pos, show)
+ def update_preedit (self, text, attrs, cursor_pos, visible):
+ self._panel.UpdatePreedit (text, attrs, cursor_pos, visible)
- def show_preedit_string (self):
- self._panel.ShowPreeditString ()
+ def update_aux_string (self, text, attrs, visible):
+ self._panel.UpdateAuxString (text, attrs, visible)
- def hide_preedit_string (self):
- slef._panel.HidePreeditString ()
+ def update_lookup_table (self, lookup_table, visible):
+ self._panel.UpdateLookupTable (lookup_table, visible)
- def update_aux_string (self, text, attrs, show):
- self._panel.UpdateAuxString (text, attrs, show)
-
- def show_aux_string (self):
- self._panel.ShowAuxString ()
-
- def hide_aux_string (self):
- slef._panel.HideAuxString ()
-
- def update_lookup_table (self, lookup_table, show):
- self._panel.UpdateLookupTable (lookup_table, show)
-
- def show_candidate_window (self):
- self._panel.ShowCandidateWindow ()
-
- def hide_candidate_window (self):
- self._panel.HideCandidateWindow ()
+ def update_properties (self, props):
+ self._panel.UpdateProperties (props)
def show_language_bar (self):
self._panel.ShowLanguageBar ()
def set_cursor_location (self, x, y, w, h):
pass
- def update_preedit (self, text, attrs, cursor_pos, show):
- pass
-
- def show_preedit_string (self):
- pass
-
- def hide_preedit_string (self):
- pass
-
- def update_aux_string (self, text, attrs, show):
- pass
-
- def show_aux_string (self):
- pass
-
- def hide_aux_string (self):
+ def update_preedit (self, text, attrs, cursor_pos, visible):
pass
- def update_lookup_table (self, lookup_table, show):
+ def update_aux_string (self, text, attrs, visible):
pass
- def show_candidate_window (self):
+ def update_lookup_table (self, lookup_table, visible):
pass
- def hide_candidate_window (self):
+ def update_properties (self, props):
pass
def show_language_bar (self):
from image import Image
from handle import Handle
+ICON_SIZE = gtk.ICON_SIZE_LARGE_TOOLBAR
+
class LanguageBar (gtk.Toolbar):
def __init__ (self):
gtk.Toolbar.__init__ (self)
- self.set_property ("icon-size", gtk.ICON_SIZE_MENU)
+ self.set_property ("icon-size", ICON_SIZE)
icon_theme = gtk.icon_theme_get_default ()
icon_theme.prepend_search_path ("/home/phuang/sources/ibus/icons")
# self.set_orientation (gtk.ORIENTATION_VERTICAL)
self._create_items ()
def _add_items (self):
- img = gtk.image_new_from_icon_name ("engine-default", gtk.ICON_SIZE_MENU)
+ img = gtk.image_new_from_icon_name ("engine-default", ICON_SIZE)
btn = gtk.ToolButton (img, "engine")
btn.connect ("clicked", lambda x: self._add_items ())
self.insert (btn, -1)
- img = gtk.image_new_from_icon_name ("ibus-keyboard", gtk.ICON_SIZE_MENU)
+ img = gtk.image_new_from_icon_name ("ibus-keyboard", ICON_SIZE)
btn = gtk.ToolButton (img, "keyboard")
self.insert (btn, -1)
+
+ img = gtk.image_new_from_icon_name ("ibus-zh", ICON_SIZE)
+ btn = gtk.ToolButton (img, "keyboard")
+ self.insert (btn, -1)
+
self.insert (gtk.SeparatorToolItem (), -1)
self.show_all ()
self.check_resize ()