[gnome-panel] libpanel-applet: Add test applet in python



commit 5ad4d9e38a7f5c86a499dfad9c6abef2d3697e7e
Author: Vincent Untz <vuntz gnome org>
Date:   Thu Feb 24 13:48:29 2011 +0100

    libpanel-applet: Add test applet in python
    
    This is an example of how to use libpanel-applet from introspection
    data.

 libpanel-applet/test-dbus-applet.py |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/libpanel-applet/test-dbus-applet.py b/libpanel-applet/test-dbus-applet.py
new file mode 100755
index 0000000..cef3b48
--- /dev/null
+++ b/libpanel-applet/test-dbus-applet.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+from gi.repository import Gtk
+from gi.repository import PanelApplet
+
+def applet_fill(applet):
+    label = Gtk.Label("My applet in Python")
+    applet.add(label)
+    applet.show_all()
+
+def applet_factory(applet, iid, data):
+    if iid != "TestApplet":
+       return False
+
+    applet_fill(applet)
+
+    return True
+
+PanelApplet.Applet.factory_main("TestAppletFactory",
+                                PanelApplet.Applet.__gtype__,
+                                applet_factory, None)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]