419
419
# Set up the cells
420
420
cellpb = gtk.CellRendererPixbuf()
421
421
cell = gtk.CellRendererText()
422
# For columns that get a different text color based on status (4)
423
cellstatus = gtk.CellRendererText()
423
425
self.col_filename = gtk.TreeViewColumn(_i18n('Filename'))
424
426
self.col_filename.pack_start(cellpb, False)
429
431
self.treeview_right.append_column(self.col_filename)
431
433
self.col_status = gtk.TreeViewColumn(_i18n('Status'))
432
self.col_status.pack_start(cell, True)
433
self.col_status.add_attribute(cell, 'text', 3)
434
self.col_status.pack_start(cellstatus, True)
435
self.col_status.add_attribute(cellstatus, 'text', 3)
436
self.col_status.set_cell_data_func(cellstatus, self._map_status_color)
434
437
self.col_status.set_resizable(True)
435
438
self.treeview_right.append_column(self.col_status)
459
462
self.col_size.set_sort_column_id(5)
460
463
self.col_mtime.set_sort_column_id(7)
465
def _map_status_color(self, column, cell, model, iter):
466
status = model.get_value(iter, 4)
467
if status == 'unchanged':
468
colorstatus = gtk.gdk.color_parse('black')
469
weight = 400 # standard value
470
elif status == 'removed':
471
colorstatus = gtk.gdk.color_parse('red')
473
elif status == 'added':
474
colorstatus = gtk.gdk.color_parse('green')
476
elif status == 'modified':
477
colorstatus = gtk.gdk.color_parse("#FD00D3")
479
elif status == 'renamed':
480
colorstatus = gtk.gdk.color_parse('blue')
482
elif status == 'ignored':
483
colorstatus = gtk.gdk.color_parse('grey')
485
else: # status == unknown
486
colorstatus = gtk.gdk.color_parse('orange')
488
cell.set_property('foreground-gdk', colorstatus)
489
cell.set_property('weight', weight)
462
491
def set_view_to_localbranch(self, notbranch=False):
463
492
""" Change the sensitivity of gui items to reflect the fact that the path is a branch or not"""
464
493
self.mb_branch_initialize.set_sensitive(notbranch)