summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMazhar Hussain <realmazharhussain@gmail.com>2023-02-25 00:08:45 +0500
committerChristoph Reiter <reiter.christoph@gmail.com>2023-03-28 09:54:20 +0000
commitc129611ea7c11c2e6f68cd2a03d92cea0543d57e (patch)
tree5b422c474b7e2a88dd271b58925fcc75d6ca091c
parent8ffaf045f7b38b69fb4a9eaacea6b37383acd053 (diff)
downloadpygobject-c129611ea7c11c2e6f68cd2a03d92cea0543d57e.tar.gz
Add inequality comparison to Gdk.{Color,RGBA}
Otherwise the default implementation of __ne__ (which has wrong behavior) is used instead of inverting the result of __eq__.
-rw-r--r--gi/overrides/Gdk.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
index 49b1bc0a..47f9ae68 100644
--- a/gi/overrides/Gdk.py
+++ b/gi/overrides/Gdk.py
@@ -57,6 +57,11 @@ if GDK2 or GDK3:
return False
return self.equal(other)
+ # This is required (even when __eq__ is defined) in order
+ # for != operator to work as expected
+ def __ne__(self, other):
+ return not self == other
+
def __repr__(self):
return 'Gdk.Color(red=%d, green=%d, blue=%d)' % (self.red, self.green, self.blue)
@@ -100,6 +105,11 @@ if GDK3:
return False
return self.equal(other)
+ # This is required (even when __eq__ is defined) in order
+ # for != operator to work as expected
+ def __ne__(self, other):
+ return not self == other
+
def __repr__(self):
return 'Gdk.RGBA(red=%f, green=%f, blue=%f, alpha=%f)' % (self.red, self.green, self.blue, self.alpha)