Tried to fix the Hashbang and Scratchbox issue by putting Perl into the Scratchbox...
[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 import sys
9
10 def callback(name):
11     print "called back"
12     counter = int(button.get_label())
13     button.set_label(str(counter+1))
14
15
16
17 if len(sys.argv) > 1:
18     from_file = sys.argv[1]
19 else:
20     from_file = None
21
22
23 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
24 if from_file:
25     bus = dbus.SessionBus()
26 else:
27     bus = dbus.SystemBus()
28 NAME = 'de.cryptobitch.muelli.Pwnitter'
29 IFACE_NAME = 'de.cryptobitch.muelli.Pwnitter'
30 pwnitter = dbus.Interface(bus.get_object(NAME, '/Pwnitter'), IFACE_NAME)
31 pwnitter.connect_to_signal("MessageSent", callback)
32
33 def quit(window, *args):
34     pwnitter.Stop()
35     gtk.main_quit()
36
37 def start(from_file=None):
38     if from_file:
39         pwnitter.StartFromFile(from_file) 
40     else:
41         pwnitter.Start()
42     
43 window = hildon.Window ()
44 window.set_title ("pwnitter")
45 window.connect("destroy", quit)
46
47 button = gtk.Button ("0")
48 window.add (button)
49
50 window.show_all()
51
52 gobject.idle_add(start, from_file)
53
54 gtk.main()