Add interfaces.
authorHuang Peng <shawn.p.huang@gmail.com>
Sun, 20 Jul 2008 03:21:51 +0000 (11:21 +0800)
committerHuang Peng <shawn.p.huang@gmail.com>
Sun, 20 Jul 2008 03:21:51 +0000 (11:21 +0800)
daemon/bus.py
daemon/engine.py
daemon/panel.py

index 83754f2..e168fc6 100644 (file)
@@ -131,8 +131,18 @@ class IBus(ibus.Object):
             return
         signals = (
             ("update-preedit", self._update_preedit_cb),
+            ("show-preedit", self._show_preedit_cb),
+            ("hide-preedit", self._hide_preedit_cb),
             ("update-aux-string", self._update_aux_string_cb),
+            ("show-aux-string", self._show_aux_string_cb),
+            ("hide-aux-string", self._hide_aux_string_cb),
             ("update-lookup-table", self._update_lookup_table_cb),
+            ("show-lookup-table", self._show_lookup_table_cb),
+            ("hide-lookup-table", self._hide_lookup_table_cb),
+            ("page-up-lookup-table", self._page_up_lookup_table_cb),
+            ("page-down-lookup-table", self._page_down_lookup_table_cb),
+            ("cursor-up-lookup-table", self._cursor_up_lookup_table_cb),
+            ("cursor-down-lookup-table", self._cursor_down_lookup_table_cb),
             ("register-properties", self._register_properties_cb),
             ("update-property", self._update_property_cb),
             ("engine-lost", self._engine_lost_cb),
@@ -150,33 +160,67 @@ class IBus(ibus.Object):
 
     def _update_preedit_cb(self, context, text, attrs, cursor_pos, visible):
         assert self._focused_context == context
+        self._panel.update_preedit(text, attrs, cursor_pos, visible)
 
-        self._panel.update_preedit_string(text, attrs, cursor_pos, visible)
+    def _show_preedit_cb(self):
+        assert self._focused_context == context
+        self._panel.show_preedit()
 
-    def _update_aux_string_cb(self, context, text, attrs, visible):
+    def _hide_preedit_cb(self):
         assert self._focused_context == context
+        self._panel.hide_preedit()
 
+    def _update_aux_string_cb(self, context, text, attrs, visible):
+        assert self._focused_context == context
         self._panel.update_aux_string(text, attrs, visible)
 
-    def _update_lookup_table_cb(self, context, lookup_table, visible):
+    def _show_aux_string_cb(self):
+        assert self._focused_context == context
+        self._panel.show_aux_string()
+
+    def _hide_aux_string_cb(self):
         assert self._focused_context == context
+        self._panel.hide_aux_string()
 
+    def _update_lookup_table_cb(self, context, lookup_table, visible):
+        assert self._focused_context == context
         self._panel.update_lookup_table(lookup_table, visible)
 
-    def _register_properties_cb(self, context, props):
+    def _show_lookup_table_cb(self):
+        assert self._focused_context == context
+        self._panel.show_lookup_table()
+
+    def _hide_lookup_table_cb(self):
         assert self._focused_context == context
+        self._panel.hide_lookup_table()
 
+    def _page_up_lookup_table_cb(self):
+        assert self._focused_context == context
+        self._panel.page_up_lookup_table()
+
+    def _page_down_lookup_table_cb(self):
+        assert self._focused_context == context
+        self._panel.page_down_lookup_table()
+
+    def _cursor_up_lookup_table_cb(self):
+        assert self._focused_context == context
+        self._panel.cursor_up_lookup_table()
+
+    def _cursor_down_lookup_table_cb(self):
+        assert self._focused_context == context
+        self._panel.cursor_down_lookup_table()
+
+    def _register_properties_cb(self, context, props):
+        assert self._focused_context == context
         self._panel.register_properties(props)
 
 
     def _update_property_cb(self, context, prop):
         assert self._focused_context == context
-
         self._panel.update_property(prop)
 
     def _engine_lost_cb(self, context):
         assert self._focused_context == context
-
         self._panel.reset()
 
     def _context_destroy_cb(self, context):
index 2c2ba56..0a17aee 100644 (file)
@@ -37,14 +37,54 @@ class Engine(ibus.Object):
             gobject.SIGNAL_RUN_FIRST,
             gobject.TYPE_NONE,
             (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT, gobject.TYPE_INT, gobject.TYPE_BOOLEAN)),
+        "show-preedit" : (
+            gobject.SIGNAL_RUN_FIRST,
+            gobject.TYPE_NONE,
+            ()),
+        "hide-preedit" : (
+            gobject.SIGNAL_RUN_FIRST,
+            gobject.TYPE_NONE,
+            ()),
         "update-aux-string" : (
             gobject.SIGNAL_RUN_FIRST,
             gobject.TYPE_NONE,
             (gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT, gobject.TYPE_BOOLEAN)),
+        "show-aux-string" : (
+            gobject.SIGNAL_RUN_FIRST,
+            gobject.TYPE_NONE,
+            ()),
+        "hide-aux-string" : (
+            gobject.SIGNAL_RUN_FIRST,
+            gobject.TYPE_NONE,
+            ()),
         "update-lookup-table" : (
             gobject.SIGNAL_RUN_FIRST,
             gobject.TYPE_NONE,
             (gobject.TYPE_PYOBJECT, gobject.TYPE_BOOLEAN)),
+        "show-lookup-table" : (
+            gobject.SIGNAL_RUN_FIRST,
+            gobject.TYPE_NONE,
+            ()),
+        "hide-lookup-table" : (
+            gobject.SIGNAL_RUN_FIRST,
+            gobject.TYPE_NONE,
+            ()),
+        "page-up-lookup-table" : (
+            gobject.SIGNAL_RUN_FIRST,
+            gobject.TYPE_NONE,
+            ()),
+        "page-down-lookup-table" : (
+            gobject.SIGNAL_RUN_FIRST,
+            gobject.TYPE_NONE,
+            ()),
+        "cursor-up-lookup-table" : (
+            gobject.SIGNAL_RUN_FIRST,
+            gobject.TYPE_NONE,
+            ()),
+        "cursor-down-lookup-table" : (
+            gobject.SIGNAL_RUN_FIRST,
+            gobject.TYPE_NONE,
+            ()),
         "register-properties" : (
             gobject.SIGNAL_RUN_FIRST,
             gobject.TYPE_NONE,
@@ -80,12 +120,32 @@ class Engine(ibus.Object):
         elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "UpdatePreedit"):
             args = message.get_args_list()
             self.emit("update-preedit", args[0], args[1], args[2], args[3])
+        elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "ShowPreedit"):
+            self.emit("show-preedit")
+        elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "HidePreedit"):
+            self.emit("hide-preedit")
         elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "UpdateAuxString"):
             args = message.get_args_list()
             self.emit("update-aux-string", args[0], args[1], args[2])
+        elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "ShowAuxString"):
+            self.emit("show-aux-string")
+        elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "HideAuxString"):
+            self.emit("hide-aux-string")
         elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "UpdateLookupTable"):
             args = message.get_args_list()
             self.emit("update-lookup-table", args[0], args[1])
+        elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "ShowLookupTable"):
+            self.emit("show-lookup-table")
+        elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "HideLookupTable"):
+            self.emit("hide-lookup-table")
+        elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "PageUpLookupTable"):
+            self.emit("page-up-lookup-table")
+        elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "PageDownLookupTable"):
+            self.emit("page-down-lookup-table")
+        elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "CursorUpLookupTable"):
+            self.emit("cursor-up-lookup-table")
+        elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "CursorDownLookupTable"):
+            self.emit("cursor-down-lookup-table")
         elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "RegisterProperties"):
             args = message.get_args_list()
             self.emit("register-properties", args[0])
index 3fbd3b8..80d8cbb 100644 (file)
@@ -72,14 +72,44 @@ class Panel(ibus.Object):
         self._panel.UpdatePreedit(text, attrs, cursor_pos, visible,
                 **ibus.DEFAULT_ASYNC_HANDLERS)
 
+    def show_preedit(self):
+        self._panel.ShowPreedit(**ibus.DEFAULT_ASYNC_HANDLERS)
+
+    def hide_preedit(self):
+        self._panel.HidePreedit(**ibus.DEFAULT_ASYNC_HANDLERS)
+
     def update_aux_string(self, text, attrs, visible):
         self._panel.UpdateAuxString(text, attrs, visible,
                 **ibus.DEFAULT_ASYNC_HANDLERS)
 
+    def show_aux_string(self):
+        self._panel.ShowAuxString(**ibus.DEFAULT_ASYNC_HANDLERS)
+
+    def hide_aux_string(self):
+        self._panel.HideAuxString(**ibus.DEFAULT_ASYNC_HANDLERS)
+
     def update_lookup_table(self, lookup_table, visible):
         self._panel.UpdateLookupTable(lookup_table, visible,
                 **ibus.DEFAULT_ASYNC_HANDLERS)
 
+    def show_lookup_table(self):
+        self._panel.ShowLookupTable(**ibus.DEFAULT_ASYNC_HANDLERS)
+
+    def hide_lookup_table(self):
+        self._panel.HideLookupTable(**ibus.DEFAULT_ASYNC_HANDLERS)
+
+    def page_up_lookup_table(self):
+        self._panel.PageUpLookupTable(**ibus.DEFAULT_ASYNC_HANDLERS)
+
+    def page_down_lookup_table(self):
+        self._panel.PageDownLookupTable(**ibus.DEFAULT_ASYNC_HANDLERS)
+
+    def cursor_up_lookup_table(self):
+        self._panel.CursorUpLookupTable(**ibus.DEFAULT_ASYNC_HANDLERS)
+
+    def cursor_down_lookup_table(self):
+        self._panel.CursorDownLookupTable(**ibus.DEFAULT_ASYNC_HANDLERS)
+
     def register_properties(self, props):
         self._panel.RegisterProperties(props,
                 **ibus.DEFAULT_ASYNC_HANDLERS)