[pyclutter/wip/introspection] Implement __eq__ and __ne__ for some boxed types



commit c91a5abd93c42c610aa2877ec31a32d2313a329b
Author: Bastian Winkler <buz netbuz org>
Date:   Sun Nov 13 18:49:22 2011 +0100

    Implement __eq__ and __ne__ for some boxed types

 introspection/Clutter.py |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/introspection/Clutter.py b/introspection/Clutter.py
index 9dfd79c..2394167 100644
--- a/introspection/Clutter.py
+++ b/introspection/Clutter.py
@@ -74,6 +74,12 @@ class Color(Clutter.Color):
         else:
             raise IndexError("index out of range")
 
+    def __eq__(self, other):
+        return self.equal(other)
+
+    def __ne__(self, other):
+        return not self.equal(other)
+
     @classmethod
     def from_string(cls, string):
         self = cls()
@@ -140,6 +146,12 @@ class ActorBox(Clutter.ActorBox):
         else:
             raise IndexError("index out of range")
 
+    def __eq__(self, other):
+        return self.equal(other)
+
+    def __ne__(self, other):
+        return not self.equal(other)
+
 ActorBox = override(ActorBox)
 __all__.append('ActorBox')
 
@@ -182,6 +194,12 @@ class Vertex(Clutter.Vertex):
         else:
             raise IndexError("index out of range")
 
+    def __eq__(self, other):
+        return self.equal(other)
+
+    def __ne__(self, other):
+        return not self.equal(other)
+
 Vertex = override(Vertex)
 __all__.append('Vertex')
 
@@ -230,6 +248,14 @@ class Geometry(Clutter.Geometry):
         else:
             raise IndexError("index out of range")
 
+    def __eq__(self, other):
+        return self.x == other.x and self.y == other.y and \
+                self.width == other.width and self.height == other.height
+
+    def __ne__(self, other):
+        return self.x != other.x or self.y != other.y or \
+                self.width != other.width or self.height != other.height
+
 Geometry = override(Geometry)
 __all__.append('Geometry')
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]