6871: workaround the gtk RTL bug in MultiTreeView
Best of both worlds brought to you by Nick and Vassilii :-) svn: r22886
This commit is contained in:
parent
22d4c1dd2c
commit
ee8bc7aaad
@ -507,11 +507,7 @@ class SimpleTable(object):
|
|||||||
#treeview.enable_model_drag_dest(DdTargets.all_targets(),
|
#treeview.enable_model_drag_dest(DdTargets.all_targets(),
|
||||||
# gtk.gdk.ACTION_DEFAULT)
|
# gtk.gdk.ACTION_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.TEXT_DIR_RTL:
|
treeview.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_BOTH)
|
||||||
# Don't show vertical grid lines with RTL (bug #6871)
|
|
||||||
treeview.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_HORIZONTAL)
|
|
||||||
else:
|
|
||||||
treeview.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_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)
|
||||||
|
@ -42,6 +42,20 @@ 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.TREE_VIEW_GRID_LINES_NONE : gtk.TREE_VIEW_GRID_LINES_NONE,
|
||||||
|
gtk.TREE_VIEW_GRID_LINES_HORIZONTAL : gtk.TREE_VIEW_GRID_LINES_HORIZONTAL,
|
||||||
|
gtk.TREE_VIEW_GRID_LINES_VERTICAL : gtk.TREE_VIEW_GRID_LINES_NONE,
|
||||||
|
gtk.TREE_VIEW_GRID_LINES_BOTH : gtk.TREE_VIEW_GRID_LINES_HORIZONTAL
|
||||||
|
}
|
||||||
|
def set_grid_lines(self, grid_lines):
|
||||||
|
if self.get_direction() == gtk.TEXT_DIR_RTL:
|
||||||
|
# Work around a gtk RTL bug, see #6871
|
||||||
|
# On post-gramps34 branches should also check for gtk version <(3,8),
|
||||||
|
# but this is always true here on gramps34!
|
||||||
|
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 == gtk.gdk.KEY_PRESS:
|
if event.type == gtk.gdk.KEY_PRESS:
|
||||||
if event.keyval == gtk.keysyms.Delete:
|
if event.keyval == gtk.keysyms.Delete:
|
||||||
|
Loading…
Reference in New Issue
Block a user