mirror of
https://github.com/powerline/powerline.git
synced 2025-07-15 18:04:57 +02:00
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
|
# vim:fileencoding=utf-8:noet
|
||||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||||
|
|
||||||
from libqtile import bar
|
from libqtile.bar import CALCULATED
|
||||||
from libqtile.widget import base
|
from libqtile.widget import TextBox
|
||||||
|
|
||||||
from powerline import Powerline as PowerlineCore
|
from powerline import Powerline
|
||||||
|
|
||||||
|
|
||||||
class Powerline(base._TextBox):
|
class QTilePowerline(Powerline):
|
||||||
def __init__(self, timeout=2, text=' ', width=bar.CALCULATED, **config):
|
def do_setup(self, obj):
|
||||||
base._TextBox.__init__(self, text, width, **config)
|
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.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):
|
def update(self):
|
||||||
if not self.configured:
|
if not self.configured:
|
||||||
@ -27,7 +33,7 @@ class Powerline(base._TextBox):
|
|||||||
return self.text
|
return self.text
|
||||||
|
|
||||||
def _configure(self, qtile, bar):
|
def _configure(self, qtile, bar):
|
||||||
base._TextBox._configure(self, qtile, bar)
|
super(PowerlineTextBox, self)._configure(qtile, bar)
|
||||||
self.layout = self.drawer.textlayout(
|
self.layout = self.drawer.textlayout(
|
||||||
self.text,
|
self.text,
|
||||||
self.foreground,
|
self.foreground,
|
||||||
@ -35,3 +41,7 @@ class Powerline(base._TextBox):
|
|||||||
self.fontsize,
|
self.fontsize,
|
||||||
self.fontshadow,
|
self.fontshadow,
|
||||||
markup=True)
|
markup=True)
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Remove this at next major release
|
||||||
|
Powerline = PowerlineTextBox
|
||||||
|
Loading…
x
Reference in New Issue
Block a user