diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-09-29 22:09:43 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-09-29 22:09:43 +0000 |
| commit | 7b25522dc35a9d942101750e9eb5135867e6bcce (patch) | |
| tree | 102047a2b59b89abfee6773738082e1a73460fc3 /lib/python/Components | |
| parent | 2dc9b0cb83069aaed4dbb3f45b3d15835568d0d9 (diff) | |
| download | enigma2-7b25522dc35a9d942101750e9eb5135867e6bcce.tar.gz enigma2-7b25522dc35a9d942101750e9eb5135867e6bcce.zip | |
add DiskInfo component
Diffstat (limited to 'lib/python/Components')
| -rw-r--r-- | lib/python/Components/DiskInfo.py | 32 | ||||
| -rw-r--r-- | lib/python/Components/Makefile.am | 2 | ||||
| -rw-r--r-- | lib/python/Components/__init__.py | 3 |
3 files changed, 34 insertions, 3 deletions
diff --git a/lib/python/Components/DiskInfo.py b/lib/python/Components/DiskInfo.py new file mode 100644 index 00000000..9bd774b1 --- /dev/null +++ b/lib/python/Components/DiskInfo.py @@ -0,0 +1,32 @@ +from GUIComponent import * +from VariableText import * +import os + +from enigma import eLabel + +# TODO: Harddisk.py has similiar functions, but only similiar. +# fix this to use same code +class DiskInfo(GUIComponent, VariableText): + FREE = 0 + USED = 1 + SIZE = 2 + + def __init__(self, path, type): + GUIComponent.__init__(self) + VariableText.__init__(self) + self.type = type + self.path = path + self.update() + + def update(self): + try: + stat = os.statvfs(self.path) + except OSError: + return -1 + + if self.type == self.FREE: + free = stat.f_bfree / 1000 * stat.f_bsize / 1000 + self.setText("%dMB free diskspace" % (free)) + + def createWidget(self, parent): + return eLabel(parent) diff --git a/lib/python/Components/Makefile.am b/lib/python/Components/Makefile.am index 6e99f781..2000eb9f 100644 --- a/lib/python/Components/Makefile.am +++ b/lib/python/Components/Makefile.am @@ -8,4 +8,4 @@ install_DATA = \ EventInfo.py Label.py ServiceScan.py VolumeBar.py \ GUIComponent.py MenuList.py TextInput.py __init__.py MovieList.py \ InputDevice.py ServicePosition.py SetupDevices.py Harddisk.py \ - AVSwitch.py Network.py RFmod.py + AVSwitch.py Network.py RFmod.py DiskInfo.py diff --git a/lib/python/Components/__init__.py b/lib/python/Components/__init__.py index 1e47fde6..a6259395 100644 --- a/lib/python/Components/__init__.py +++ b/lib/python/Components/__init__.py @@ -5,5 +5,4 @@ __all__ = ["ActionMap", "Button", "Clock", "ConfigList", "EventInfo", "ServiceName", "ServiceScan", "VariableText", "VariableValue", "VolumeBar", "components", "config", "TimerList", "TimeInput", "MovieList", "InputDevice", "ServicePosition", "IPAddress", "VariableIP", "IPGateway", - "IPNameserver", "Network" ] - + "IPNameserver", "Network", "RFmon", "DiskInfo" ] |
