[meld] filediff, gutterrendererchunk: Support RTL layout and action direction
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff, gutterrendererchunk: Support RTL layout and action direction
- Date: Thu, 1 Jan 2015 00:04:05 +0000 (UTC)
commit 40407301772ef4080791d4218ada7b8a56ed623f
Author: Kai Willadsen <kai willadsen gmail com>
Date: Tue Oct 28 06:11:53 2014 +1000
filediff, gutterrendererchunk: Support RTL layout and action direction
Using this logic, we still handle panes by index and relative index,
but actions that do something relative to pane direction should now
be pointing the right way and be laid out on the correct side.
meld/filediff.py | 6 ++++++
meld/gutterrendererchunk.py | 3 +++
2 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 56843ae..6472dde 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -278,14 +278,20 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
for pane, t in enumerate(self.textview):
# FIXME: set_num_panes will break this good
+ direction = t.get_direction()
+
if pane == 0 or (pane == 1 and self.num_panes == 3):
window = Gtk.TextWindowType.RIGHT
+ if direction == Gtk.TextDirection.RTL:
+ window = Gtk.TextWindowType.LEFT
views = [self.textview[pane], self.textview[pane + 1]]
renderer = GutterRendererChunkAction(pane, pane + 1, views, self, self.linediffer)
gutter = t.get_gutter(window)
gutter.insert(renderer, 10)
if pane in (1, 2):
window = Gtk.TextWindowType.LEFT
+ if direction == Gtk.TextDirection.RTL:
+ window = Gtk.TextWindowType.RIGHT
views = [self.textview[pane], self.textview[pane - 1]]
renderer = GutterRendererChunkAction(pane, pane - 1, views, self, self.linediffer)
gutter = t.get_gutter(window)
diff --git a/meld/gutterrendererchunk.py b/meld/gutterrendererchunk.py
index fe2fd62..cb91b39 100644
--- a/meld/gutterrendererchunk.py
+++ b/meld/gutterrendererchunk.py
@@ -58,6 +58,9 @@ class GutterRendererChunkAction(GtkSource.GutterRendererPixbuf):
self.mode = MODE_REPLACE
self.set_size(LINE_HEIGHT)
direction = 'LTR' if from_pane < to_pane else 'RTL'
+ if self.views[0].get_direction() == Gtk.TextDirection.RTL:
+ direction = 'LTR' if direction == 'RTL' else 'RTL'
+
self.action_map = self.ACTION_MAP[direction]
self.filediff = filediff
self.filediff.connect("action-mode-changed",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]