sugar-toolkit-gtk3/tests/test-icons.py

46 lines
892 B
Python
Raw Normal View History

2006-09-08 14:22:31 +02:00
#!/usr/bin/python
import pygtk
pygtk.require('2.0')
from sugar.session.UITestSession import UITestSession
session = UITestSession()
session.start()
import sys
import random
import gtk
import hippo
2006-09-08 14:22:31 +02:00
from sugar.graphics import IconColor
from sugar.graphics.CanvasIcon import CanvasIcon
from sugar.graphics.CanvasView import CanvasView
2006-09-08 14:22:31 +02:00
window = gtk.Window()
window.connect("destroy", lambda w: gtk.main_quit())
window.show()
canvas = hippo.Canvas()
2006-09-08 14:22:31 +02:00
canvas.show()
window.add(canvas)
box = hippo.CanvasBox(background_color=0x4f4f4fff)
canvas.set_root(box)
2006-09-08 14:22:31 +02:00
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 < 1:
2006-09-08 14:22:31 +02:00
i = 0
while i < 10:
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 = CanvasIcon(icon_name=icon_names[icon_name_n],
size=75, color=color)
box.append(icon, 0)
2006-09-08 14:22:31 +02:00
i += 1
k += 1
gtk.main()