Do not use private classes for qtile, do not rename Powerline class
This commit is contained in:
parent
6c966811af
commit
83e459c5f8
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue