From f44d48e7bdeadba78d832ab1ef07f35ebcb1292c Mon Sep 17 00:00:00 2001 From: me Date: Wed, 12 Feb 2020 18:11:22 +0200 Subject: [PATCH] [core/output] micro-optimization refactoring If markup isn't pango, skip the add_prefix_colors() call entirely --- bumblebee/output.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bumblebee/output.py b/bumblebee/output.py index 920c78c..51ae30a 100644 --- a/bumblebee/output.py +++ b/bumblebee/output.py @@ -354,21 +354,21 @@ 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 = "{}".format( - "foreground='{}'".format(self._prefix_fg) if self._prefix_fg else "", - "background='{}'".format(self._prefix_bg) if self._prefix_bg else "", - self._prefix - ) + self._prefix = "{}".format( + "foreground='{}'".format(self._prefix_fg) if self._prefix_fg else "", + "background='{}'".format(self._prefix_bg) if self._prefix_bg else "", + 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._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: self._full_text = u"{}{}".format(self._prefix, self._full_text)