def expose_event_cb(self, layout, event):
style = self.get_style()
gc = style.fg_gc[gtk.STATE_NORMAL]
rect = self.get_allocation()
owidth = rect.width
oheight = rect.height
lwidth, lheight = self._vg_layout.getLayoutSize()
for nid, ninfo in self._vg_graph.getNodes():
nwidth, nheight = ninfo.get('size', zero_zero)
if nwidth == 0:
continue
xpos, ypos = ninfo.get('position', zero_zero)
drawx = ((xpos * owidth) / lwidth)
drawy = (ypos * oheight) / lheight
sizex = owidth * nwidth / lwidth
sizey = oheight * nheight / lheight
colorstr = ninfo.get('color')
if colorstr == None:
colorstr = '#0f0'
color = gtk.gdk.color_parse(colorstr)
#self.modify_fg(gtk.STATE_NORMAL, color)
self.window.draw_rectangle(gc, False, drawx, drawy, sizex, sizey)
#c = self.window.cairo_create()
#c.set_source_rgb(color.red / float(65535), color.green / float(65535), color.blue / float(65535))
#c.rectangle(drawx, drawy, sizex, sizey)# event.area.x, event.area.y, event.area.width, event.area.height)
#c.set_line_width(0.5)
#c.stroke()
评论列表
文章目录