From 4e7b4e17c3320be8780b8d4c20cae44f8022a905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 28 Apr 2015 12:46:23 +0200 Subject: [PATCH] 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. --- core/imgconverter.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/imgconverter.py b/core/imgconverter.py index 005c0b3..d409b58 100755 --- a/core/imgconverter.py +++ b/core/imgconverter.py @@ -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) + 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): '''Convert hex colour definition to tuple of floats.'''