Skip to content

Instantly share code, notes, and snippets.

@virtuald
Created May 28, 2017 21:44
Show Gist options
  • Save virtuald/1ae5538f3c5757c49c0bf9448fbe77b0 to your computer and use it in GitHub Desktop.
Save virtuald/1ae5538f3c5757c49c0bf9448fbe77b0 to your computer and use it in GitHub Desktop.
GTK3 breeze theme treeview separator bug
#
# This example treeview reproduces the treeview glitching with the gtk-breeze theme
# under GTK 3.22 (Fedora 25)
#
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
window = Gtk.Window.new(Gtk.WindowType.TOPLEVEL)
window.connect('destroy', Gtk.main_quit)
tv = Gtk.TreeView.new()
tv.append_column(Gtk.TreeViewColumn('col1', Gtk.CellRendererText(), text=0))
tv.append_column(Gtk.TreeViewColumn('col2', Gtk.CellRendererText(), text=1))
model = Gtk.TreeStore.new([str, str])
row1 = model.append(None, ['r11', 'r12'])
model.append(row1, ['c1-1', 'c1-2'])
model.append(None, [None, None])
row2 = model.append(None, ['r21', 'r22'])
model.append(row2, ['c2-1', 'c2-2'])
model.append(row2, ['c3-1', 'c3-2'])
tv.set_model(model)
# If you comment this out, the bug goes away
tv.set_row_separator_func((lambda m, i: m.get_value(i, 1) is None))
window.add(tv)
window.show_all()
Gtk.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment