summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMazhar Hussain <realmazharhussain@gmail.com>2023-02-21 21:23:00 +0500
committerChristoph Reiter <reiter.christoph@gmail.com>2023-03-28 09:54:20 +0000
commit8ffaf045f7b38b69fb4a9eaacea6b37383acd053 (patch)
treec71721649be0a0eb3c32b3f145dde2776bc75574
parent7c102de45da29cd9445e25c0758c8ab70b415419 (diff)
downloadpygobject-8ffaf045f7b38b69fb4a9eaacea6b37383acd053.tar.gz
Allow Gdk.{Color,RGBA} instances to be compared with other objects
For example, `Gdk.RGBA() == None` should return False instead of raising a TypeError Fixes https://gitlab.gnome.org/GNOME/pygobject/-/issues/414
-rw-r--r--gi/overrides/Gdk.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
index 55a6c58c..49b1bc0a 100644
--- a/gi/overrides/Gdk.py
+++ b/gi/overrides/Gdk.py
@@ -53,6 +53,8 @@ if GDK2 or GDK3:
self.blue = blue
def __eq__(self, other):
+ if not isinstance(other, Gdk.Color):
+ return False
return self.equal(other)
def __repr__(self):
@@ -94,6 +96,8 @@ if GDK3:
self.alpha = alpha
def __eq__(self, other):
+ if not isinstance(other, Gdk.RGBA):
+ return False
return self.equal(other)
def __repr__(self):