Cpu_load >100 workaround in the generic chart widget.

This commit is contained in:
Agnieszka Kostrzewa 2012-02-06 22:32:36 +01:00
parent 5e6530d0c9
commit ce30f9a83f

View File

@ -266,6 +266,8 @@ class ChartWidget (QWidget):
super (ChartWidget, self).__init__(parent)
self.update_func = update_func
self.hue = hue
if hue < 0 or hue > 255:
self.hue = 255
self.load = load
assert self.load >= 0 and self.load <= 100, "load = {0}".format(self.load)
self.load_history = [self.load]
@ -273,14 +275,12 @@ class ChartWidget (QWidget):
def update_load (self, vm, load):
self.load = self.update_func(vm, load)
assert self.load >= 0 and self.load <= 100, "load = {0}".format(self.load)
#This was in LoadChartWidget - double # means the line was a comment.
#assert self.load >= 0, "load = {0}".format(self.load)
# # assert self.load >= 0 and self.load <= 100, "load = {0}".format(self.load)
# if self.load > 100:
# # FIXME: This is an ugly workaround :/
# self.load = 100
assert self.load >= 0, "load = {0}".format(self.load)
# assert self.load >= 0 and self.load <= 100, "load = {0}".format(self.load)
if self.load > 100:
# FIXME: This is an ugly workaround for cpu_load:/
self.load = 100
self.load_history.append (self.load)
self.tableItem.set_value(self.load)