imgconverter: add eq operation for Image class

This is used to check if the new icon is in any way different from the
old one and possibly avoid regenerating all of them.
This commit is contained in:
Marek Marczykowski-Górecki 2015-04-28 12:46:23 +02:00
parent e9eedf2c6a
commit 4e7b4e17c3

View File

@ -191,6 +191,12 @@ expects header+RGBA on stdin. This method is invoked from qvm-imgconverter-clien
return cls.get_from_stream(sys.stdin, **kwargs) return cls.get_from_stream(sys.stdin, **kwargs)
def __eq__(self, other):
return self._size == other._size and self._rgba == other._rgba
def __ne__(self, other):
return not self.__eq__(other)
def hex_to_float(colour, channels=3, depth=8): def hex_to_float(colour, channels=3, depth=8):
'''Convert hex colour definition to tuple of floats.''' '''Convert hex colour definition to tuple of floats.'''