[meld] filediff: Move some common gutter renderer code into the right classes
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff: Move some common gutter renderer code into the right classes
- Date: Sat, 18 Nov 2017 22:19:18 +0000 (UTC)
commit 486055f8598ab01640e678fe259382b26286fac6
Author: Kai Willadsen <kai willadsen gmail com>
Date: Fri Nov 17 07:19:55 2017 +1000
filediff: Move some common gutter renderer code into the right classes
meld/filediff.py | 6 ------
meld/gutterrendererchunk.py | 7 +++++++
2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 11530d3..b44215e 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -235,9 +235,6 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
window = Gtk.TextWindowType.LEFT
views = [self.textview[pane], self.textview[pane + 1]]
renderer = GutterRendererChunkAction(pane, pane + 1, views, self, self.linediffer)
- renderer.set_alignment_mode(GtkSource.GutterRendererAlignmentMode.FIRST)
- renderer.set_padding(3, 0)
- renderer.set_alignment(0.5, 0.5)
gutter = t.get_gutter(window)
gutter.insert(renderer, 10)
if pane in (1, 2):
@@ -246,9 +243,6 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
window = Gtk.TextWindowType.RIGHT
views = [self.textview[pane], self.textview[pane - 1]]
renderer = GutterRendererChunkAction(pane, pane - 1, views, self, self.linediffer)
- renderer.set_alignment_mode(GtkSource.GutterRendererAlignmentMode.FIRST)
- renderer.set_padding(3, 0)
- renderer.set_alignment(0.5, 0.5)
gutter = t.get_gutter(window)
gutter.insert(renderer, -40)
diff --git a/meld/gutterrendererchunk.py b/meld/gutterrendererchunk.py
index b0cc37c..32eb040 100644
--- a/meld/gutterrendererchunk.py
+++ b/meld/gutterrendererchunk.py
@@ -79,6 +79,11 @@ def renderer_to_gtk_state(state):
class MeldGutterRenderer(object):
+ def set_renderer_defaults(self):
+ self.set_alignment_mode(GtkSource.GutterRendererAlignmentMode.FIRST)
+ self.set_padding(3, 0)
+ self.set_alignment(0.5, 0.5)
+
def on_setting_changed(self, meldsettings, key):
if key == 'style-scheme':
self.fill_colors, self.line_colors = get_common_theme()
@@ -161,6 +166,7 @@ class GutterRendererChunkAction(
def __init__(self, from_pane, to_pane, views, filediff, linediffer):
super(GutterRendererChunkAction, self).__init__()
+ self.set_renderer_defaults()
self.from_pane = from_pane
self.to_pane = to_pane
# FIXME: Views are needed only for editable checking; connect to this
@@ -345,6 +351,7 @@ class GutterRendererChunkLines(
def __init__(self, from_pane, to_pane, linediffer):
super(GutterRendererChunkLines, self).__init__()
+ self.set_renderer_defaults()
self.from_pane = from_pane
self.to_pane = to_pane
# FIXME: Don't pass in the linediffer; pass a generator like elsewhere
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]