extract add_suffix() method

This commit is contained in:
me 2020-01-31 12:11:51 +02:00
parent 4855b1aa0a
commit beff99888b

View file

@ -367,6 +367,13 @@ class WidgetDrawer(object):
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)
def add_suffix(self, widget, padding):
"""add suffix to full_text"""
self._suffix = self._theme.suffix(widget, padding)
if self._suffix:
self._full_text = u"{}{}".format(self._full_text, self._suffix)
def draw(self, widget, module=None, engine=None): def draw(self, widget, module=None, engine=None):
""" """
Keep the same argument signature as I3BarOutput.draw() Keep the same argument signature as I3BarOutput.draw()
@ -392,10 +399,7 @@ class WidgetDrawer(object):
self.add_prefix(widget, padding) self.add_prefix(widget, padding)
self._suffix = self._theme.suffix(widget, padding) self.add_suffix(widget, padding)
if self._suffix:
self._full_text = u"{}{}".format(self._full_text, self._suffix)
width = self._theme.minwidth(widget) width = self._theme.minwidth(widget)