[modules/pulseaudio] Show bar charts

Re-enable optional display of barcharts
This commit is contained in:
Tobias Witek 2020-02-23 13:59:47 +01:00
parent b2064142d0
commit 66bdfacf6f
2 changed files with 15 additions and 13 deletions

View file

@ -20,6 +20,7 @@
- WAL support - WAL support
- tkinter / popups - tkinter / popups
- scrolling decorator (incl. minwidth, alignment) - scrolling decorator (incl. minwidth, alignment)
- states
## Improvements ## Improvements
- pango output (improve - maybe autodetect? see #531) - pango output (improve - maybe autodetect? see #531)

View file

@ -25,8 +25,9 @@ import core.module
import core.widget import core.widget
import core.input import core.input
import util.format
import util.cli import util.cli
import util.graph
import util.format
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config, channel): def __init__(self, config, channel):
@ -44,7 +45,7 @@ class Module(core.module.Module):
self._mute = False self._mute = False
self._failed = False self._failed = False
self._channel = channel self._channel = channel
#self._showbars = core.fmt.bool(self.parameter('showbars', 0)) self._showbars = util.format.asbool(self.parameter('showbars', 0))
self._patterns = [ self._patterns = [
{'expr': 'Name:', 'callback': (lambda line: False)}, {'expr': 'Name:', 'callback': (lambda line: False)},
@ -117,23 +118,23 @@ class Module(core.module.Module):
return 'n/a' return 'n/a'
if int(self._mono) > 0: if int(self._mono) > 0:
vol = '{}%'.format(self._mono) vol = '{}%'.format(self._mono)
#if self._showbars: if self._showbars:
# vol = '{} {}'.format( vol = '{} {}'.format(
# vol, bumblebee.output.hbar(float(self._mono))) vol, util.graph.hbar(float(self._mono)))
return vol return vol
elif self._left == self._right: elif self._left == self._right:
vol = '{}%'.format(self._left) vol = '{}%'.format(self._left)
#if self._showbars: if self._showbars:
# vol = '{} {}'.format( vol = '{} {}'.format(
# vol, bumblebee.output.hbar(float(self._left))) vol, util.graph.hbar(float(self._left)))
return vol return vol
else: else:
#if self._showbars:
# vol = '{} {}{}'.format(
# vol,
# bumblebee.output.hbar(float(self._left)),
# bumblebee.output.hbar(float(self._right)))
vol = '{}%/{}%'.format(self._left, self._right) vol = '{}%/{}%'.format(self._left, self._right)
if self._showbars:
vol = '{} {}{}'.format(
vol,
util.graph.hbar(float(self._left)),
util.graph.hbar(float(self._right)))
return vol return vol
def update(self): def update(self):