From 02d8a8d9154b876dbfe056d141792d2f75c2d1bd Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Tue, 20 Aug 2013 21:55:17 +0000 Subject: [PATCH] 6871: workaround gtk RTL bug in MultiTreeView Reapply from gramps40 - blend of Nick's and my fix for the bug. svn: r22888 --- gramps/gui/plug/quick/_quicktable.py | 7 +------ gramps/gui/widgets/multitreeview.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/gramps/gui/plug/quick/_quicktable.py b/gramps/gui/plug/quick/_quicktable.py index e935abe55..be90a237e 100644 --- a/gramps/gui/plug/quick/_quicktable.py +++ b/gramps/gui/plug/quick/_quicktable.py @@ -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) diff --git a/gramps/gui/widgets/multitreeview.py b/gramps/gui/widgets/multitreeview.py index 9190aa597..bdd40b76c 100644 --- a/gramps/gui/widgets/multitreeview.py +++ b/gramps/gui/widgets/multitreeview.py @@ -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: