[meld] Remove all background colour use in TreeViews, and adjust text colours



commit 2ccabcb5d34619c4de00d9276b653aad898ace6f
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Jan 7 08:49:06 2012 +1000

    Remove all background colour use in TreeViews, and adjust text colours
    
    There were only two uses of background colour in our TreeViews, and
    neither were particularly necessary. This commit removes all setting
    of background colours in TreeViews, sets conflict rows to be red, and
    adjusts error rows to a Gnome-ish warning-orange. In addition, error
    rows now get a warning icon to try and make them stand out more.

 data/gtkrc      |    4 ++--
 meld/dirdiff.py |    1 -
 meld/tree.py    |   45 +++++++++++++++++++++------------------------
 meld/vcview.py  |    3 +--
 4 files changed, 24 insertions(+), 29 deletions(-)
---
diff --git a/data/gtkrc b/data/gtkrc
index 4c8ccce..452c6d6 100644
--- a/data/gtkrc
+++ b/data/gtkrc
@@ -15,11 +15,11 @@ style "meld-color-scheme"
 
     color["conflict-bg"] = "Pink"
     color["conflict-outline"] = shade(0.8, @conflict-bg)
-    color["conflict-text"] = "#ffffff"
+    color["conflict-text"] = "#ff0000"
 
     color["error-bg"] = "#fce94f"
     color["error-outline"] = shade(0.8, @error-bg)
-    color["error-text"] = "#ff0000"
+    color["error-text"] = "#faad3d"
 
     color["inline-bg"] = "LightSteelBlue2"
     color["inline-fg"] = "Red"
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 60f2f63..ce5d376 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -290,7 +290,6 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
             col_index = self.model.column_index
             column.set_attributes(rentext, text=col_index(tree.COL_TEXT,i),
                                   foreground_gdk=col_index(tree.COL_FG, i),
-                                  background_gdk=col_index(tree.COL_BG, i),
                                   style=col_index(tree.COL_STYLE, i),
                                   weight=col_index(tree.COL_WEIGHT, i),
                                   strikethrough=col_index(tree.COL_STRIKE, i))
diff --git a/meld/tree.py b/meld/tree.py
index 47419c4..e7621dc 100644
--- a/meld/tree.py
+++ b/meld/tree.py
@@ -19,11 +19,11 @@ import gobject
 import gtk
 import pango
 
-COL_PATH, COL_STATE, COL_TEXT, COL_ICON, COL_TINT, COL_FG, COL_BG, COL_STYLE, \
-    COL_WEIGHT, COL_STRIKE, COL_END = range(11)
+COL_PATH, COL_STATE, COL_TEXT, COL_ICON, COL_TINT, COL_FG, COL_STYLE, \
+    COL_WEIGHT, COL_STRIKE, COL_END = range(10)
 
-COL_TYPES = (str, str, str, str, str, gtk.gdk.Color, gtk.gdk.Color,
-             pango.Style, pango.Weight, bool)
+COL_TYPES = (str, str, str, str, str, gtk.gdk.Color, pango.Style,
+             pango.Weight, bool)
 
 
 from meld.vc._vc import \
@@ -60,24 +60,22 @@ class DiffTreeStore(gtk.TreeStore):
         new_fg = lookup("insert-text", "#008800")
         mod_fg = lookup("replace-text", "#0044dd")
         del_fg = lookup("delete-text", "#880000")
-        err_fg = lookup("error-text", "#ff0000")
-        err_bg = lookup("error-bg", "#ffff00")
+        err_fg = lookup("error-text", "#ffff00")
         con_fg = lookup("conflict-text", "#ff0000")
-        con_bg = lookup("conflict-bg", "#ffdddd")
 
         self.text_attributes = [
-            # foreground, background, style, weight, strikethrough
-            (unk_fg, None,   roman,  normal, None),  # STATE_IGNORED
-            (unk_fg, None,   roman,  normal, None),  # STATE_NONE
-            (None,   None,   roman,  normal, None),  # STATE_NORMAL
-            (None,   None,   italic, normal, None),  # STATE_NOCHANGE
-            (err_fg, err_bg, roman,  bold,   None),  # STATE_ERROR
-            (unk_fg, None,   italic, normal, None),  # STATE_EMPTY
-            (new_fg, None,   roman,  bold,   None),  # STATE_NEW
-            (mod_fg, None,   roman,  bold,   None),  # STATE_MODIFIED
-            (con_fg, con_bg, roman,  bold,   None),  # STATE_CONFLICT
-            (del_fg, None,   roman,  bold,   True),  # STATE_REMOVED
-            (unk_fg, None,   roman,  normal, True),  # STATE_MISSING
+            # foreground, style, weight, strikethrough
+            (unk_fg, roman,  normal, None),  # STATE_IGNORED
+            (unk_fg, roman,  normal, None),  # STATE_NONE
+            (None,   roman,  normal, None),  # STATE_NORMAL
+            (None,   italic, normal, None),  # STATE_NOCHANGE
+            (err_fg, roman,  bold,   None),  # STATE_ERROR
+            (unk_fg, italic, normal, None),  # STATE_EMPTY
+            (new_fg, roman,  bold,   None),  # STATE_NEW
+            (mod_fg, roman,  bold,   None),  # STATE_MODIFIED
+            (con_fg, roman,  bold,   None),  # STATE_CONFLICT
+            (del_fg, roman,  bold,   True),  # STATE_REMOVED
+            (unk_fg, roman,  normal, True),  # STATE_MISSING
         ]
 
         self.icon_details = [
@@ -86,7 +84,7 @@ class DiffTreeStore(gtk.TreeStore):
             ("text-x-generic", "folder", None,   None),    # NONE
             ("text-x-generic", "folder", None,   None),    # NORMAL
             ("text-x-generic", "folder", None,   None),    # NOCHANGE
-            (None,             None    , None,   None),    # ERROR
+            ("dialog-warning", None    , None,   None),    # ERROR
             (None,             None    , None,   None),    # EMPTY
             ("text-x-generic", "folder", new_fg, None),    # NEW
             ("text-x-generic", "folder", mod_fg, None),    # MODIFIED
@@ -142,10 +140,9 @@ class DiffTreeStore(gtk.TreeStore):
 
         state_attr = self.text_attributes[state]
         self.set_value(it, self.column_index(COL_FG, pane), state_attr[0])
-        self.set_value(it, self.column_index(COL_BG, pane), state_attr[1])
-        self.set_value(it, self.column_index(COL_STYLE, pane), state_attr[2])
-        self.set_value(it, self.column_index(COL_WEIGHT, pane), state_attr[3])
-        self.set_value(it, self.column_index(COL_STRIKE, pane), state_attr[4])
+        self.set_value(it, self.column_index(COL_STYLE, pane), state_attr[1])
+        self.set_value(it, self.column_index(COL_WEIGHT, pane), state_attr[2])
+        self.set_value(it, self.column_index(COL_STRIKE, pane), state_attr[3])
 
     def get_state(self, it, pane):
         STATE = self.column_index(COL_STATE, pane)
diff --git a/meld/vcview.py b/meld/vcview.py
index 410c7b0..4e224f6 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -84,7 +84,7 @@ class VcTreeStore(tree.DiffTreeStore):
     def __init__(self):
         tree.DiffTreeStore.__init__(self, 1, [str] * 5)
         self.text_attributes[tree.STATE_MISSING] = \
-                ("#000088", None, pango.STYLE_NORMAL, pango.WEIGHT_BOLD, True)
+                ("#000088", pango.STYLE_NORMAL, pango.WEIGHT_BOLD, True)
 
 ################################################################################
 # filters
@@ -177,7 +177,6 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
         column.set_attributes(rentext,
                     text=col_index(tree.COL_TEXT, 0),
                     foreground_gdk=col_index(tree.COL_FG, 0),
-                    background_gdk=col_index(tree.COL_BG, 0),
                     style=col_index(tree.COL_STYLE, 0),
                     weight=col_index(tree.COL_WEIGHT, 0),
                     strikethrough=col_index(tree.COL_STRIKE, 0))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]