[Pkg-bazaar-commits] ./bzr-gtk/unstable r595: Merge Olive file list status message coloring

Jasper Groenewegen colbrac at xs4all.nl
Fri Apr 10 07:50:50 UTC 2009


------------------------------------------------------------
revno: 595
committer: Jasper Groenewegen <colbrac at xs4all.nl>
branch nick: trunk
timestamp: Mon 2008-08-04 23:37:01 +0200
message:
  Merge Olive file list status message coloring
modified:
  NEWS
  olive/window.py
    ------------------------------------------------------------
    revno: 592.2.1
    committer: Jasper Groenewegen <colbrac at xs4all.nl>
    branch nick: statuscolor
    timestamp: Mon 2008-08-04 22:36:27 +0200
    message:
      Add color and boldface to status messages in file list in Olive
      
      Colors defined by gtk.gdk.color_parse("") where "" can be a color name as specified in the X11 rgb.txt file or as a hexadecimal string
    modified:
      olive/window.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-08-04 18:52:14 +0000
+++ b/NEWS	2008-08-04 21:37:01 +0000
@@ -1,5 +1,9 @@
 0.96.0	UNRELEASED
 
+ UI
+ 
+  * Add colored status messages in Olive file list (Jasper Groenewegen)
+
 0.95.0	2008-08-04
 
  UI

=== modified file 'olive/window.py'
--- a/olive/window.py	2008-08-03 10:07:38 +0000
+++ b/olive/window.py	2008-08-04 20:36:27 +0000
@@ -419,6 +419,8 @@
         # Set up the cells
         cellpb = gtk.CellRendererPixbuf()
         cell = gtk.CellRendererText()
+        # For columns that get a different text color based on status (4)
+        cellstatus = gtk.CellRendererText()
         
         self.col_filename = gtk.TreeViewColumn(_i18n('Filename'))
         self.col_filename.pack_start(cellpb, False)
@@ -429,8 +431,9 @@
         self.treeview_right.append_column(self.col_filename)
         
         self.col_status = gtk.TreeViewColumn(_i18n('Status'))
-        self.col_status.pack_start(cell, True)
-        self.col_status.add_attribute(cell, 'text', 3)
+        self.col_status.pack_start(cellstatus, True)
+        self.col_status.add_attribute(cellstatus, 'text', 3)
+        self.col_status.set_cell_data_func(cellstatus, self._map_status_color)
         self.col_status.set_resizable(True)
         self.treeview_right.append_column(self.col_status)
         
@@ -459,6 +462,32 @@
         self.col_size.set_sort_column_id(5)
         self.col_mtime.set_sort_column_id(7)
     
+    def _map_status_color(self, column, cell, model, iter):
+        status = model.get_value(iter, 4)
+        if status == 'unchanged':
+            colorstatus = gtk.gdk.color_parse('black')
+            weight = 400 # standard value
+        elif status == 'removed':
+            colorstatus = gtk.gdk.color_parse('red')
+            weight = 800
+        elif status == 'added':
+            colorstatus = gtk.gdk.color_parse('green')
+            weight = 800
+        elif status == 'modified':
+            colorstatus = gtk.gdk.color_parse("#FD00D3")
+            weight = 800
+        elif status == 'renamed':
+            colorstatus = gtk.gdk.color_parse('blue')
+            weight = 800
+        elif status == 'ignored':
+            colorstatus = gtk.gdk.color_parse('grey')
+            weight = 600
+        else: # status == unknown
+            colorstatus = gtk.gdk.color_parse('orange')
+            weight = 800
+        cell.set_property('foreground-gdk', colorstatus)
+        cell.set_property('weight', weight)
+    
     def set_view_to_localbranch(self, notbranch=False):
         """ Change the sensitivity of gui items to reflect the fact that the path is a branch or not"""
         self.mb_branch_initialize.set_sensitive(notbranch)



More information about the Pkg-bazaar-commits mailing list