sugar3.graphics.colorbutton module

class sugar3.graphics.colorbutton.ColorToolButton(icon_name='color-preview', **kwargs)

Bases: gi.repository.Gtk.ToolItem

accelerator

Returns the above accelerator string.

color

Gets the above set color string.

create_palette()

The create_palette function is called when the palette needs to be invoked. For example, when the user has right clicked the icon or the user has hovered over the icon for a long time.

The create_palette will only be called once or zero times. The palette returned will be stored and re-used if the user invokes the palette multiple times.

Your create_palette implementation does not need to Gtk.Widget.show the palette, as this will be done by the invoker. However, you still need to show the menu items, etc that you place in the palette.

Returns

sugar3.graphics.palette.Palette, or None to indicate that you do not want a palette shown

The default implementation returns None, to indicate no palette should be shown.

do_draw(cr)

draw(self, cr:cairo.Context) -> bool

do_get_property(pspec)
do_set_property(pspec, value)
get_accelerator()

Returns the above accelerator string.

get_color()

Gets the above set color string.

get_icon_name()

The get_icon_name() method returns the value of the icon_name property that contains the name of a themed icon or None.

get_icon_size()

Gets the size of icons in the colorbutton.

get_palette_invoker()
get_title()

Return the above title string.

get_toolbar_box()
icon_name

The get_icon_name() method returns the value of the icon_name property that contains the name of a themed icon or None.

icon_size

Gets the size of icons in the colorbutton.

palette_invoker
set_accelerator(accelerator)

Sets keyboard shortcut that activates this button.

Parameters
  • accelerator (string) – accelerator to be set. Should be in

  • <modifier>Letter (form) –

  • here (Find about format) –

  • https – //developer.gnome.org/gtk3/stable/gtk3-Keyboard-Accelerators.html#gtk-accelerator-parse

Example

set_accelerator(self, ‘accel’)

set_color(color)

Sets the color of the colorbutton

set_expanded(expanded)
set_icon_name(icon_name)

Sets the icon for the tool button from a named themed icon. If it is none then no icon will be shown.

Parameters
  • icon_name (string) – The name for a themed icon.

  • too. (It can be set as 'None') –

Example

set_icon_name(‘view-radial’)

set_icon_size(icon_size)

Sets the size of icons in the colorbutton.

set_palette_invoker(palette_invoker)
set_title(title)

The set_title() method sets the “title” property to the value of title. The “title” property contains the string that is used to set the colorbutton title.

title

Return the above title string.

property toolbar_box
sugar3.graphics.colorbutton.get_svg_color_string(color)
sugar3.graphics.colorbutton.setup_accelerator(tool_button)