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:
parent
dcccf38e2e
commit
02d8a8d915
@ -351,12 +351,7 @@ class QuickTable(SimpleTable):
|
|||||||
#treeview.enable_model_drag_dest(DdTargets.all_targets(),
|
#treeview.enable_model_drag_dest(DdTargets.all_targets(),
|
||||||
# Gdk.DragAction.DEFAULT)
|
# Gdk.DragAction.DEFAULT)
|
||||||
treeview.connect('drag_data_get', self.object_drag_data_get)
|
treeview.connect('drag_data_get', self.object_drag_data_get)
|
||||||
if (treeview.get_direction() == Gtk.TextDirection.RTL and
|
treeview.set_grid_lines(Gtk.TreeViewGridLines.BOTH)
|
||||||
(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.connect('row-activated', on_table_doubleclick, self)
|
#treeview.connect('row-activated', on_table_doubleclick, self)
|
||||||
#treeview.connect('cursor-changed', on_table_click, self)
|
#treeview.connect('cursor-changed', on_table_click, self)
|
||||||
treeview.connect('button-press-event', self.button_press_event)
|
treeview.connect('button-press-event', self.button_press_event)
|
||||||
|
@ -45,6 +45,19 @@ class MultiTreeView(Gtk.TreeView):
|
|||||||
self.connect('key_press_event', self.key_press_event)
|
self.connect('key_press_event', self.key_press_event)
|
||||||
self.defer_select = False
|
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):
|
def key_press_event(self, widget, event):
|
||||||
if event.type == Gdk.EventType.KEY_PRESS:
|
if event.type == Gdk.EventType.KEY_PRESS:
|
||||||
if event.keyval == Gdk.KEY_Delete:
|
if event.keyval == Gdk.KEY_Delete:
|
||||||
|
Loading…
Reference in New Issue
Block a user