summaryrefslogtreecommitdiffstats
path: root/engine/enchant/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'engine/enchant/main.py')
-rw-r--r--engine/enchant/main.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/engine/enchant/main.py b/engine/enchant/main.py
new file mode 100644
index 0000000..8df5c0f
--- /dev/null
+++ b/engine/enchant/main.py
@@ -0,0 +1,31 @@
+import dbus
+import dbus.connection
+import dbus.mainloop.glib
+import ibus
+import factory
+import gtk
+
+class IMApp:
+ def __init__ (self):
+ self._dbusconn = dbus.connection.Connection (ibus.IBUS_ADDR)
+ self._dbusconn.add_signal_receiver (self._disconnected_cb,
+ "Disconnected",
+ dbus_interface = dbus.LOCAL_IFACE)
+ self._engine = factory.DemoEngineFactory (self._dbusconn)
+ self._ibus = self._dbusconn.get_object (ibus.IBUS_NAME, ibus.IBUS_PATH)
+ self._ibus.RegisterFactories ([factory.FACTORY_PATH])
+
+ def run (self):
+ gtk.main ()
+
+ def _disconnected_cb (self):
+ print "disconnected"
+ gtk.main_quit ()
+
+
+def main ():
+ IMApp ().run ()
+
+if __name__ == "__main__":
+ dbus.mainloop.glib.DBusGMainLoop (set_as_default=True)
+ main ()