6871: workaround gtk RTL bug in MultiTreeView

optimizing cleanup

svn: r22890
This commit is contained in:
Vassilii Khachaturov 2013-08-21 07:32:23 +00:00
parent 9ba12c2e33
commit 4d2ae8df74

View File

@ -45,18 +45,18 @@ 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 = { if (Gtk.get_major_version(), Gtk.get_minor_version()) < (3, 8):
Gtk.TreeViewGridLines.NONE : Gtk.TreeViewGridLines.NONE, __grid_lines_remove_vertical = {
Gtk.TreeViewGridLines.HORIZONTAL : Gtk.TreeViewGridLines.HORIZONTAL, Gtk.TreeViewGridLines.NONE : Gtk.TreeViewGridLines.NONE,
Gtk.TreeViewGridLines.VERTICAL : Gtk.TreeViewGridLines.NONE, Gtk.TreeViewGridLines.HORIZONTAL : Gtk.TreeViewGridLines.HORIZONTAL,
Gtk.TreeViewGridLines.BOTH : 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 def set_grid_lines(self, grid_lines):
(Gtk.get_major_version(), Gtk.get_minor_version()) < (3, 8)): if self.get_direction() == Gtk.TextDirection.RTL:
# Work around a gtk RTL bug, see #6871 # Work around a gtk RTL bug, see #6871
grid_lines = MultiTreeView.__grid_lines_remove_vertical[grid_lines] grid_lines = MultiTreeView.__grid_lines_remove_vertical[grid_lines]
super(MultiTreeView, self).set_grid_lines(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: