sugar3.graphics.icon module

A small fixed size picture, typically used to decorate components.

STABLE.

class sugar3.graphics.icon.CanvasIcon(**kwargs)

Bases: sugar3.graphics.icon.EventIcon

An EventIcon with active and prelight states, and a styleable background.

If the icon pops up a palette, the prelight state is set until the palette pops down.

connect_to_palette_pop_events(palette)
do_draw(cr)

Render a background that fits the allocated space.

class sugar3.graphics.icon.CellRendererIcon(treeview=None)

Bases: gi.repository.Gtk.CellRenderer

background_color
connect_to_scroller(scrolled)
create_palette()
do_activate(event, widget, path, background_area, cell_area, flags)
do_get_property(pspec)
do_get_size(widget, cell_area, x_offset=None, y_offset=None, width=None, height=None)
do_render(cr, widget, background_area, cell_area, flags)
do_set_property(pspec, value)
do_start_editing(event, widget, path, background_area, cell_area, flags)
file_name
fill_color
get_xo_color()
icon_name
is_scrolling()
prelit_fill_color
prelit_stroke_color
set_background_color(value)
set_file_name(value)
set_fill_color(value)
set_icon_name(value)
set_prelit_fill_color(value)
set_prelit_stroke_color(value)
set_size(value)
set_stroke_color(value)
set_xo_color(value)
size
stroke_color
xo_color
class sugar3.graphics.icon.EventIcon(**kwargs)

Bases: gi.repository.Gtk.EventBox

An Icon class that provides access to mouse events and that can act as a cursor-positioned palette invoker.

alpha
background_color
badge_name
cache
create_palette()
do_draw(cr)
do_get_preferred_height()
do_get_preferred_width()
do_get_property(pspec)
do_set_property(pspec, value)
file_name
fill_color
get_background_color()
get_badge_name()
get_cache()
get_file_name()
get_fill_color()
get_icon_name()
get_palette()
get_palette_invoker()
get_scale()
get_size()
get_stroke_color()
icon_name
palette
palette_invoker
pixel_size
scale
set_alpha(alpha)
set_background_color(value)
set_badge_name(value)
set_cache(value)
set_file_name(value)
set_fill_color(value)
set_icon_name(value)
set_palette(palette)
set_palette_invoker(palette_invoker)
set_scale(value)
set_size(value)
set_stroke_color(value)
set_tooltip(text)
set_xo_color(value)
stroke_color
xo_color
class sugar3.graphics.icon.Icon(**kwargs)

Bases: gi.repository.Gtk.Image

alpha
badge_name
do_draw(cr)
do_get_preferred_height()
do_get_preferred_width()
do_get_property(pspec)
do_set_property(pspec, value)
file
fill_color
get_badge_name()
get_badge_size()
get_file()
get_fill_color()
get_pixbuf()
get_stroke_color()
pixbuf
scale
set_alpha(value)
set_badge_name(value)
set_file(file_name)
set_fill_color(value)
set_pixbuf(pixbuf)
set_scale(value)
set_stroke_color(value)
set_xo_color(value)
stroke_color
xo_color
sugar3.graphics.icon.get_icon_file_name(icon_name)
sugar3.graphics.icon.get_icon_state(base_name, perc, step=5)
sugar3.graphics.icon.get_surface(**kwargs)

Get cached cairo surface.

Keyword arguments: icon_name – name of icon to load, default None file_name – path to image file, default None fill_color – for svg images, change default fill color

default None
stroke_color – for svg images, change default stroke color
default None
background_color – draw background or surface will be transparent
default None
badge_name – name of icon which will be drawn on top of
original image, default None

width – change image width, default None height – change image height, default None cache – if image is svg, keep svg file content for later scale – scale image, default 1.0

Return: cairo surface or None if image was not found