diff --git a/powerline/bindings/qtile/widget.py b/powerline/bindings/qtile/widget.py index 897658c9..99586582 100644 --- a/powerline/bindings/qtile/widget.py +++ b/powerline/bindings/qtile/widget.py @@ -1,17 +1,23 @@ # vim:fileencoding=utf-8:noet from __future__ import (unicode_literals, division, absolute_import, print_function) -from libqtile import bar -from libqtile.widget import base +from libqtile.bar import CALCULATED +from libqtile.widget import TextBox -from powerline import Powerline as PowerlineCore +from powerline import Powerline -class Powerline(base._TextBox): - def __init__(self, timeout=2, text=' ', width=bar.CALCULATED, **config): - base._TextBox.__init__(self, text, width, **config) +class QTilePowerline(Powerline): + def do_setup(self, obj): + obj.powerline = self + + +class PowerlineTextBox(TextBox): + def __init__(self, timeout=2, text=' ', width=CALCULATED, **config): + super(PowerlineTextBox, self).__init__(text, width, **config) self.timeout_add(timeout, self.update) - self.powerline = PowerlineCore(ext='wm', renderer_module='pango_markup') + powerline = QTilePowerline(ext='wm', renderer_module='pango_markup') + powerline.setup(self) def update(self): if not self.configured: @@ -27,7 +33,7 @@ class Powerline(base._TextBox): return self.text def _configure(self, qtile, bar): - base._TextBox._configure(self, qtile, bar) + super(PowerlineTextBox, self)._configure(qtile, bar) self.layout = self.drawer.textlayout( self.text, self.foreground, @@ -35,3 +41,7 @@ class Powerline(base._TextBox): self.fontsize, self.fontshadow, markup=True) + + +# TODO: Remove this at next major release +Powerline = PowerlineTextBox