[meld: 131/180] sourceview: Make MeldSourceView responsible for its own colours
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld: 131/180] sourceview: Make MeldSourceView responsible for its own colours
- Date: Thu, 23 Jul 2015 21:42:23 +0000 (UTC)
commit 8a18a955a0388a7153a50b0d6ca3ebe0bfe68bd7
Author: Kai Willadsen <kai willadsen gmail com>
Date: Mon Oct 6 14:48:06 2014 +1000
sourceview: Make MeldSourceView responsible for its own colours
meld/filediff.py | 4 +---
meld/sourceview.py | 29 ++++++++++++++++++-----------
2 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index af0705e..75ddbad 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1854,13 +1854,11 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
return self.cursor.line if self.props.highlight_current_line else None
for (w, i) in zip(self.textview, range(self.num_panes)):
- w.fill_colors = self.fill_colors
- w.line_colors = self.line_colors
w.pane = i
w.chunk_iter = chunk_iter(i)
w.current_chunk_check = current_chunk_check(i)
w.get_line_highlight = get_line_highlight
- # w.setup(scroll, coords_iter(i), [self.fill_colors, self.line_colors])
+ # w.setup(scroll, coords_iter(i))
def coords_iter(i):
buf_index = 2 if i == 1 and self.num_panes == 3 else i
diff --git a/meld/sourceview.py b/meld/sourceview.py
index 3c05968..e3eaf2a 100644
--- a/meld/sourceview.py
+++ b/meld/sourceview.py
@@ -103,18 +103,25 @@ class MeldSourceView(GtkSource.View):
def do_style_updated(self, *args):
GtkSource.View.do_style_updated(self)
- def lookup_style_colour(name, default):
- found, colour = style.lookup_color(name)
- if not found:
- colour = Gdk.RGBA()
- colour.parse(default)
- return colour
-
style = self.get_style_context()
- self.highlight_color = lookup_style_colour(
- "current-line-highlight", default="#ffff00")
- self.syncpoint_color = lookup_style_colour(
- "syncpoint-outline", default="#555555")
+ get_style_colour = lambda name: style.lookup_color(name)[1]
+
+ self.highlight_color = get_style_colour("current-line-highlight")
+ self.syncpoint_color = get_style_colour("syncpoint-outline")
+ self.fill_colors = {
+ "insert": get_style_colour("insert-bg"),
+ "delete": get_style_colour("insert-bg"),
+ "conflict": get_style_colour("conflict-bg"),
+ "replace": get_style_colour("replace-bg"),
+ "current-chunk-highlight": get_style_colour(
+ "current-chunk-highlight"),
+ }
+ self.line_colors = {
+ "insert": get_style_colour("insert-outline"),
+ "delete": get_style_colour("insert-outline"),
+ "conflict": get_style_colour("conflict-outline"),
+ "replace": get_style_colour("replace-outline"),
+ }
def do_draw(self, context):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]