summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Schlömer <nico.schloemer@gmail.com>2021-11-17 18:30:28 +0100
committerGitHub <noreply@github.com>2021-11-17 18:30:28 +0100
commit38b433188d598175da2788ad2982e8cb3da49009 (patch)
treef7d35e138d5e1767c6c080b82e72d37e5913e0fc
parentf057083f01255eadb0d62daf874d3e610cbdd240 (diff)
parent4ac73a03a37b8dbc761b2a3b34ceb541be0fdb74 (diff)
Merge pull request #24 from nschloe/small-fixesv0.0.9
small fixes here and there
-rw-r--r--README.md1
-rw-r--r--setup.cfg2
-rw-r--r--src/tiptop/_cpu.py8
-rw-r--r--src/tiptop/_info.py20
4 files changed, 18 insertions, 13 deletions
diff --git a/README.md b/README.md
index fdb822a..9639ad6 100644
--- a/README.md
+++ b/README.md
@@ -38,6 +38,7 @@ tiptop uses [Textual](https://github.com/willmcgugan/textual/) for layouting and
Other top alternatives in alphabetical order:
- [bashtop](https://github.com/aristocratos/bashtop), [bpytop](https://github.com/aristocratos/bpytop), [btop](https://github.com/aristocratos/btop) (which inspired tiptop)
+- [bottom](https://github.com/ClementTsang/bottom)
- [Glances](https://github.com/nicolargo/glances)
- [gtop](https://github.com/aksakalli/gtop)
- [htop](https://github.com/htop-dev/htop)
diff --git a/setup.cfg b/setup.cfg
index b3fcf9e..e7010cf 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = tiptop
-version = 0.0.8
+version = 0.0.9
author = Nico Schlömer
author_email = nico.schloemer@gmail.com
description = A better top
diff --git a/src/tiptop/_cpu.py b/src/tiptop/_cpu.py
index 14aeab3..aff885e 100644
--- a/src/tiptop/_cpu.py
+++ b/src/tiptop/_cpu.py
@@ -178,12 +178,12 @@ class CPU(Widget):
self.cpu_total_stream.reset_width(self.width - 35)
if self.has_temps:
- # cpu total stream height: divide by two and round _up_
- self.cpu_total_stream.reset_height(-((2 - self.height) // 2))
+ # cpu total stream height: divide by two and round _down_
+ self.cpu_total_stream.reset_height((self.height - 2) // 2)
#
self.temp_total_stream.reset_width(self.width - 35)
- # temp total stream height: divide by two and round _down_
- self.temp_total_stream.reset_height((self.height - 2) // 2)
+ # temp total stream height: divide by two and round _up_
+ self.temp_total_stream.reset_height(-((2 - self.height) // 2))
else:
# full size cpu stream
self.cpu_total_stream.reset_height(self.height - 2)
diff --git a/src/tiptop/_info.py b/src/tiptop/_info.py
index 08efbc0..b1c48c7 100644
--- a/src/tiptop/_info.py
+++ b/src/tiptop/_info.py
@@ -1,4 +1,4 @@
-import os
+import getpass
import platform
import time
from datetime import datetime, timedelta
@@ -13,7 +13,16 @@ class InfoLine(Widget):
def on_mount(self):
self.width = 0
self.height = 0
- self.set_interval(2.0, self.refresh)
+ self.set_interval(1.0, self.refresh)
+
+ # The getlogin docs say:
+ # > For most purposes, it is more useful to use getpass.getuser() [...]
+ # username = os.getlogin()
+ username = getpass.getuser()
+ ustring = f"{username} @"
+ node = platform.node()
+ if node:
+ ustring += f" [b]{platform.node()}[/]"
system = platform.system()
if system == "Linux":
@@ -29,12 +38,7 @@ class InfoLine(Widget):
# fallback
system_string = ""
- self.left_string = " ".join(
- [
- f"{os.getlogin()} @ [b]{platform.node()}[/]",
- system_string,
- ]
- )
+ self.left_string = " ".join([ustring, system_string])
self.boot_time = psutil.boot_time()
def render(self):