6871: workaround gtk RTL bug in MultiTreeView

Reapply from gramps40 - blend of Nick's and my fix for the bug.

svn: r22888
This commit is contained in:
Vassilii Khachaturov 2013-08-20 21:55:17 +00:00
parent dcccf38e2e
commit 02d8a8d915
2 changed files with 14 additions and 6 deletions

View File

@ -351,12 +351,7 @@ class QuickTable(SimpleTable):
#treeview.enable_model_drag_dest(DdTargets.all_targets(),
# Gdk.DragAction.DEFAULT)
treeview.connect('drag_data_get', self.object_drag_data_get)
if (treeview.get_direction() == Gtk.TextDirection.RTL and
(Gtk.get_major_version(), Gtk.get_minor_version()) < (3, 8)):
# Don't show vertical grid lines with RTL (bug #6871)
treeview.set_grid_lines(Gtk.TreeViewGridLines.HORIZONTAL)
else:
treeview.set_grid_lines(Gtk.TreeViewGridLines.BOTH)
treeview.set_grid_lines(Gtk.TreeViewGridLines.BOTH)
#treeview.connect('row-activated', on_table_doubleclick, self)
#treeview.connect('cursor-changed', on_table_click, self)
treeview.connect('button-press-event', self.button_press_event)

View File

@ -45,6 +45,19 @@ class MultiTreeView(Gtk.TreeView):
self.connect('key_press_event', self.key_press_event)
self.defer_select = False
__grid_lines_remove_vertical = {
Gtk.TreeViewGridLines.NONE : Gtk.TreeViewGridLines.NONE,
Gtk.TreeViewGridLines.HORIZONTAL : Gtk.TreeViewGridLines.HORIZONTAL,
Gtk.TreeViewGridLines.VERTICAL : Gtk.TreeViewGridLines.NONE,
Gtk.TreeViewGridLines.BOTH : Gtk.TreeViewGridLines.HORIZONTAL
}
def set_grid_lines(self, grid_lines):
if (self.get_direction() == Gtk.TextDirection.RTL and
(Gtk.get_major_version(), Gtk.get_minor_version()) < (3, 8)):
# Work around a gtk RTL bug, see #6871
grid_lines = MultiTreeView.__grid_lines_remove_vertical[grid_lines]
super(MultiTreeView, self).set_grid_lines(grid_lines)
def key_press_event(self, widget, event):
if event.type == Gdk.EventType.KEY_PRESS:
if event.keyval == Gdk.KEY_Delete: