Fixed zero swap and memory

This commit is contained in:
arcan1s 2013-11-19 18:17:59 +04:00
parent 5bcf76a136
commit 0d3aacdec7

View File

@ -186,8 +186,11 @@ class pyTextWidget(plasmascript.Applet):
def memText(self):
"""function to set mem text"""
full = self.mem_uf + self.mem_free
try:
mem = 100 * self.mem_used / full
mem = "%5s" % (str(round(mem, 1)))
except:
mem = " N\\A"
if (self.memFormat.split('$mem')[0] != self.memFormat):
line = self.memFormat.split('$mem')[0] + mem + self.memFormat.split('$mem')[1]
else:
@ -199,8 +202,11 @@ class pyTextWidget(plasmascript.Applet):
def swapText(self):
"""function to set swap text"""
full = self.swap_used + self.swap_free
try:
mem = 100 * self.swap_used / full
mem = "%5s" % (str(round(mem, 1)))
except:
mem = " N\\A"
if (self.swapFormat.split('$swap')[0] != self.swapFormat):
line = self.swapFormat.split('$swap')[0] + mem + self.swapFormat.split('$swap')[1]
else: