summaryrefslogtreecommitdiffstats
path: root/daemon/engine.py
diff options
context:
space:
mode:
authorHuang Peng <shawn.p.huang@gmail.com>2008-07-15 11:29:49 +0800
committerHuang Peng <shawn.p.huang@gmail.com>2008-07-15 11:29:49 +0800
commitfd7ac7a6d95cb3e26c2ffac653c40c75bc02814d (patch)
tree6991af6e3dfc25c456bb490f5f2af500b0a14088 /daemon/engine.py
parentf92cd418e57c2a75936acdb11eaa9d26b3037c56 (diff)
downloadibus-fd7ac7a6d95cb3e26c2ffac653c40c75bc02814d.tar.gz
ibus-fd7ac7a6d95cb3e26c2ffac653c40c75bc02814d.tar.xz
ibus-fd7ac7a6d95cb3e26c2ffac653c40c75bc02814d.zip
Refine coding style of engine.py
Diffstat (limited to 'daemon/engine.py')
-rw-r--r--daemon/engine.py124
1 files changed, 62 insertions, 62 deletions
diff --git a/daemon/engine.py b/daemon/engine.py
index 28b2481..38a726a 100644
--- a/daemon/engine.py
+++ b/daemon/engine.py
@@ -23,7 +23,7 @@ import weakref
import gobject
import ibus
-class Engine (ibus.Object):
+class Engine(ibus.Object):
__gsignals__ = {
"commit-string" : (
gobject.SIGNAL_RUN_FIRST,
@@ -55,107 +55,107 @@ class Engine (ibus.Object):
(gobject.TYPE_PYOBJECT, )),
}
- def __init__ (self, factory, ibusconn, object_path):
- ibus.Object.__init__ (self)
+ def __init__(self, factory, ibusconn, object_path):
+ super(Engine, self).__init__()
self._factory = factory
self._ibusconn = ibusconn
self._object_path = object_path
- self._engine = ibusconn.get_object (self._object_path)
- self._lookup_table = ibus.LookupTable ()
- self._ibusconn.connect ("destroy", self._ibusconn_destroy_cb)
+ self._engine = ibusconn.get_object(self._object_path)
+ self._lookup_table = ibus.LookupTable()
+ self._ibusconn.connect("destroy", self._ibusconn_destroy_cb)
- def get_factory (self):
+ def get_factory(self):
return self._factory
- def get_object_path (self):
+ def get_object_path(self):
return self._object_path
- def handle_dbus_signal (self, message):
- if message.is_signal (ibus.IBUS_ENGINE_IFACE, "CommitString"):
- args = message.get_args_list ()
- self.emit ("commit-string", args[0])
- elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "ForwardKeyEvent"):
- args = message.get_args_list ()
- self.emit ("forward-key-event", args[0], bool (arg[1]), arg[2])
- 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, "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, "UpdateLookupTable"):
- args = message.get_args_list ()
- self.emit ("update-lookup-table", args[0], args[1])
- elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "RegisterProperties"):
- args = message.get_args_list ()
- self.emit ("register-properties", args[0])
- elif message.is_signal (ibus.IBUS_ENGINE_IFACE, "UpdateProperty"):
- args = message.get_args_list ()
- self.emit ("update-property", args[0])
+ def handle_dbus_signal(self, message):
+ if message.is_signal(ibus.IBUS_ENGINE_IFACE, "CommitString"):
+ args = message.get_args_list()
+ self.emit("commit-string", args[0])
+ elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "ForwardKeyEvent"):
+ args = message.get_args_list()
+ self.emit("forward-key-event", args[0], bool(arg[1]), arg[2])
+ 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, "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, "UpdateLookupTable"):
+ args = message.get_args_list()
+ self.emit("update-lookup-table", args[0], args[1])
+ elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "RegisterProperties"):
+ args = message.get_args_list()
+ self.emit("register-properties", args[0])
+ elif message.is_signal(ibus.IBUS_ENGINE_IFACE, "UpdateProperty"):
+ args = message.get_args_list()
+ self.emit("update-property", args[0])
else:
return False
return True
- def focus_in (self):
- self._engine.FocusIn (**ibus.DEFAULT_ASYNC_HANDLERS)
+ def focus_in(self):
+ self._engine.FocusIn(**ibus.DEFAULT_ASYNC_HANDLERS)
- def focus_out (self):
- self._engine.FocusOut (**ibus.DEFAULT_ASYNC_HANDLERS)
+ def focus_out(self):
+ self._engine.FocusOut(**ibus.DEFAULT_ASYNC_HANDLERS)
- def reset (self):
- self._engine.Reset (**ibus.DEFAULT_ASYNC_HANDLERS)
+ def reset(self):
+ self._engine.Reset(**ibus.DEFAULT_ASYNC_HANDLERS)
- def process_key_event (self, keyval, is_press, state, reply_cb, error_cb):
- self._engine.ProcessKeyEvent (keyval, is_press, state,
+ def process_key_event(self, keyval, is_press, state, reply_cb, error_cb):
+ self._engine.ProcessKeyEvent(keyval, is_press, state,
reply_handler = reply_cb,
error_handler = error_cb)
- def set_cursor_location (self, x, y, w, h):
- self._engine.SetCursorLocation (x, y, w, h,
+ def set_cursor_location(self, x, y, w, h):
+ self._engine.SetCursorLocation(x, y, w, h,
**ibus.DEFAULT_ASYNC_HANDLERS)
- def set_enable (self, enable):
- self._engine.SetEnable (enable,
+ def set_enable(self, enable):
+ self._engine.SetEnable(enable,
**ibus.DEFAULT_ASYNC_HANDLERS)
# cursor for lookup table
- def page_up (self):
- self._engine.PageUp (**ibus.DEFAULT_ASYNC_HANDLERS)
+ def page_up(self):
+ self._engine.PageUp(**ibus.DEFAULT_ASYNC_HANDLERS)
- def page_down (self):
- self._engine.PageDown (**ibus.DEFAULT_ASYNC_HANDLERS)
+ def page_down(self):
+ self._engine.PageDown(**ibus.DEFAULT_ASYNC_HANDLERS)
- def cursor_up (self):
- self._engine.CursorUp (**ibus.DEFAULT_ASYNC_HANDLERS)
+ def cursor_up(self):
+ self._engine.CursorUp(**ibus.DEFAULT_ASYNC_HANDLERS)
- def cursor_down (self):
- self._engine.CursorDown (**ibus.DEFAULT_ASYNC_HANDLERS)
+ def cursor_down(self):
+ self._engine.CursorDown(**ibus.DEFAULT_ASYNC_HANDLERS)
- def property_activate (self, prop_name, prop_state):
- self._engine.PropertyActivate (prop_name, prop_state,
+ def property_activate(self, prop_name, prop_state):
+ self._engine.PropertyActivate(prop_name, prop_state,
**ibus.DEFAULT_ASYNC_HANDLERS)
- def property_show (self, prop_name):
- self._engine.PropertyShow (prop_name,
+ def property_show(self, prop_name):
+ self._engine.PropertyShow(prop_name,
**ibus.DEFAULT_ASYNC_HANDLERS)
- def property_hide (self, prop_name):
- self._engine.PropertyHide (prop_name,
+ def property_hide(self, prop_name):
+ self._engine.PropertyHide(prop_name,
**ibus.DEFAULT_ASYNC_HANDLERS)
- def destroy (self):
- ibus.Object.destroy (self)
+ def destroy(self):
+ ibus.Object.destroy(self)
if self._engine:
- self._engine.Destroy (**ibus.DEFAULT_ASYNC_HANDLERS)
+ self._engine.Destroy(**ibus.DEFAULT_ASYNC_HANDLERS)
self._engine = None
self._ibusconn = None
- def _ibusconn_destroy_cb (self, ibusconn):
+ def _ibusconn_destroy_cb(self, ibusconn):
self._engine = None
- self.destroy ()
+ self.destroy()
-gobject.type_register (Engine)
+gobject.type_register(Engine)