mirror of
https://github.com/jtgans/g13gui.git
synced 2025-06-20 00:14:09 -04:00
clock: Display CPU percentage correctly
psutil.cpu_percent() actually delivers a percentage from 0 to 100. We need to normalize that value to 0..1 to display properly.
This commit is contained in:
parent
9fb8dbab4d
commit
802b342a1c
@ -48,8 +48,8 @@ class ClockApplet(Applet):
|
||||
DISPLAY_WIDTH // 2 - 5, 12)
|
||||
self.screen.addChild(self._loadGraph)
|
||||
|
||||
self._ramGraph = Graph(DISPLAY_WIDTH // 2 + 5, 18,
|
||||
DISPLAY_WIDTH // 2 - 7, 12)
|
||||
self._ramGraph = Graph(DISPLAY_WIDTH // 2 + 2, 18,
|
||||
DISPLAY_WIDTH // 2 - 5, 12)
|
||||
self.screen.addChild(self._ramGraph)
|
||||
|
||||
self._update()
|
||||
@ -73,7 +73,7 @@ class ClockApplet(Applet):
|
||||
x = (DISPLAY_WIDTH // 2) - (w // 2)
|
||||
self._timeLabel.position = (x, 0)
|
||||
|
||||
self._loadGraph.addValue(psutil.cpu_percent())
|
||||
self._loadGraph.addValue(psutil.cpu_percent() / 100)
|
||||
self._ramGraph.addValue(psutil.virtual_memory().percent / 100)
|
||||
|
||||
def _pushTime(self):
|
||||
|
Loading…
Reference in New Issue
Block a user