2006-09-08 14:22:31 +02:00
|
|
|
#!/usr/bin/python
|
2006-09-08 15:26:27 +02:00
|
|
|
import random
|
2006-09-08 14:22:31 +02:00
|
|
|
|
|
|
|
import pygtk
|
|
|
|
pygtk.require('2.0')
|
|
|
|
import gtk
|
|
|
|
|
|
|
|
import goocanvas
|
|
|
|
|
|
|
|
from sugar.canvas import IconColor
|
|
|
|
from sugar.canvas.IconItem import IconItem
|
2006-09-08 22:49:49 +02:00
|
|
|
from sugar.canvas.CanvasView import CanvasView
|
2006-09-08 14:22:31 +02:00
|
|
|
|
|
|
|
window = gtk.Window()
|
|
|
|
window.connect("destroy", lambda w: gtk.main_quit())
|
|
|
|
window.show()
|
|
|
|
|
2006-09-08 22:49:49 +02:00
|
|
|
canvas = CanvasView()
|
2006-09-08 14:22:31 +02:00
|
|
|
canvas.show()
|
|
|
|
window.add(canvas)
|
|
|
|
|
|
|
|
canvas_model = goocanvas.CanvasModelSimple()
|
|
|
|
root = canvas_model.get_root_item()
|
|
|
|
|
|
|
|
item = goocanvas.Rect(x=0, y=0, width=800, height=600,
|
|
|
|
line_width=0.0, fill_color="#4f4f4f")
|
|
|
|
root.add_child(item)
|
|
|
|
|
2006-09-08 15:26:27 +02:00
|
|
|
icon_names = [ 'stock-buddy', 'activity-groupchat', 'activity-web']
|
|
|
|
|
2006-09-08 14:22:31 +02:00
|
|
|
k = 0
|
|
|
|
while k < 11:
|
|
|
|
i = 0
|
2006-09-08 15:26:27 +02:00
|
|
|
while i < 15:
|
2006-09-08 14:22:31 +02:00
|
|
|
color = IconColor.IconColor()
|
2006-09-08 15:26:27 +02:00
|
|
|
icon_name_n = int(random.random() * len(icon_names))
|
|
|
|
icon = IconItem(x=i * 50 + 10, y=k * 50 + 10,
|
|
|
|
size=46, color=color,
|
|
|
|
icon_name=icon_names[icon_name_n])
|
2006-09-08 14:22:31 +02:00
|
|
|
root.add_child(icon)
|
|
|
|
i += 1
|
|
|
|
k += 1
|
|
|
|
|
|
|
|
canvas.set_model(canvas_model)
|
|
|
|
|
|
|
|
gtk.main()
|