Include free swap space in the activity ring's "free memory" slice
Mostly only affects sugar-jhbuild, but also people with USB/SD swap on B2s
This commit is contained in:
parent
de9e02b498
commit
723429fb80
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
import colorsys
|
import colorsys
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
import logging
|
||||||
import math
|
import math
|
||||||
|
|
||||||
import hippo
|
import hippo
|
||||||
@ -317,10 +318,12 @@ class ActivitiesDonut(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
'expected format' % pid)
|
'expected format' % pid)
|
||||||
|
|
||||||
# Next, see how much free memory is left.
|
# Next, see how much free memory is left.
|
||||||
|
free_memory = 0
|
||||||
try:
|
try:
|
||||||
meminfo = open('/proc/meminfo')
|
meminfo = open('/proc/meminfo')
|
||||||
meminfo.readline()
|
for line in meminfo.readlines():
|
||||||
free_memory = int(meminfo.readline()[9:-3])
|
if line.startswith('MemFree:') or line.startswith('SwapFree:'):
|
||||||
|
free_memory += int(line[9:-3])
|
||||||
meminfo.close()
|
meminfo.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
logging.warn('ActivitiesDonut: could not read /proc/meminfo')
|
logging.warn('ActivitiesDonut: could not read /proc/meminfo')
|
||||||
|
Loading…
Reference in New Issue
Block a user