b6d449681d
- replaced Gtk.HBox/Gtk.VBox by GtkBox as seen in [1] and [2]
GtkHbox and GtkVBox are deprecated
- use delete-event instead of destroy event in GtkWindow
- replaced icon_size for pixel_size where used
it's also deprecated as seen in commit [3]
- use sugar_theme in all examples; set it manually not by just
importing common module
- fixed GtkBox.pack_start arguments
- flake/pep8 fixes
[1] https://developer.gnome.org/gtk3/stable/GtkHBox.html
[2] https://developer.gnome.org/gtk3/stable/GtkVBox.html
[3] 5802d67ee1
37 lines
855 B
Python
37 lines
855 B
Python
from gi.repository import Gtk
|
|
|
|
from sugar3.graphics.toolbarbox import ToolbarBox
|
|
from sugar3.graphics.toolbutton import ToolButton
|
|
|
|
import common
|
|
|
|
|
|
test = common.Test()
|
|
|
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
test.pack_start(box, True, True, 0)
|
|
|
|
toolbar_box = ToolbarBox()
|
|
box.pack_start(toolbar_box, False, False, 0)
|
|
|
|
separator = Gtk.SeparatorToolItem()
|
|
toolbar_box.toolbar.insert(separator, -1)
|
|
|
|
|
|
def __clicked_cb(button):
|
|
n = int(button.get_tooltip())
|
|
button.set_tooltip(str(n + 1))
|
|
print "tool button click count %d" % n
|
|
|
|
|
|
tool_button = ToolButton(icon_name='view-radial', tooltip='0')
|
|
tool_button.connect('clicked', __clicked_cb)
|
|
tool_button.set_hide_tooltip_on_click(False)
|
|
tool_button.set_accelerator('<Space>')
|
|
toolbar_box.toolbar.insert(tool_button, -1)
|
|
|
|
test.show_all()
|
|
|
|
if __name__ == '__main__':
|
|
common.main(test)
|