On Sun, 2013-09-08 at 21:27 +0200, Giuseppe Penone wrote: > in my application users can control the foreground and background > color of the treeview > The problem is that the expanders arrows color does not change and so > it happens that is not visible. > Does anybody know if it is possible to override the gtk theme in use > about this?
I do not know how to override the theme, but you can set any color you want using a custom cell renderer. ... def render_task_id(column, cell, model, titer, store): if model[titer][0].objectid: cell.set_property('text', str(model[titer][0].objectid)) else: cell.set_property('text', '-') TaskList.apply_cell_effects(titer, cell, model, store.configuration['PRESENTATION']) ... def apply_cell_effects(titer, cell, model, prefs): def get_stroke(value): if value == 0: return pango.WEIGHT_ULTRALIGHT elif value == 1: return pango.WEIGHT_LIGHT elif value == 2: return pango.WEIGHT_NORMAL elif value == 3: return pango.WEIGHT_BOLD elif value == 4: return pango.WEIGHT_ULTRABOLD else: return pango.WEIGHT_HEAVY # Line-out completed and rejected tasks if model[titer][0]['status'] in ('25_done', '02_rejected'): cell.set_property('strikethrough', True) else: cell.set_property('strikethrough', False) # Background color & font [driven by priority] if (model[titer][0]['priority'] == 5): color = gtk.gdk.color_parse(prefs['VERYLOW']['COLOR']) font = prefs['VERYLOW']['FONT'] elif (model[titer][0]['priority'] == 4): color = gtk.gdk.color_parse(prefs['LOW']['COLOR']) font = pango.FontDescription(prefs['LOW']['FONT']) elif (model[titer][0]['priority'] == 3): color = gtk.gdk.color_parse(prefs['AVERAGE']['COLOR']) font = pango.FontDescription(prefs['AVERAGE']['FONT']) elif (model[titer][0]['priority'] == 2): color = gtk.gdk.color_parse(prefs['HIGH']['COLOR']) font = pango.FontDescription(prefs['HIGH']['FONT']) elif (model[titer][0]['priority'] == 1): color = gtk.gdk.color_parse(prefs['VERYHIGH']['COLOR']) font = pango.FontDescription(prefs['VERYHIGH']['FONT']) cell.set_property('cell-background', color) cell.set_property('font', font) # Foreground Stroke & Color [driven by curreny] if ('OVERDUE' in model[titer][0]['FLAGS']): stroke = get_stroke(prefs['OVERDUE']['STROKE']) color = gtk.gdk.color_parse(prefs['OVERDUE']['COLOR']) elif ('UPCOMING' in model[titer][0]['FLAGS']): stroke = get_stroke(prefs['UPCOMING']['STROKE']) color = gtk.gdk.color_parse(prefs['UPCOMING']['COLOR']) else: stroke = get_stroke(prefs['CURRENT']['STROKE']) color = gtk.gdk.color_parse(prefs['CURRENT']['COLOR']) cell.set_property('weight-set', True) cell.set_property('weight', stroke) cell.set_property('foreground', color) -- Adam Tauno Williams <mailto:awill...@whitemice.org> GPG D95ED383 Systems Administrator, Python Developer, LPI / NCLA _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/