diff options
| author | Huang Peng <shawn.p.huang@gmail.com> | 2008-05-30 17:55:14 +0800 |
|---|---|---|
| committer | Huang Peng <shawn.p.huang@gmail.com> | 2008-05-30 17:55:14 +0800 |
| commit | e911456cf2c1f4e17c5ccf909e4fb80e4fccb780 (patch) | |
| tree | 471531291e83f4118074ee6d2374b374070638e0 /ibusdaemon | |
| parent | aaff3dcec05b80a53e274c05fae04632e93cbde8 (diff) | |
| download | ibus-e911456cf2c1f4e17c5ccf909e4fb80e4fccb780.tar.gz ibus-e911456cf2c1f4e17c5ccf909e4fb80e4fccb780.tar.xz ibus-e911456cf2c1f4e17c5ccf909e4fb80e4fccb780.zip | |
Modifid IPanel and IEngine interfaces.
Diffstat (limited to 'ibusdaemon')
| -rw-r--r-- | ibusdaemon/bus.py | 23 | ||||
| -rw-r--r-- | ibusdaemon/client.py | 52 | ||||
| -rw-r--r-- | ibusdaemon/engine.py | 34 | ||||
| -rw-r--r-- | ibusdaemon/panel.py | 15 |
4 files changed, 46 insertions, 78 deletions
diff --git a/ibusdaemon/bus.py b/ibusdaemon/bus.py index 3a099fb..be20f58 100644 --- a/ibusdaemon/bus.py +++ b/ibusdaemon/bus.py @@ -60,17 +60,14 @@ class IBus (ibus.Object): self._focused_client.focus_out () # Install all callback functions - id = client.connect ("preedit-changed", self._preedit_changed_cb) + id = client.connect ("update-preedit", self._update_preedit_cb) self._client_handlers.append (id) - id = client.connect ("aux-string-changed", self._aux_string_changed_cb) + id = client.connect ("update-aux-string", self._update_aux_string_cb) self._client_handlers.append (id) id = client.connect ("update-lookup-table", self._update_lookup_table_cb) self._client_handlers.append (id) - id = client.connect ("show-lookup-table", self._show_lookup_table_cb) - self._client_handlers.append (id) - id = client.connect ("hide-lookup-table", self._hide_lookup_table_cb) - self._client_handlers.append (id) + self._panel.reset () self._focused_client = client self._last_focused_client = client client.focus_in () @@ -83,9 +80,11 @@ class IBus (ibus.Object): del self._client_handlers[:] self._focused_client = None client.focus_out () + self._panel.reset () def reset (self, dbusconn): client = self._lookup_client (dbusconn) + self._panel.reset () client.reset () def is_enabled (self, dbusconn): @@ -127,20 +126,20 @@ class IBus (ibus.Object): raise ibus.IBusException ("not register the client") return self._clients[dbusconn] - def _preedit_changed_cb (self, client, text, attrs, cursor_pos): + def _update_preedit_cb (self, client, text, attrs, cursor_pos, show): assert self._focused_client == client - self._panel.set_preedit_string (text, attrs, cursor_pos) + self._panel.update_preedit_string (text, attrs, cursor_pos, show) - def _aux_string_changed_cb (self, client, text, attrs): + def _update_aux_string_cb (self, client, text, attrs, show): assert self._focused_client == client - self._panel.set_aux_string (text, attrs) + self._panel.update_aux_string (text, attrs, show) - def _update_lookup_table_cb (self, client, lookup_table): + def _update_lookup_table_cb (self, client, lookup_table, show): assert self._focused_client == client - self._panel.update_lookup_table (lookup_table) + self._panel.update_lookup_table (lookup_table, show) def _show_lookup_table_cb (self, client, lookup_table): assert self._focused_client == client diff --git a/ibusdaemon/client.py b/ibusdaemon/client.py index 37371fa..80c86f6 100644 --- a/ibusdaemon/client.py +++ b/ibusdaemon/client.py @@ -3,26 +3,18 @@ import ibus class Client (ibus.Object): __gsignals__ = { - "preedit-changed" : ( + "update-preedit" : ( gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gobject.TYPE_INT)), - "aux-string-changed" : ( + (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gobject.TYPE_INT, gobject.TYPE_BOOLEAN)), + "update-aux-string" : ( gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)), + (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gobject.TYPE_BOOLEAN)), "update-lookup-table" : ( gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT, )), - "show-lookup-table" : ( - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - ()), - "hide-lookup-table" : ( - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - ()) + (gobject.TYPE_PYOBJECT, gobject.TYPE_BOOLEAN)), } def __init__ (self, name, ibusconn): @@ -113,12 +105,12 @@ class Client (ibus.Object): def commit_string (self, text): self._ibusconn.emit_dbus_signal ("CommitString", text) - def preedit_changed (self, text, attrs, cursor_pos): + def update_preedit (self, text, attrs, cursor_pos, show): if self._use_preedit: - self._ibusconn.emit_dbus_signal ("PreeditChanged", text, attrs, cursor_pos) + self._ibusconn.emit_dbus_signal ("UpdatePreedit", text, attrs, cursor_pos, show) else: # show preedit on panel - self.emit ("preedit-changed", text, attrs, cursor_pos) + self.emit ("update-preedit", text, attrs, cursor_pos, show) def set_engine (self, engine): if self._engine == engine: @@ -149,25 +141,17 @@ class Client (ibus.Object): def _commit_string_cb (self, engine, text): self.commit_string (text) - def _preedit_changed_cb (self, engine, text, attrs, cursor_pos): - self.preedit_changed (text, attrs, cursor_pos) + def _update_preedit_cb (self, engine, text, attrs, cursor_pos, show): + self.update_preedit (text, attrs, cursor_pos, show) - def _aux_string_changed_cb (self, engine, text, attrs): + def _update_aux_string_cb (self, engine, text, attrs, show): self._aux_string = text self._aux_attrs = attrs - self.emit ("aux-string-changed", text, attrs) + self.emit ("update-aux-string", text, attrs, show) - def _update_lookup_table_cb (self, engine, lookup_table): + def _update_lookup_table_cb (self, engine, lookup_table, show): self._lookup_table = lookup_table - self.emit ("update-lookup-table", lookup_table) - - def _show_lookup_table_cb (self, engine): - self._show_lookup_table = True - self.emit ("show-lookup-table") - - def _hide_lookup_table_cb (self, engine): - self._show_lookup_table = False - self.emit ("hide-lookup-table") + self.emit ("update-lookup-table", lookup_table, show) def _remove_engine_handlers (self): assert self._engine != None @@ -180,14 +164,10 @@ class Client (ibus.Object): self._engine_handler_ids.append (id) id = self._engine.connect ("commit-string", self._commit_string_cb) self._engine_handler_ids.append (id) - id = self._engine.connect ("preedit-changed", self._preedit_changed_cb) + id = self._engine.connect ("update-preedit", self._update_preedit_cb) self._engine_handler_ids.append (id) - id = self._engine.connect ("aux-string-changed", self._aux_string_changed_cb) + id = self._engine.connect ("update-aux-string", self._update_aux_string_cb) 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 ("show-lookup-table", self._show_lookup_table_cb) - self._engine_handler_ids.append (id) - id = self._engine.connect ("hide-lookup-table", self._hide_lookup_table_cb) - self._engine_handler_ids.append (id) gobject.type_register (Client) diff --git a/ibusdaemon/engine.py b/ibusdaemon/engine.py index ad0d461..8ea060e 100644 --- a/ibusdaemon/engine.py +++ b/ibusdaemon/engine.py @@ -12,26 +12,18 @@ class Engine (ibus.Object): gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_UINT, gobject.TYPE_BOOLEAN, gobject.TYPE_UINT )), - "preedit-changed" : ( + "update-preedit" : ( gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gobject.TYPE_INT)), - "aux-string-changed" : ( + (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gobject.TYPE_INT, gobject.TYPE_BOOLEAN)), + "update-aux-string" : ( gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)), + (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gobject.TYPE_BOOLEAN)), "update-lookup-table" : ( gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT, )), - "show-lookup-table" : ( - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - ()), - "hide-lookup-table" : ( - gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - ()) + (gobject.TYPE_PYOBJECT, gobject.TYPE_BOOLEAN)), } def __init__ (self, factory, ibusconn, object_path): @@ -55,23 +47,17 @@ class Engine (ibus.Object): args = message.get_args_list () self.emit ("forward-key-event", args[0], bool (arg[1]), arg[2]) return True - elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "PreeditChanged"): + elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "UpdatePreedit"): args = message.get_args_list () - self.emit ("preedit-changed", args[0], args[1], args[2]) + self.emit ("update-preedit", args[0], args[1], args[2], args[3]) return True - elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "AuxStringChanged"): + elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "UpdateAuxString"): args = message.get_args_list () - self.emit ("aux-string-changed", args[0], args[1]) + self.emit ("update-aux-string", args[0], args[1], args[2]) return True elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "UpdateLookupTable"): args = message.get_args_list () - self.emit ("update-lookup-table", args[0]) - return True - elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "ShowLookupTable"): - self.emit ("show-lookup-table") - return True - elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "HideLookupTable"): - self.emit ("hide-lookup-table") + self.emit ("update-lookup-table", args[0], args[1]) return True else: return False diff --git a/ibusdaemon/panel.py b/ibusdaemon/panel.py index 18a3fe1..dfca789 100644 --- a/ibusdaemon/panel.py +++ b/ibusdaemon/panel.py @@ -34,8 +34,8 @@ class Panel (ibus.Object): def set_cursor_location (self, x, y, w, h): self._panel.SetCursorLocation (x, y, w, h) - def set_preedit_string (self, text, attrs, cursor_pos): - self._panel.SetPreeditString (text, attrs, cursor_pos) + def update_preedit (self, text, attrs, cursor_pos, show): + self._panel.UpdatePreedit (text, attrs, cursor_pos, show) def show_preedit_string (self): self._panel.ShowPreeditString () @@ -43,8 +43,8 @@ class Panel (ibus.Object): def hide_preedit_string (self): slef._panel.HidePreeditString () - def set_aux_string (self, text, attrs): - self._panel.SetAuxString (text, attrs) + def update_aux_string (self, text, attrs, show): + self._panel.UpdateAuxString (text, attrs, show) def show_aux_string (self): self._panel.ShowAuxString () @@ -52,8 +52,8 @@ class Panel (ibus.Object): def hide_aux_string (self): slef._panel.HideAuxString () - def update_lookup_table (self, lookup_table): - self._panel.UpdateLookupTable (lookup_table) + def update_lookup_table (self, lookup_table, show): + self._panel.UpdateLookupTable (lookup_table, show) def show_candidate_window (self): self._panel.ShowCandidateWindow () @@ -67,6 +67,9 @@ class Panel (ibus.Object): def hide_language_bar (self): self._panel.HideLanguageBar () + def reset (self): + self._panel.Reste () + def destroy (self): if self._ibusconn != None: self._panel.Destroy () |
