Update update module

Used shutil.disk_usage(path) instead of os.statvfs(path)
This commit is contained in:
yashar-sb-sb 2017-03-09 20:39:40 +03:30 committed by GitHub
parent ca9712770a
commit 3f17f0382e

View file

@ -8,7 +8,7 @@ Parameters:
* disk.path: Path to calculate disk usage from (defaults to /) * disk.path: Path to calculate disk usage from (defaults to /)
""" """
import os import shutil
import bumblebee.input import bumblebee.input
import bumblebee.output import bumblebee.output
@ -34,9 +34,9 @@ class Module(bumblebee.engine.Module):
) )
def update(self, widgets): def update(self, widgets):
st = os.statvfs(self._path) st = shutil.disk_usage(self._path)
self._size = st.f_frsize*st.f_blocks self._size = st.total
self._used = self._size - st.f_frsize*st.f_bavail self._used = st.used
self._perc = 100.0*self._used/self._size self._perc = 100.0*self._used/self._size
def state(self, widget): def state(self, widget):