blob: 1278ff990de10225ca284815041d1dd3656f6556 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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(VariableText, GUIComponent):
FREE = 0
USED = 1
SIZE = 2
def __init__(self, path, type, update = True):
GUIComponent.__init__(self)
VariableText.__init__(self)
self.type = type
self.path = path
if update:
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))
GUI_WIDGET = eLabel
|