sugar-toolkit-gtk3/tests/graphics/toolbuttons.py
Manuel Quiñones 305384be3c Fix the drawing of ColorToolButton, RadioToolButton and ToggleToolButton
Draw a black background in the buttons when the palette is up, as
commit 01a06943 did with the ToolButton.  As the comment for that
commit states, we can change the prelight background color in the
theme, but not when the mouse moves over the Palette.

Also add testcase to test the three toolbuttons.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
2012-08-27 14:13:42 -03:00

46 lines
1.1 KiB
Python

from gi.repository import Gtk
from sugar3.graphics.toolbarbox import ToolbarBox
from sugar3.graphics.colorbutton import ColorToolButton
from sugar3.graphics.radiotoolbutton import RadioToolButton
from sugar3.graphics.toggletoolbutton import ToggleToolButton
import common
test = common.Test()
test.show()
vbox = Gtk.VBox()
test.pack_start(vbox, True, True, 0)
vbox.show()
toolbar_box = ToolbarBox()
vbox.pack_start(toolbar_box, False, False, 0)
toolbar_box.show()
radial_button = RadioToolButton(named_icon='view-radial')
toolbar_box.toolbar.insert(radial_button, -1)
radial_button.show()
list_button = RadioToolButton(named_icon='view-list')
list_button.props.group = radial_button
toolbar_box.toolbar.insert(list_button, -1)
list_button.show()
separator = Gtk.SeparatorToolItem()
toolbar_box.toolbar.insert(separator, -1)
separator.show()
color_button = ColorToolButton()
toolbar_box.toolbar.insert(color_button, -1)
color_button.show()
favorite_button = ToggleToolButton('emblem-favorite')
toolbar_box.toolbar.insert(favorite_button, -1)
favorite_button.show()
if __name__ == '__main__':
common.main(test)