[core/output] micro-optimization refactoring

If markup isn't pango, skip the add_prefix_colors() call entirely
This commit is contained in:
me 2020-02-12 18:11:22 +02:00
parent d1238f9dca
commit f44d48e7bd

View file

@ -354,10 +354,6 @@ class WidgetDrawer(object):
def add_prefix_colors(self, widget):
"""add custom theme colors for prefix"""
if self._markup == "pango":
# add prefix/suffix colors
self._prefix_fg = self._theme.prefix_fg(widget)
self._prefix_bg = self._theme.prefix_bg(widget)
self._prefix = "<span {} {}>{}</span>".format(
"foreground='{}'".format(self._prefix_fg) if self._prefix_fg else "",
"background='{}'".format(self._prefix_bg) if self._prefix_bg else "",
@ -368,6 +364,10 @@ class WidgetDrawer(object):
"""add prefix to full_text"""
self._prefix = self._theme.prefix(widget, padding)
if self._markup == "pango":
# add prefix/suffix colors
self._prefix_fg = self._theme.prefix_fg(widget)
self._prefix_bg = self._theme.prefix_bg(widget)
self.add_prefix_colors(widget)
if self._prefix: