1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 __docformat__ = 'reStructuredText'
20
21 from pytilities import event, AttributeCollectionBase
22 from .vector import Vector
23
24 @event.dispatcher("changed")
26
27 """
28 `Vector` wrapper that sends out events.
29
30 It supports all attributes of `Vector`. For `Vector` specific
31 documentation, see `Vector`.
32
33 Events:
34
35 changed
36 x and/or y value changed
37
38 Parameters:
39
40 `old_tuple` :: (x, y)
41 the old x and y values
42 """
43
60
61 @property
64
65 @x.setter
67 old_tuple = self.__v.xy
68 self.__v.x = value
69 self.__dispatch("changed", old_tuple)
70
71 @property
74
75 @y.setter
77 old_tuple = self.__v.xy
78 self.__v.y = value
79 self.__dispatch("changed", old_tuple)
80
82 old_tuple = self.__v.xy
83 self.__v.move_to(*args)
84 self.__dispatch("changed", old_tuple)
85
87 old_tuple = self.__v.xy
88 self.__v.move_by(*args)
89 self.__dispatch("changed", old_tuple)
90
92 old_tuple = self.__v.xy
93 self.__v.assign(v)
94 self.__dispatch("changed", old_tuple)
95
96 @property
99
100 @length.setter
102 old_tuple = self.__v.xy
103 self.__v.length = value
104 self.__dispatch("changed", old_tuple)
105
107 old_tuple = self.__v.xy
108 self.__v.normalize()
109 self.__dispatch("changed", old_tuple)
110 return self
111
113 old_tuple = self.__v.xy
114 self.__v += other
115 self.__dispatch("changed", old_tuple)
116 return self
117
119 old_tuple = self.__v.xy
120 self.__v *= other
121 self.__dispatch("changed", old_tuple)
122 return self
123