diff options
author | Nico Schlömer <nico.schloemer@gmail.com> | 2022-03-07 15:03:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-07 15:03:51 +0100 |
commit | 46461680b5ec2bb8388ab0bfb4c7b5090978f726 (patch) | |
tree | bf8d569863959316878d1e992f3bbba93d9f3f9d | |
parent | 6e77c746c6f8e533e60fd35ee41b6244a97c14f6 (diff) | |
parent | 644388d0e5c25d8778f3aa1c3548077e3a00f780 (diff) |
Merge pull request #70 from nschloe/non-batteryv0.2.1
Non battery
-rw-r--r-- | src/tiptop/__about__.py | 2 | ||||
-rw-r--r-- | src/tiptop/_app.py | 22 | ||||
-rw-r--r-- | src/tiptop/braille_stream.py | 7 |
3 files changed, 17 insertions, 14 deletions
diff --git a/src/tiptop/__about__.py b/src/tiptop/__about__.py index d3ec452..3ced358 100644 --- a/src/tiptop/__about__.py +++ b/src/tiptop/__about__.py @@ -1 +1 @@ -__version__ = "0.2.0" +__version__ = "0.2.1" diff --git a/src/tiptop/_app.py b/src/tiptop/_app.py index 2a53505..e0f9014 100644 --- a/src/tiptop/_app.py +++ b/src/tiptop/_app.py @@ -76,22 +76,24 @@ def run(argv=None): grid.add_column(fraction=34, name="right") if psutil.sensors_battery() is None: - grid.add_row(size=1, name="topline") - grid.add_row(fraction=1, name="top") - grid.add_row(fraction=1, name="center") - grid.add_row(fraction=1, name="bottom") + grid.add_row(size=1, name="r0") + grid.add_row(fraction=1, name="r1") + grid.add_row(fraction=1, name="r2") + grid.add_row(fraction=1, name="r3") grid.add_areas( - area0="left-start|right-end,topline", - area1="left-start|right-end,top", - area2a="left,center", - area2b="left,bottom", - area3="right,center-start|bottom-end", + area0="left-start|right-end,r0", + area1="left,r1", + area2a="right,r1", + area2b="right,r2", + area2c="right,r3", + area3="left,r2-start|r3-end", ) grid.place( area0=InfoLine(), area1=CPU(), area2a=Mem(), - area2b=Net(args.net), + area2b=Disk(), + area2c=Net(args.net), area3=ProcsList(), ) else: diff --git a/src/tiptop/braille_stream.py b/src/tiptop/braille_stream.py index b7b5e73..a15e23f 100644 --- a/src/tiptop/braille_stream.py +++ b/src/tiptop/braille_stream.py @@ -60,9 +60,10 @@ class BrailleStream: elif value > self.maxval: k = 4 * self.height else: - k = ceil( - (value - self.minval) / (self.maxval - self.minval) * 4 * self.height - ) + diff = self.maxval - self.minval + if diff == 0: + diff = 1 + k = ceil((value - self.minval) / diff * 4 * self.height) # form blocks of 4 blocks = [4] * (k // 4) if k % 4 > 0: |