First pass sugar3.graphics.icon docs
This commit is contained in:
+17
-3
@@ -2,6 +2,9 @@ from gi.repository import Gtk
|
||||
|
||||
from sugar3.graphics.icon import EventIcon
|
||||
from sugar3.graphics.icon import Icon
|
||||
from sugar3.graphics import style
|
||||
from sugar3.graphics.xocolor import XoColor
|
||||
from sugar3.graphics.palette import Palette
|
||||
|
||||
import common
|
||||
|
||||
@@ -13,13 +16,24 @@ vbox = Gtk.VBox()
|
||||
test.pack_start(vbox, True, True, 0)
|
||||
vbox.show()
|
||||
|
||||
icon = Icon(icon_name="network-wireless-000")
|
||||
icon.props.badge_name = 'emblem-favorite'
|
||||
# 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'))
|
||||
vbox.pack_start(icon, False, False, 0)
|
||||
icon.show()
|
||||
|
||||
icon = EventIcon(icon_name="network-wireless-000")
|
||||
# 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
|
||||
icon.props.badge_name = 'emblem-favorite'
|
||||
# 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')
|
||||
vbox.pack_start(icon, False, False, 0)
|
||||
icon.show()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user