3 # vim: sw=4 ts=4 expandtab ai
7 from random import randint
10 class Control(object):
11 def __init__(self, config):
12 win_width = config.get('window_width')
13 win_height = config.get('window_height')
14 self.out_ui = Out_Diag_Presentation(win_width, win_height)
16 def show(self, filelist, fullsize):
17 self.out_ui.get_data(filelist, fullsize)
23 class Abstraction(object):
27 class Gtk_Presentation(object):
31 self.area = gtk.DrawingArea()
32 self.area.set_size_request(250, 200) ###
33 self.area.set_events(gtk.gdk.POINTER_MOTION_MASK |
34 gtk.gdk.POINTER_MOTION_HINT_MASK )
35 self.area.connect('expose-event', self.expose_event)
38 def expose_event(self, widget, event):
41 x, y, width, height = event.area
42 widget.window.draw_drawable(widget.get_style().fg_gc[gtk.STATE_NORMAL],
43 self.pixmap, x, y, x, y, width, height)
46 def build_pixmap(self):
47 #self.pixmap = gtk.gdk.Pixmap(self.window, self.width, self.height)
48 self.pixmap = gtk.gdk.Pixmap(None, 250, 200, 8) ###
49 cm = self.pixmap.get_colormap()
51 self.color['black'] = cm.alloc_color('black')
52 self.color['white'] = cm.alloc_color('white')
53 self.gc = self.pixmap.new_gc()
54 self.gc.set_foreground(self.color['white'])
55 self.pixmap.draw_rectangle(self.gc, True, 0, 0, self.width, self.height)
59 for path, size, bsize in self.filelist:
60 end_angle = (bsize*360*64)/self.fullsize
61 print start_angle, end_angle
62 gc = self.pixmap.new_gc()
63 cm = self.pixmap.get_colormap()
64 col1 = cm.alloc_color(self.rand_color())
65 gc.set_foreground(col1)
66 gc.set_line_attributes(1,gtk.gdk.LINE_SOLID,gtk.gdk.CAP_NOT_LAST,gtk.gdk.JOIN_MITER)
67 self.pixmap.draw_arc(gc, True, 0, 0, self.width, self.height, start_angle, end_angle)
68 start_angle = start_angle + end_angle
69 self.area.queue_draw()
75 return gtk.gdk.Color(r, g, b, 0)
79 gobject.timeout_add(1000, self.draw_diag)
82 def get_data(self, filelist, fullsize):
83 self.filelist = filelist
84 self.fullsize = fullsize
86 #=== Toplevel widget for embedding to search area =========================
87 def get_toplevel(self):