-
Notifications
You must be signed in to change notification settings - Fork 2
/
logger.py
60 lines (43 loc) · 1.22 KB
/
logger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# vi:si:noet:sw=4:sts=4:ts=8
import gtk
import hildon
ringSize = 200
ring = [None for i in xrange(ringSize)]
def append(str):
ring.pop(0)
ring.append(str)
print str
def dump():
for i in ring:
if i <> None:
print i
def display_ring_buffer():
global text_area
for i in ring:
if i <> None:
text_area.get_buffer().insert_at_cursor(repr(i) + "\n")
def display(win):
global text_area
dialog = gtk.Dialog()
dialog.set_title("Log")
text_area = hildon.TextView()
text_area.set_editable(False)
text_area.set_cursor_visible(False)
pannableArea = hildon.PannableArea()
pannableArea.add(text_area)
pannableArea.set_property("mov-mode", hildon.MOVEMENT_MODE_BOTH)
pannableArea.set_size_request_policy(hildon.SIZE_REQUEST_CHILDREN)
# WTF?
pannableArea.set_size_request(300, 300)
dialog.vbox.pack_start(pannableArea, True, True, 10)
close_btn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | \
gtk.HILDON_SIZE_FINGER_HEIGHT, \
hildon.BUTTON_ARRANGEMENT_VERTICAL)
close_btn.connect("clicked", lambda w,d: d.destroy(), dialog)
close_btn.set_text("Close", "")
dialog.vbox.add(close_btn)
dialog.connect("delete-event", lambda w,d: w.destroy())
display_ring_buffer()
dialog.show_all()
dialog.run()
text_area = None