Only change the foreground color of tagged rows
svn: r16834
This commit is contained in:
parent
1bc9285216
commit
3f5cfe3187
@ -220,8 +220,7 @@ class ListView(NavigationView):
|
|||||||
column = gtk.TreeViewColumn(name, self.renderer)
|
column = gtk.TreeViewColumn(name, self.renderer)
|
||||||
|
|
||||||
if self.model and self.model.color_column() is not None:
|
if self.model and self.model.color_column() is not None:
|
||||||
fg_col = self.model.color_column()
|
column.set_cell_data_func(self.renderer, self.foreground_color)
|
||||||
column.add_attribute(self.renderer, 'foreground', fg_col)
|
|
||||||
|
|
||||||
if pair[1] in self.markup_columns:
|
if pair[1] in self.markup_columns:
|
||||||
column.add_attribute(self.renderer, 'markup', pair[1])
|
column.add_attribute(self.renderer, 'markup', pair[1])
|
||||||
@ -237,6 +236,14 @@ class ListView(NavigationView):
|
|||||||
self.list.append_column(column)
|
self.list.append_column(column)
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
|
def foreground_color(self, column, renderer, model, iter_):
|
||||||
|
'''
|
||||||
|
Set the foreground color of the cell renderer. We use a cell data
|
||||||
|
function because we don't want to set the color of untagged rows.
|
||||||
|
'''
|
||||||
|
fg_color = model.get_value(iter_, model.color_column())
|
||||||
|
renderer.set_property('foreground', fg_color)
|
||||||
|
|
||||||
def set_active(self):
|
def set_active(self):
|
||||||
NavigationView.set_active(self)
|
NavigationView.set_active(self)
|
||||||
self.uistate.show_filter_results(self.dbstate,
|
self.uistate.show_filter_results(self.dbstate,
|
||||||
|
@ -199,7 +199,7 @@ class FamilyModel(FlatBaseModel):
|
|||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = '#000000000000'
|
tag_color = None
|
||||||
tag_priority = None
|
tag_priority = None
|
||||||
for handle in data[13]:
|
for handle in data[13]:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
|
@ -176,7 +176,7 @@ class MediaModel(FlatBaseModel):
|
|||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = '#000000000000'
|
tag_color = None
|
||||||
tag_priority = None
|
tag_priority = None
|
||||||
for handle in data[10]:
|
for handle in data[10]:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
|
@ -141,7 +141,7 @@ class NoteModel(FlatBaseModel):
|
|||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = '#000000000000'
|
tag_color = None
|
||||||
tag_priority = None
|
tag_priority = None
|
||||||
for handle in data[Note.POS_TAGS]:
|
for handle in data[Note.POS_TAGS]:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
|
@ -449,7 +449,7 @@ class PeopleBaseModel(object):
|
|||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = '#000000000000'
|
tag_color = None
|
||||||
tag_priority = None
|
tag_priority = None
|
||||||
for handle in data[COLUMN_TAGS]:
|
for handle in data[COLUMN_TAGS]:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user