[pyclutter/wip/introspection] Add missing override for Clutter.Knot
- From: Bastian Winkler <bwinkler src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pyclutter/wip/introspection] Add missing override for Clutter.Knot
- Date: Tue, 6 Dec 2011 18:24:18 +0000 (UTC)
commit 269cc15597ed642208024e8e761715c1c2c1a04c
Author: Bastian Winkler <buz netbuz org>
Date: Tue Dec 6 08:52:52 2011 -0600
Add missing override for Clutter.Knot
introspection/Clutter.py | 47 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/introspection/Clutter.py b/introspection/Clutter.py
index 3cce4ac..e1d1da6 100644
--- a/introspection/Clutter.py
+++ b/introspection/Clutter.py
@@ -321,6 +321,53 @@ Geometry = override(Geometry)
__all__.append('Geometry')
+class Knot(Clutter.Knot):
+ def __new__(cls, *args, **kwargs):
+ return Clutter.Knot.__new__(cls)
+
+ def __init__(self, x=0, y=0):
+ Clutter.Knot.__init__(self)
+ self.x = x
+ self.y = y
+
+ def __repr__(self):
+ return '<Clutter.Knot(x=%d, y=%d)>' % (self.x, self.y)
+
+ def __len__(self):
+ return 2
+
+ def __getitem__(self, key):
+ if isinstance(key, int):
+ if key == 0:
+ return self.x
+ elif key == 1:
+ return self.y
+ else:
+ raise IndexError("index out of range")
+ else:
+ raise TypeError("sequence index must be integer")
+
+ def __setitem__(self, key, value):
+ if isinstance(key, int):
+ if key == 0:
+ self.x = value
+ elif key == 1:
+ self.y = value
+ else:
+ raise IndexError("index out of range")
+ else:
+ raise TypeError("sequence index must be integer")
+
+ def __eq__(self, other):
+ return self.x == other.x and self.y == other.y
+
+ def __ne__(self, other):
+ return self.x != other.x or self.y != other.y
+
+Knot = override(Knot)
+__all__.append('Knot')
+
+
class Event(Clutter.Event):
_UNION_MEMBERS = {
Clutter.EventType.KEY_PRESS: 'key',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]