sugar-toolkit-gtk3/examples/gtktreesensitive.py
Ignacio Rodríguez b6d449681d Example fixes
- 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
2017-01-14 13:02:50 -03:00

49 lines
1.2 KiB
Python

#!/usr/bin/python
from gi.repository import Gtk
import common
test = common.Test()
test.show()
class MyBox(Gtk.Box):
def __init__(self):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
scrolled = Gtk.ScrolledWindow()
scrolled.set_policy(Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC)
store = Gtk.ListStore(str, str)
for i in range(5):
store.append([str(i), 'Item %s' % i])
treeview = Gtk.TreeView(store)
renderer_no_sens = Gtk.CellRendererText()
# set 'sensitive' property
renderer_no_sens.set_property('sensitive', False)
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn('\'sensitive\' False',
renderer_no_sens, text=0)
treeview.append_column(column)
column = Gtk.TreeViewColumn('\'sensitive\' True',
renderer, text=1)
treeview.append_column(column)
scrolled.add(treeview)
self.pack_start(scrolled, True, True, 0)
self.show_all()
box = MyBox()
test.pack_start(box, True, True, 0)
box.show()
if __name__ == '__main__':
common.main(test)