Introduced logging to pwn() by replacing all prints
[pwnitter] / pwnitter-gtk
1 #!/usr/bin/env python
2
3 import dbus
4 import dbus.mainloop.glib
5 import gobject
6 import gtk
7 import hildon
8
9
10 def callback(name):
11     print "called back"
12     counter = int(button.get_label())
13     button.set_label(str(counter+1))
14
15 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
16 bus = dbus.SystemBus()
17 NAME = 'de.cryptobitch.muelli.Pwnitter'
18 IFACE_NAME = 'de.cryptobitch.muelli.Pwnitter'
19 pwnitter = dbus.Interface(bus.get_object(NAME, '/Pwnitter'), IFACE_NAME)
20 pwnitter.connect_to_signal("MessageSent", callback)
21
22 def quit(window, *args):
23     pwnitter.Stop()
24     gtk.main_quit()
25
26 def start():
27     pwnitter.Start()
28     
29 window = hildon.Window ()
30 window.set_title ("pwnitter")
31 window.connect("destroy", quit)
32
33 button = gtk.Button ("0")
34 window.add (button)
35
36 window.show_all()
37
38 gobject.idle_add(start)
39
40 gtk.main()