Commit e3659d49 authored by Dan Pascu's avatar Dan Pascu

Fixed Status object comparison

parent 6e9a6429
......@@ -224,10 +224,20 @@ class PacketLossLabel(QLabel):
class Status(unicode):
def __new__(cls, value, color='black'):
instance = unicode.__new__(cls, value)
instance = super(Status, cls).__new__(cls, value)
instance.color = color
return instance
def __eq__(self, other):
if isinstance(other, Status):
return super(Status, self).__eq__(other) and self.color == other.color
elif isinstance(other, basestring):
return super(Status, self).__eq__(other)
return NotImplemented
def __ne__(self, other):
return not (self == other)
class StatusLabel(QLabel):
def __init__(self, parent=None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment