/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/window.py

  • Committer: Jasper Groenewegen
  • Date: 2008-08-04 21:37:01 UTC
  • mfrom: (592.2.1 statuscolor)
  • Revision ID: colbrac@xs4all.nl-20080804213701-vqeapg4fr1ideemz
Merge Olive file list status message coloring

Show diffs side-by-side

added added

removed removed

Lines of Context:
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()
422
424
        
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)
430
432
        
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)
436
439
        
459
462
        self.col_size.set_sort_column_id(5)
460
463
        self.col_mtime.set_sort_column_id(7)
461
464
    
 
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')
 
472
            weight = 800
 
473
        elif status == 'added':
 
474
            colorstatus = gtk.gdk.color_parse('green')
 
475
            weight = 800
 
476
        elif status == 'modified':
 
477
            colorstatus = gtk.gdk.color_parse("#FD00D3")
 
478
            weight = 800
 
479
        elif status == 'renamed':
 
480
            colorstatus = gtk.gdk.color_parse('blue')
 
481
            weight = 800
 
482
        elif status == 'ignored':
 
483
            colorstatus = gtk.gdk.color_parse('grey')
 
484
            weight = 600
 
485
        else: # status == unknown
 
486
            colorstatus = gtk.gdk.color_parse('orange')
 
487
            weight = 800
 
488
        cell.set_property('foreground-gdk', colorstatus)
 
489
        cell.set_property('weight', weight)
 
490
    
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)