extract add_prefix_colors() method

This commit is contained in:
me 2020-01-31 12:31:38 +02:00
parent 64c675150e
commit ed256a960d

View file

@ -350,10 +350,8 @@ class WidgetDrawer(object):
"separator_block_width": self._theme.separator_block_width(widget), "separator_block_width": self._theme.separator_block_width(widget),
}) })
def add_prefix(self, widget, padding): def add_prefix_colors(self, widget):
"""add prefix to full_text""" """add custom theme colors for prefix"""
self._prefix = self._theme.prefix(widget, padding)
if self._markup == "pango": if self._markup == "pango":
# add prefix/suffix colors # add prefix/suffix colors
fg = self._theme.prefix_fg(widget) fg = self._theme.prefix_fg(widget)
@ -364,6 +362,12 @@ class WidgetDrawer(object):
self._prefix self._prefix
) )
def add_prefix(self, widget, padding):
"""add prefix to full_text"""
self._prefix = self._theme.prefix(widget, padding)
self.add_prefix_colors(widget)
if self._prefix: if self._prefix:
self._full_text = u"{}{}".format(self._prefix, self._full_text) self._full_text = u"{}{}".format(self._prefix, self._full_text)