2012-09-06 18:05:55 +02:00
|
|
|
from gi.repository import Gtk
|
|
|
|
|
|
|
|
from sugar3.graphics.icon import EventIcon
|
|
|
|
from sugar3.graphics.icon import Icon
|
2016-06-13 13:38:15 +02:00
|
|
|
from sugar3.graphics import style
|
|
|
|
from sugar3.graphics.xocolor import XoColor
|
|
|
|
from sugar3.graphics.palette import Palette
|
2012-09-06 18:05:55 +02:00
|
|
|
|
|
|
|
import common
|
|
|
|
|
|
|
|
|
|
|
|
test = common.Test()
|
|
|
|
test.show()
|
|
|
|
|
2017-01-11 18:23:08 +01:00
|
|
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
|
|
test.pack_start(box, True, True, 0)
|
|
|
|
box.show()
|
2012-09-06 18:05:55 +02:00
|
|
|
|
2016-06-13 13:38:15 +02:00
|
|
|
# An XO Icon, normal size, setting the color via the XoColor object
|
|
|
|
icon = Icon(icon_name='computer-xo',
|
|
|
|
pixel_size=style.STANDARD_ICON_SIZE,
|
|
|
|
xo_color=XoColor('#00BEFF,#FF7800'))
|
2017-01-11 18:23:08 +01:00
|
|
|
box.pack_start(icon, False, False, 0)
|
2012-09-06 18:05:55 +02:00
|
|
|
icon.show()
|
|
|
|
|
2016-06-13 13:38:15 +02:00
|
|
|
# You can mix constructor keyword argument and setting
|
|
|
|
# properties after creation
|
|
|
|
icon = EventIcon(icon_name='network-wireless-080',
|
|
|
|
pixel_size=style.STANDARD_ICON_SIZE)
|
|
|
|
# Badges are little icons displayed
|
2012-09-06 18:05:55 +02:00
|
|
|
icon.props.badge_name = 'emblem-favorite'
|
2016-06-13 13:38:15 +02:00
|
|
|
# Instead of using the XoColor, you can use any SVG color specifier:
|
|
|
|
icon.props.fill_color = 'rgb(230, 0, 10)'
|
|
|
|
icon.props.stroke_color = '#78E600'
|
|
|
|
# Unlike normal icons, EventIcons support palettes:
|
|
|
|
icon.props.palette = Palette('Hello World')
|
2017-01-11 18:23:08 +01:00
|
|
|
box.pack_start(icon, False, False, 0)
|
2012-09-06 18:05:55 +02:00
|
|
|
icon.show()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
common.main(test)
|