diff options
author | flavio <fdanesse@gmail.com> | 2012-06-15 20:08:28 (GMT) |
---|---|---|
committer | flavio <fdanesse@gmail.com> | 2012-06-15 20:08:28 (GMT) |
commit | ebae32267a9369ed9cdf389571581f43c871b38c (patch) | |
tree | 3f8febac7ae9e1994372929a3ee3a0f15283a237 /library | |
parent | 7058c4b3d7d92442a46de28befec64f141664eb3 (diff) |
Port Gtk3 Base
Diffstat (limited to 'library')
-rwxr-xr-x | library/pippy/physics/Box2D2.py | 138 | ||||
-rw-r--r-- | library/pippy/physics/add_objects.py | 96 | ||||
-rwxr-xr-x | library/pippy/physics/callbacks.py | 16 | ||||
-rwxr-xr-x | library/pippy/physics/camera.py | 10 | ||||
-rwxr-xr-x | library/pippy/physics/drawing.py | 50 | ||||
-rw-r--r-- | library/pippy/physics/elements.py | 54 | ||||
-rwxr-xr-x | library/pippy/physics/locals.py | 4 | ||||
-rw-r--r-- | library/pippy/physics/menu.py | 24 | ||||
-rwxr-xr-x | library/pippy/physics/tools.py | 10 | ||||
-rwxr-xr-x | library/pippy/physics/tools_poly.py | 54 | ||||
-rw-r--r-- | library/pippy/query.py | 4 | ||||
-rwxr-xr-x | library/pippy/sound.py | 6 |
12 files changed, 233 insertions, 233 deletions
diff --git a/library/pippy/physics/Box2D2.py b/library/pippy/physics/Box2D2.py index 5d444e2..294d4ca 100755 --- a/library/pippy/physics/Box2D2.py +++ b/library/pippy/physics/Box2D2.py @@ -79,7 +79,7 @@ class b2Version(_object): __swig_setmethods__["revision"] = _Box2D2.b2Version_revision_set __swig_getmethods__["revision"] = _Box2D2.b2Version_revision_get if _newclass:revision = _swig_property(_Box2D2.b2Version_revision_get, _Box2D2.b2Version_revision_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2Version""" this = _Box2D2.new_b2Version(*args) try: self.this.append(this) @@ -125,7 +125,7 @@ class b2Vec2(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2Vec2, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """ __init__(self) -> b2Vec2 __init__(self, float32 x, float32 y) -> b2Vec2 @@ -208,7 +208,7 @@ class b2Mat22(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2Mat22, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """ __init__(self) -> b2Mat22 __init__(self, b2Vec2 c1, b2Vec2 c2) -> b2Mat22 @@ -263,7 +263,7 @@ class b2XForm(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2XForm, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """ __init__(self) -> b2XForm __init__(self, b2Vec2 position, b2Mat22 R) -> b2XForm @@ -319,7 +319,7 @@ class b2Sweep(_object): __swig_setmethods__["t0"] = _Box2D2.b2Sweep_t0_set __swig_getmethods__["t0"] = _Box2D2.b2Sweep_t0_get if _newclass:t0 = _swig_property(_Box2D2.b2Sweep_t0_get, _Box2D2.b2Sweep_t0_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2Sweep""" this = _Box2D2.new_b2Sweep(*args) try: self.this.append(this) @@ -390,7 +390,7 @@ class b2ContactID(_object): if _newclass:key = _swig_property(_Box2D2.b2ContactID_key_get, _Box2D2.b2ContactID_key_set) __swig_getmethods__["features"] = _Box2D2.b2ContactID_features_get if _newclass:features = _swig_property(_Box2D2.b2ContactID_features_get) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2ContactID""" this = _Box2D2.new_b2ContactID(*args) try: self.this.append(this) @@ -464,7 +464,7 @@ class b2ContactID_features(_object): __swig_setmethods__["flip"] = _Box2D2.b2ContactID_features_flip_set __swig_getmethods__["flip"] = _Box2D2.b2ContactID_features_flip_get if _newclass:flip = _swig_property(_Box2D2.b2ContactID_features_flip_get, _Box2D2.b2ContactID_features_flip_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2ContactID_features""" this = _Box2D2.new_b2ContactID_features(*args) try: self.this.append(this) @@ -499,7 +499,7 @@ class b2ManifoldPoint(_object): __swig_setmethods__["id"] = _Box2D2.b2ManifoldPoint_id_set __swig_getmethods__["id"] = _Box2D2.b2ManifoldPoint_id_get if _newclass:id = _swig_property(_Box2D2.b2ManifoldPoint_id_get, _Box2D2.b2ManifoldPoint_id_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2ManifoldPoint""" this = _Box2D2.new_b2ManifoldPoint(*args) try: self.this.append(this) @@ -525,7 +525,7 @@ class b2Manifold(_object): __swig_setmethods__["pointCount"] = _Box2D2.b2Manifold_pointCount_set __swig_getmethods__["pointCount"] = _Box2D2.b2Manifold_pointCount_get if _newclass:pointCount = _swig_property(_Box2D2.b2Manifold_pointCount_get, _Box2D2.b2Manifold_pointCount_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2Manifold""" this = _Box2D2.new_b2Manifold(*args) try: self.this.append(this) @@ -552,7 +552,7 @@ class b2Segment(_object): __swig_setmethods__["p2"] = _Box2D2.b2Segment_p2_set __swig_getmethods__["p2"] = _Box2D2.b2Segment_p2_get if _newclass:p2 = _swig_property(_Box2D2.b2Segment_p2_get, _Box2D2.b2Segment_p2_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2Segment""" this = _Box2D2.new_b2Segment(*args) try: self.this.append(this) @@ -579,7 +579,7 @@ class b2AABB(_object): __swig_setmethods__["upperBound"] = _Box2D2.b2AABB_upperBound_set __swig_getmethods__["upperBound"] = _Box2D2.b2AABB_upperBound_get if _newclass:upperBound = _swig_property(_Box2D2.b2AABB_upperBound_get, _Box2D2.b2AABB_upperBound_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2AABB""" this = _Box2D2.new_b2AABB(*args) try: self.this.append(this) @@ -605,7 +605,7 @@ class b2OBB(_object): __swig_setmethods__["extents"] = _Box2D2.b2OBB_extents_set __swig_getmethods__["extents"] = _Box2D2.b2OBB_extents_get if _newclass:extents = _swig_property(_Box2D2.b2OBB_extents_get, _Box2D2.b2OBB_extents_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2OBB""" this = _Box2D2.new_b2OBB(*args) try: self.this.append(this) @@ -618,21 +618,21 @@ b2OBB_swigregister(b2OBB) def b2CollideCircles(*args): """ - b2CollideCircles(b2Manifold manifold, b2CircleShape circle1, b2XForm xf1, + b2CollideCircles(b2Manifold manifold, b2CircleShape circle1, b2XForm xf1, b2CircleShape circle2, b2XForm xf2) """ return _Box2D2.b2CollideCircles(*args) def b2CollidePolygonAndCircle(*args): """ - b2CollidePolygonAndCircle(b2Manifold manifold, b2PolygonShape polygon, b2XForm xf1, + b2CollidePolygonAndCircle(b2Manifold manifold, b2PolygonShape polygon, b2XForm xf1, b2CircleShape circle, b2XForm xf2) """ return _Box2D2.b2CollidePolygonAndCircle(*args) def b2CollidePolygons(*args): """ - b2CollidePolygons(b2Manifold manifold, b2PolygonShape polygon1, b2XForm xf1, + b2CollidePolygons(b2Manifold manifold, b2PolygonShape polygon1, b2XForm xf1, b2PolygonShape polygon2, b2XForm xf2) """ return _Box2D2.b2CollidePolygons(*args) @@ -660,7 +660,7 @@ class b2MassData(_object): __swig_setmethods__["I"] = _Box2D2.b2MassData_I_set __swig_getmethods__["I"] = _Box2D2.b2MassData_I_get if _newclass:I = _swig_property(_Box2D2.b2MassData_I_get, _Box2D2.b2MassData_I_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2MassData""" this = _Box2D2.new_b2MassData(*args) try: self.this.append(this) @@ -673,7 +673,7 @@ b2MassData_swigregister(b2MassData) def b2Distance(*args): """ b2Distance(b2Vec2 a, b2Vec2 b) -> float32 - b2Distance(b2Vec2 x1, b2Vec2 x2, b2Shape shape1, b2XForm xf1, + b2Distance(b2Vec2 x1, b2Vec2 x2, b2Shape shape1, b2XForm xf1, b2Shape shape2, b2XForm xf2) -> float32 """ return _Box2D2.b2Distance(*args) @@ -689,7 +689,7 @@ class b2ShapeDef(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2ShapeDef, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2ShapeDef""" this = _Box2D2.new_b2ShapeDef(*args) try: self.this.append(this) @@ -760,7 +760,7 @@ class b2Shape(_object): def TestSegment(*args): """ - TestSegment(self, b2XForm xf, float32 lambda, b2Vec2 normal, b2Segment segment, + TestSegment(self, b2XForm xf, float32 lambda, b2Vec2 normal, b2Segment segment, float32 maxLambda) -> bool """ return _Box2D2.b2Shape_TestSegment(*args) @@ -894,7 +894,7 @@ class b2CircleDef(b2ShapeDef): for _s in [b2ShapeDef]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, b2CircleDef, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2CircleDef""" this = _Box2D2.new_b2CircleDef(*args) try: self.this.append(this) @@ -925,7 +925,7 @@ class b2CircleShape(b2Shape): def TestSegment(*args): """ - TestSegment(self, b2XForm transform, float32 lambda, b2Vec2 normal, b2Segment segment, + TestSegment(self, b2XForm transform, float32 lambda, b2Vec2 normal, b2Segment segment, float32 maxLambda) -> bool """ return _Box2D2.b2CircleShape_TestSegment(*args) @@ -950,7 +950,7 @@ class b2CircleShape(b2Shape): """GetRadius(self) -> float32""" return _Box2D2.b2CircleShape_GetRadius(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self, b2ShapeDef def) -> b2CircleShape""" this = _Box2D2.new_b2CircleShape(*args) try: self.this.append(this) @@ -979,7 +979,7 @@ class b2PolygonDef(b2ShapeDef): for _s in [b2ShapeDef]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, b2PolygonDef, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2PolygonDef""" this = _Box2D2.new_b2PolygonDef(*args) try: self.this.append(this) @@ -1025,7 +1025,7 @@ class b2PolygonShape(b2Shape): def TestSegment(*args): """ - TestSegment(self, b2XForm transform, float32 lambda, b2Vec2 normal, b2Segment segment, + TestSegment(self, b2XForm transform, float32 lambda, b2Vec2 normal, b2Segment segment, float32 maxLambda) -> bool """ return _Box2D2.b2PolygonShape_TestSegment(*args) @@ -1062,7 +1062,7 @@ class b2PolygonShape(b2Shape): """GetCoreVertices(self) -> b2Vec2""" return _Box2D2.b2PolygonShape_GetCoreVertices(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self, b2ShapeDef def) -> b2PolygonShape""" this = _Box2D2.new_b2PolygonShape(*args) try: self.this.append(this) @@ -1170,7 +1170,7 @@ class b2Pair(_object): __swig_setmethods__["status"] = _Box2D2.b2Pair_status_set __swig_getmethods__["status"] = _Box2D2.b2Pair_status_get if _newclass:status = _swig_property(_Box2D2.b2Pair_status_get, _Box2D2.b2Pair_status_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2Pair""" this = _Box2D2.new_b2Pair(*args) try: self.this.append(this) @@ -1197,7 +1197,7 @@ class b2BufferedPair(_object): __swig_setmethods__["proxyId2"] = _Box2D2.b2BufferedPair_proxyId2_set __swig_getmethods__["proxyId2"] = _Box2D2.b2BufferedPair_proxyId2_get if _newclass:proxyId2 = _swig_property(_Box2D2.b2BufferedPair_proxyId2_get, _Box2D2.b2BufferedPair_proxyId2_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2BufferedPair""" this = _Box2D2.new_b2BufferedPair(*args) try: self.this.append(this) @@ -1235,7 +1235,7 @@ class b2PairManager(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2PairManager, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2PairManager""" this = _Box2D2.new_b2PairManager(*args) try: self.this.append(this) @@ -1309,7 +1309,7 @@ class b2Bound(_object): __swig_setmethods__["stabbingCount"] = _Box2D2.b2Bound_stabbingCount_set __swig_getmethods__["stabbingCount"] = _Box2D2.b2Bound_stabbingCount_get if _newclass:stabbingCount = _swig_property(_Box2D2.b2Bound_stabbingCount_get, _Box2D2.b2Bound_stabbingCount_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2Bound""" this = _Box2D2.new_b2Bound(*args) try: self.this.append(this) @@ -1355,7 +1355,7 @@ class b2Proxy(_object): __swig_setmethods__["userData"] = _Box2D2.b2Proxy_userData_set __swig_getmethods__["userData"] = _Box2D2.b2Proxy_userData_get if _newclass:userData = _swig_property(_Box2D2.b2Proxy_userData_get, _Box2D2.b2Proxy_userData_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2Proxy""" this = _Box2D2.new_b2Proxy(*args) try: self.this.append(this) @@ -1372,7 +1372,7 @@ class b2BroadPhase(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2BroadPhase, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self, b2AABB worldAABB, b2PairCallback callback) -> b2BroadPhase""" this = _Box2D2.new_b2BroadPhase(*args) try: self.this.append(this) @@ -1467,7 +1467,7 @@ class b2DestructionListener(_object): """ return _Box2D2.b2DestructionListener_SayGoodbye(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2DestructionListener""" if self.__class__ == b2DestructionListener: args = (None,) + args @@ -1496,7 +1496,7 @@ class b2BoundaryListener(_object): """Violation(self, b2Body body)""" return _Box2D2.b2BoundaryListener_Violation(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2BoundaryListener""" if self.__class__ == b2BoundaryListener: args = (None,) + args @@ -1525,7 +1525,7 @@ class b2ContactFilter(_object): """ShouldCollide(self, b2Shape shape1, b2Shape shape2) -> bool""" return _Box2D2.b2ContactFilter_ShouldCollide(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2ContactFilter""" this = _Box2D2.new_b2ContactFilter(*args) try: self.this.append(this) @@ -1554,7 +1554,7 @@ class b2ContactListener(_object): """Remove(self, b2ContactPoint point)""" return _Box2D2.b2ContactListener_Remove(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2ContactListener""" if self.__class__ == b2ContactListener: args = (None,) + args @@ -1577,7 +1577,7 @@ class b2Color(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2Color, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """ __init__(self) -> b2Color __init__(self, float32 r, float32 g, float32 b) -> b2Color @@ -1606,7 +1606,7 @@ class b2DebugDraw(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2DebugDraw, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2DebugDraw""" if self.__class__ == b2DebugDraw: args = (None,) + args @@ -1678,7 +1678,7 @@ class b2BlockAllocator(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2BlockAllocator, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2BlockAllocator""" this = _Box2D2.new_b2BlockAllocator(*args) try: self.this.append(this) @@ -1720,7 +1720,7 @@ class b2StackEntry(_object): __swig_setmethods__["usedMalloc"] = _Box2D2.b2StackEntry_usedMalloc_set __swig_getmethods__["usedMalloc"] = _Box2D2.b2StackEntry_usedMalloc_get if _newclass:usedMalloc = _swig_property(_Box2D2.b2StackEntry_usedMalloc_get, _Box2D2.b2StackEntry_usedMalloc_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2StackEntry""" this = _Box2D2.new_b2StackEntry(*args) try: self.this.append(this) @@ -1739,7 +1739,7 @@ class b2StackAllocator(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2StackAllocator, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2StackAllocator""" this = _Box2D2.new_b2StackAllocator(*args) try: self.this.append(this) @@ -1777,7 +1777,7 @@ class b2ContactRegister(_object): __swig_setmethods__["primary"] = _Box2D2.b2ContactRegister_primary_set __swig_getmethods__["primary"] = _Box2D2.b2ContactRegister_primary_get if _newclass:primary = _swig_property(_Box2D2.b2ContactRegister_primary_get, _Box2D2.b2ContactRegister_primary_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2ContactRegister""" this = _Box2D2.new_b2ContactRegister(*args) try: self.this.append(this) @@ -1806,7 +1806,7 @@ class b2ContactEdge(_object): __swig_setmethods__["next"] = _Box2D2.b2ContactEdge_next_set __swig_getmethods__["next"] = _Box2D2.b2ContactEdge_next_get if _newclass:next = _swig_property(_Box2D2.b2ContactEdge_next_get, _Box2D2.b2ContactEdge_next_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2ContactEdge""" this = _Box2D2.new_b2ContactEdge(*args) try: self.this.append(this) @@ -1850,7 +1850,7 @@ class b2ContactPoint(_object): def __repr__(self): return "b2ContactPoint(\n\tShape1: %s\n\tShape2:%s\n\tPosition: %s\n\tNormal: %s)" % (self.shape1, self.shape2, self.position, self.normal) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2ContactPoint""" this = _Box2D2.new_b2ContactPoint(*args) try: self.this.append(this) @@ -1898,7 +1898,7 @@ class b2Contact(_object): e_toiFlag = _Box2D2.b2Contact_e_toiFlag def AddType(*args): """ - AddType(b2ContactCreateFcn createFcn, b2ContactDestroyFcn destroyFcn, + AddType(b2ContactCreateFcn createFcn, b2ContactDestroyFcn destroyFcn, b2ShapeType type1, b2ShapeType type2) """ return _Box2D2.b2Contact_AddType(*args) @@ -1977,7 +1977,7 @@ b2Contact_swigregister(b2Contact) def b2Contact_AddType(*args): """ - b2Contact_AddType(b2ContactCreateFcn createFcn, b2ContactDestroyFcn destroyFcn, + b2Contact_AddType(b2ContactCreateFcn createFcn, b2ContactDestroyFcn destroyFcn, b2ShapeType type1, b2ShapeType type2) """ return _Box2D2.b2Contact_AddType(*args) @@ -2003,7 +2003,7 @@ class b2NullContact(b2Contact): for _s in [b2Contact]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, b2NullContact, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2NullContact""" this = _Box2D2.new_b2NullContact(*args) try: self.this.append(this) @@ -2030,7 +2030,7 @@ class b2ContactManager(b2PairCallback): for _s in [b2PairCallback]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, b2ContactManager, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2ContactManager""" this = _Box2D2.new_b2ContactManager(*args) try: self.this.append(this) @@ -2081,7 +2081,7 @@ class b2TimeStep(_object): __swig_setmethods__["maxIterations"] = _Box2D2.b2TimeStep_maxIterations_set __swig_getmethods__["maxIterations"] = _Box2D2.b2TimeStep_maxIterations_get if _newclass:maxIterations = _swig_property(_Box2D2.b2TimeStep_maxIterations_get, _Box2D2.b2TimeStep_maxIterations_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2TimeStep""" this = _Box2D2.new_b2TimeStep(*args) try: self.this.append(this) @@ -2098,7 +2098,7 @@ class b2World(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2World, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self, b2AABB worldAABB, b2Vec2 gravity, bool doSleep) -> b2World""" this = _Box2D2.new_b2World(*args) try: self.this.append(this) @@ -2299,7 +2299,7 @@ class b2Jacobian(_object): """Compute(self, b2Vec2 x1, float32 a1, b2Vec2 x2, float32 a2) -> float32""" return _Box2D2.b2Jacobian_Compute(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2Jacobian""" this = _Box2D2.new_b2Jacobian(*args) try: self.this.append(this) @@ -2328,7 +2328,7 @@ class b2JointEdge(_object): __swig_setmethods__["next"] = _Box2D2.b2JointEdge_next_set __swig_getmethods__["next"] = _Box2D2.b2JointEdge_next_get if _newclass:next = _swig_property(_Box2D2.b2JointEdge_next_get, _Box2D2.b2JointEdge_next_set) - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2JointEdge""" this = _Box2D2.new_b2JointEdge(*args) try: self.this.append(this) @@ -2345,7 +2345,7 @@ class b2JointDef(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2JointDef, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2JointDef""" this = _Box2D2.new_b2JointDef(*args) try: self.this.append(this) @@ -2478,7 +2478,7 @@ class b2Joint(_object): return "b2Joint(body1: %s body2: %s)" % (self.body1, self.body2) def typeName(self): types = { e_unknownJoint : "Unknown", - e_mouseJoint : "Mouse", + e_mouseJoint : "Mouse", e_gearJoint : "Gear", e_distanceJoint : "Distance", e_prismaticJoint: "Prismatic", @@ -2531,7 +2531,7 @@ class b2BodyDef(_object): __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, b2BodyDef, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2BodyDef""" this = _Box2D2.new_b2BodyDef(*args) try: self.this.append(this) @@ -2731,7 +2731,7 @@ class b2Body(_object): e_staticType = _Box2D2.b2Body_e_staticType e_dynamicType = _Box2D2.b2Body_e_dynamicType e_maxTypes = _Box2D2.b2Body_e_maxTypes - def __init__(self, *args): + def __init__(self, *args): """__init__(self, b2BodyDef bd, uint16 type, b2World world) -> b2Body""" this = _Box2D2.new_b2Body(*args) try: self.this.append(this) @@ -2842,7 +2842,7 @@ class b2DistanceJointDef(b2JointDef): for _s in [b2JointDef]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, b2DistanceJointDef, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2DistanceJointDef""" this = _Box2D2.new_b2DistanceJointDef(*args) try: self.this.append(this) @@ -2890,7 +2890,7 @@ class b2DistanceJoint(b2Joint): """GetReactionTorque(self) -> float32""" return _Box2D2.b2DistanceJoint_GetReactionTorque(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self, b2DistanceJointDef data) -> b2DistanceJoint""" this = _Box2D2.new_b2DistanceJoint(*args) try: self.this.append(this) @@ -2939,7 +2939,7 @@ class b2MouseJointDef(b2JointDef): for _s in [b2JointDef]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, b2MouseJointDef, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2MouseJointDef""" this = _Box2D2.new_b2MouseJointDef(*args) try: self.this.append(this) @@ -2993,7 +2993,7 @@ class b2MouseJoint(b2Joint): """SetTarget(self, b2Vec2 target)""" return _Box2D2.b2MouseJoint_SetTarget(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self, b2MouseJointDef def) -> b2MouseJoint""" this = _Box2D2.new_b2MouseJoint(*args) try: self.this.append(this) @@ -3048,7 +3048,7 @@ class b2PrismaticJointDef(b2JointDef): for _s in [b2JointDef]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, b2PrismaticJointDef, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2PrismaticJointDef""" this = _Box2D2.new_b2PrismaticJointDef(*args) try: self.this.append(this) @@ -3169,7 +3169,7 @@ class b2PrismaticJoint(b2Joint): """GetMotorForce(self) -> float32""" return _Box2D2.b2PrismaticJoint_GetMotorForce(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self, b2PrismaticJointDef def) -> b2PrismaticJoint""" this = _Box2D2.new_b2PrismaticJoint(*args) try: self.this.append(this) @@ -3266,7 +3266,7 @@ class b2RevoluteJointDef(b2JointDef): for _s in [b2JointDef]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, b2RevoluteJointDef, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2RevoluteJointDef""" this = _Box2D2.new_b2RevoluteJointDef(*args) try: self.this.append(this) @@ -3384,7 +3384,7 @@ class b2RevoluteJoint(b2Joint): """GetMotorTorque(self) -> float32""" return _Box2D2.b2RevoluteJoint_GetMotorTorque(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self, b2RevoluteJointDef def) -> b2RevoluteJoint""" this = _Box2D2.new_b2RevoluteJoint(*args) try: self.this.append(this) @@ -3463,15 +3463,15 @@ class b2PulleyJointDef(b2JointDef): for _s in [b2JointDef]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, b2PulleyJointDef, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2PulleyJointDef""" this = _Box2D2.new_b2PulleyJointDef(*args) try: self.this.append(this) except: self.this = this def Initialize(*args): """ - Initialize(self, b2Body body1, b2Body body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, - b2Vec2 anchor1, b2Vec2 anchor2, + Initialize(self, b2Body body1, b2Body body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, + b2Vec2 anchor1, b2Vec2 anchor2, float32 ratio) """ return _Box2D2.b2PulleyJointDef_Initialize(*args) @@ -3554,7 +3554,7 @@ class b2PulleyJoint(b2Joint): """GetRatio(self) -> float32""" return _Box2D2.b2PulleyJoint_GetRatio(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self, b2PulleyJointDef data) -> b2PulleyJoint""" this = _Box2D2.new_b2PulleyJoint(*args) try: self.this.append(this) @@ -3654,7 +3654,7 @@ class b2GearJointDef(b2JointDef): for _s in [b2JointDef]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{})) __getattr__ = lambda self, name: _swig_getattr(self, b2GearJointDef, name) __repr__ = _swig_repr - def __init__(self, *args): + def __init__(self, *args): """__init__(self) -> b2GearJointDef""" this = _Box2D2.new_b2GearJointDef(*args) try: self.this.append(this) @@ -3702,7 +3702,7 @@ class b2GearJoint(b2Joint): """GetRatio(self) -> float32""" return _Box2D2.b2GearJoint_GetRatio(*args) - def __init__(self, *args): + def __init__(self, *args): """__init__(self, b2GearJointDef data) -> b2GearJoint""" this = _Box2D2.new_b2GearJoint(*args) try: self.this.append(this) diff --git a/library/pippy/physics/add_objects.py b/library/pippy/physics/add_objects.py index 66f3b8f..1c22c16 100644 --- a/library/pippy/physics/add_objects.py +++ b/library/pippy/physics/add_objects.py @@ -8,7 +8,7 @@ Home: http://elements.linuxuser.at IRC: #elements on irc.freenode.org Code: http://www.assembla.com/wiki/show/elements - svn co http://svn2.assembla.com/svn/elements + svn co http://svn2.assembla.com/svn/elements License: GPLv3 | See LICENSE for the full text This program is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. +along with this program. If not, see <http://www.gnu.org/licenses/>. """ from locals import * from elements import box2d @@ -90,8 +90,8 @@ class Add: x, y = pos bodyDef = box2d.b2BodyDef() bodyDef.position.Set(x, y) - bodyDef.sleepFlag = True -# bodyDef.allowSleep(True) + bodyDef.sleepFlag = True + # bodyDef.allowSleep(True) userData = { 'color' : self.parent.get_color() } bodyDef.userData = userData @@ -112,9 +112,9 @@ class Add: circleDef.friction = friction body.CreateShape(circleDef) - body.SetMassFromShapes(); + body.SetMassFromShapes(); - return body + return body def rect(self, pos, width, height, angle=0, dynamic=True, density=1.0, restitution=0.16, friction=0.5, screenCoord=True): """ Add a dynamic rectangle with input unit according to self.input (INPUT_PIXELS or INPUT_METERS) @@ -147,22 +147,22 @@ class Add: def wall(self, pos1, pos2, width=5, density=1.0, restitution=0.16, friction=0.5, screenCoord=True): - """ Add a static rectangle between two arbitrary points with input unit according to self.input + """ Add a static rectangle between two arbitrary points with input unit according to self.input (INPUT_PIXELS or INPUT_METERS) Correcting the positions to meters and calling self._add_rect() Return: box2d.b2Body """ if width < 5: width = 5 - if (pos1[0] < pos2[0]): + if (pos1[0] < pos2[0]): x1, y1 = pos1 x2, y2 = pos2 else: x1, y1 = pos2 - x2, y2 = pos1 + x2, y2 = pos1 # Bring coordinates into the world coordinate system (flip, camera offset, ...) - if screenCoord: + if screenCoord: x1, y1 = self.parent.to_world((x1, y1)) x2, y2 = self.parent.to_world((x2, y2)) @@ -198,7 +198,7 @@ class Add: if not dynamic: density = 0 - bodyDef.sleepFlag = True + bodyDef.sleepFlag = True body = self.parent.world.CreateBody(bodyDef) @@ -227,14 +227,14 @@ class Add: other ... see [physics parameters] Return: box2d.b2Body - """ + """ # Bring coordinates into the world coordinate system (flip, camera offset, ...) if screenCoord: x, y = self.parent.to_world(pos) else: x, y = pos #pos, vertices, dynamic=True, density=1.0, restitution=0.16, friction=0. #5, screenCoord=True print "self.world.add.poly((", x,",", y, "), ", vertices, ", dynamic=True, density=1.0, restitution=0.16, friction=0.5, screenCoord=True)" -#"x = " x "y = " y "vertices = " +#"x = " x "y = " y "vertices = " # If required, translate pixel -> meters if self.parent.input == INPUT_PIXELS: # translate pixel -> meters @@ -256,7 +256,7 @@ class Add: x, y = pos bodyDef = box2d.b2BodyDef() bodyDef.position.Set(x, y) - bodyDef.sleepFlag = True + bodyDef.sleepFlag = True userData = { 'color' : self.parent.get_color() } bodyDef.userData = userData @@ -274,7 +274,7 @@ class Add: polyDef.vertexCount = len(vertices) for i in range(len(vertices)): vx, vy = vertices[i] - polyDef.setVertex(i, box2d.b2Vec2(vx, vy)) + polyDef.setVertex(i, box2d.b2Vec2(vx, vy)) polyDef.density = density polyDef.restitution = restitution @@ -286,9 +286,9 @@ class Add: return body def concavePoly(self, vertices, dynamic=True, density=1.0, restitution=0.16, friction=0.5, screenCoord=True): - # 1. Step: Reduce + # 1. Step: Reduce # Detect if the polygon is closed or open - if vertices[0] != vertices[-1]: + if vertices[0] != vertices[-1]: is_closed = False else: is_closed = True @@ -310,8 +310,8 @@ class Add: # Let's add the body bodyDef = box2d.b2BodyDef() bodyDef.position.Set(x, y) - bodyDef.sleepFlag = True - + bodyDef.sleepFlag = True + userData = { 'color' : self.parent.get_color() } bodyDef.userData = userData @@ -336,7 +336,7 @@ class Add: circleDef.restitution = restitution circleDef.friction = friction - # Set the scale factor + # Set the scale factor factor = 8.0 v2 = box2d.b2Vec2().fromTuple(vertices[0]) @@ -350,10 +350,10 @@ class Add: # we need a little size for the end part vn = box2d.b2Vec2(-vdir.y*factor, vdir.x*factor) - v = [ v1+vn, v1-vn, v2-vn, v2+vn ] + v = [ v1+vn, v1-vn, v2-vn, v2+vn ] - # Create a line (rect) for each part of the polygon, - # and attach it to the body + # Create a line (rect) for each part of the polygon, + # and attach it to the body for i in range(len(v)): polyDef.setVertex(i, v[i] / self.parent.ppm) @@ -370,10 +370,10 @@ class Add: break circleDef.localPosition = v2 / self.parent.ppm - body.CreateShape(circleDef) + body.CreateShape(circleDef) # Now, all shapes have been attached - body.SetMassFromShapes() + body.SetMassFromShapes() # Return hard and soft reduced vertices return body @@ -383,7 +383,7 @@ class Add: # 2. Step: See if start and end are close, if so then close the polygon # 3. Step: Detect if convex or concave # 4. Step: Start self.convexPoly or self.concavePoly - vertices, is_convex = tools_poly.reduce_poly_by_angle(vertices) + vertices, is_convex = tools_poly.reduce_poly_by_angle(vertices) #print "->", is_convex # If start and endpoints are close to each other, close polygon @@ -409,13 +409,13 @@ class Add: return self.convexPoly(vertices, dynamic, density, restitution, friction), vertices else: print "concave" - return self.concavePoly(vertices, dynamic, density, restitution, friction), vertices + return self.concavePoly(vertices, dynamic, density, restitution, friction), vertices def convexPoly(self, vertices, dynamic=True, density=1.0, restitution=0.16, friction=0.5): """ Add a complex polygon with vertices in absolute positions (meters or pixels, according - to INPUT_PIXELS or INPUT_METERS). This function does the reduction and convec hulling - of the poly, and calls add_poly(...) + to INPUT_PIXELS or INPUT_METERS). This function does the reduction and convec hulling + of the poly, and calls add_poly(...) Parameters: vertices .. absolute vertices positions @@ -429,7 +429,7 @@ class Add: tolerance = 10 #5 v_new = vertices while len(v_new) > box2d.b2_maxPolygonVertices: - tolerance += 1 + tolerance += 1 v_new = tools_poly.reduce_poly(vertices, tolerance) print "convexPoly: Polygon reduced from %i to %i vertices | tolerance: %i" % (len(vertices), len(v_new), tolerance) @@ -437,13 +437,13 @@ class Add: # So poly should be alright now # Continue reducing the vertecs - vertices_orig_reduced = vertices + vertices_orig_reduced = vertices vertices = tools_poly.poly_center_vertices(vertices) vertices = tools_poly.convex_hull(vertices) - if len(vertices) < 3: - return + if len(vertices) < 3: + return # Define the body x, y = c = tools_poly.calc_center(vertices_orig_reduced) @@ -455,24 +455,24 @@ class Add: ptx /= self.parent.ppm pty /= self.parent.ppm pt = box2d.b2Vec2(ptx, pty) - return pt + return pt # Alex Levenson's added joint methods: def distanceJoint(self,b1,b2,p1,p2): # Distance Joint - p1 = self.to_b2vec(p1) - p2 = self.to_b2vec(p2) + p1 = self.to_b2vec(p1) + p2 = self.to_b2vec(p2) jointDef = box2d.b2DistanceJointDef() jointDef.Initialize(b1, b2, p1, p2) - jointDef.collideConnected = True + jointDef.collideConnected = True self.parent.world.CreateJoint(jointDef) def fixedJoint(self, *args): - if len(args) == 2: + if len(args) == 2: # Fixed Joint to the Background, don't assume the center of the body b1 = self.parent.world.GetGroundBody() b2 = args[0] - p1 = self.to_b2vec(args[1]) + p1 = self.to_b2vec(args[1]) jointDef = box2d.b2RevoluteJointDef() jointDef.Initialize(b1, b2, p1) @@ -486,11 +486,11 @@ class Add: jointDef = box2d.b2RevoluteJointDef() jointDef.Initialize(b1, b2, p1) - self.parent.world.CreateJoint(jointDef) + self.parent.world.CreateJoint(jointDef) def revoluteJoint(self,b1,b2,p1): # revolute joint between to bodies - p1 = self.to_b2vec(p1) + p1 = self.to_b2vec(p1) jointDef = box2d.b2RevoluteJointDef() jointDef.Initialize(b1, b2, p1) @@ -521,10 +521,10 @@ class Add: self.parent.world.CreateJoint(jointDef) - def motor(self, body,pt,torque=900,speed=-10): + def motor(self, body,pt,torque=900,speed=-10): # Fixed Joint to the Background with a motor on it b1 = self.parent.world.GetGroundBody() - pt = self.to_b2vec(pt) + pt = self.to_b2vec(pt) jointDef = box2d.b2RevoluteJointDef() jointDef.Initialize(b1, body, pt) @@ -537,16 +537,16 @@ class Add: # jointDef = box2d.b2RevoluteJointDef() # jointDef.Initialize(b1, b2, p1) # jointDef. - # - def joint(self, *args): + # + def joint(self, *args): print "* Add Joint:", args if len(args) == 4: # Distance Joint b1, b2, p1, p2 = args - p1 = self.parent.to_world(p1) - p2 = self.parent.to_world(p2) + p1 = self.parent.to_world(p1) + p2 = self.parent.to_world(p2) p1x, p1y = p1 p2x, p2y = p2 @@ -563,7 +563,7 @@ class Add: jointDef.Initialize(b1, b2, p1, p2) jointDef.collideConnected = True - self.parent.world.CreateJoint(jointDef) + self.parent.world.CreateJoint(jointDef) elif len(args) == 3: # Revolute Joint diff --git a/library/pippy/physics/callbacks.py b/library/pippy/physics/callbacks.py index 5402869..e0b1091 100755 --- a/library/pippy/physics/callbacks.py +++ b/library/pippy/physics/callbacks.py @@ -8,7 +8,7 @@ Home: http://elements.linuxuser.at IRC: #elements on irc.freenode.org Code: http://www.assembla.com/wiki/show/elements - svn co http://svn2.assembla.com/svn/elements + svn co http://svn2.assembla.com/svn/elements License: GPLv3 | See LICENSE for the full text This program is free software: you can redistribute it and/or modify @@ -22,20 +22,20 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. +along with this program. If not, see <http://www.gnu.org/licenses/>. """ from locals import * from elements import box2d class CallbackHandler: - # List of contact callbacks and shapes to start them - sorted by type for quicker access + # List of contact callbacks and shapes to start them - sorted by type for quicker access # Callbacks are saved as callbacks[callback_type][[function, parameters], ...] - callbacks = {} + callbacks = {} def __init__(self, parent): self.parent = parent - # init callback dict to avoid those slow try + # init callback dict to avoid those slow try # (especially for self.get, as it is called *often*) for i in xrange(10): self.callbacks[i] = [] @@ -79,7 +79,7 @@ class CallbackHandler: callback() class kContactListener(box2d.b2ContactListener): - def __init__(self, get_callbacks): + def __init__(self, get_callbacks): # Init the Box2D b2ContactListener box2d.b2ContactListener.__init__(self) @@ -94,7 +94,7 @@ class kContactListener(box2d.b2ContactListener): for c in contacts: callback, bodylist = c if len(bodylist) == 0: - # Without bodylist it's a universal callback (for all bodies) + # Without bodylist it's a universal callback (for all bodies) callback(point) else: @@ -104,7 +104,7 @@ class kContactListener(box2d.b2ContactListener): b2 = str(point.shape2.GetBody()) for s in bodylist: s = str(s) - if b1 == s or b2 == s: + if b1 == s or b2 == s: # Yes, that's the one :) callback(point) diff --git a/library/pippy/physics/camera.py b/library/pippy/physics/camera.py index c45b27d..553b582 100755 --- a/library/pippy/physics/camera.py +++ b/library/pippy/physics/camera.py @@ -8,7 +8,7 @@ Home: http://elements.linuxuser.at IRC: #elements on irc.freenode.org Code: http://www.assembla.com/wiki/show/elements - svn co http://svn2.assembla.com/svn/elements + svn co http://svn2.assembla.com/svn/elements License: GPLv3 | See LICENSE for the full text This program is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. +along with this program. If not, see <http://www.gnu.org/licenses/>. """ from locals import * @@ -59,7 +59,7 @@ class Camera: Typical call: world.camera.center(event.pos) Problem: Works ONLY WITH screenCoord now! - """ + """ x, y = pos x -= self.parent.display_width / 2 @@ -73,7 +73,7 @@ class Camera: self.inc_offset((x, y), screenCoord, stopTrack) def set_offset(self, offset, screenCoord=True, stopTrack=True): - """ Set an offset from the screen to the world cs + """ Set an offset from the screen to the world cs -- in screen (or world) coordinates and in pixel """ # Stop tracking of an object @@ -107,7 +107,7 @@ class Camera: """ Set the screen offset to the world coordinate system (using meters and the world coordinate system's orientation) """ - x, y = offset + x, y = offset self.parent.screen_offset = (x, y) self.parent.screen_offset_pixel = (x*self.parent.ppm, y*self.parent.ppm) diff --git a/library/pippy/physics/drawing.py b/library/pippy/physics/drawing.py index a537125..d70c9bc 100755 --- a/library/pippy/physics/drawing.py +++ b/library/pippy/physics/drawing.py @@ -8,7 +8,7 @@ Home: http://elements.linuxuser.at IRC: #elements on irc.freenode.org Code: http://www.assembla.com/wiki/show/elements - svn co http://svn2.assembla.com/svn/elements + svn co http://svn2.assembla.com/svn/elements License: GPLv3 | See LICENSE for the full text This program is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. +along with this program. If not, see <http://www.gnu.org/licenses/>. """ from math import pi from math import cos @@ -31,7 +31,7 @@ from math import sqrt import tools -# Functions of a rendering class +# Functions of a rendering class # mandatory: # __init__ # start_drawing @@ -47,7 +47,7 @@ import tools # for cairo: # draw_text # for opengl: -# +# # IMPORTANT # The drawing functions get the coordinates in their screen coordinate system @@ -65,11 +65,11 @@ class draw_pygame(object): Parameters: surface .... pygame surface (default: None) - lineWidth .. + lineWidth .. Return: Class draw_pygame() """ - print "* Pygame selected as renderer" + print "* Pygame selected as renderer" from pygame import draw from pygame import Rect @@ -103,7 +103,7 @@ class draw_pygame(object): Parameters: pt ........ (x, y) clr ....... color in rgb ((r), (g), (b)) - radius .... circle radius + radius .... circle radius angle ..... rotation in radians Return: - @@ -146,7 +146,7 @@ class draw_pygame(object): """ if width == None: lw = self.lineWidth - else: + else: lw = width self.draw.lines(self.surface, clr, closed, points, lw) @@ -173,12 +173,12 @@ class draw_cairo(object): #self.draw_box = self.draw_box_image def set_lineWidth(self, lw): # unused - self.lineWidth = lw + self.lineWidth = lw def set_drawing_area(self, da): """ Set the area for Cairo to draw to - da ...... drawing area (gtk.DrawingArea) + da ...... drawing area (Gtk.DrawingArea) Return: - """ @@ -267,7 +267,7 @@ class draw_cairo(object): points .... polygon points in normal (x,y) positions Return: - - """ + """ clr = tools.rgb2floats(clr) self.ctx.set_source_rgb(clr[0], clr[1], clr[2]) @@ -296,7 +296,7 @@ class draw_cairo(object): closed .... whether or not to close the lines (as a polygon) points .... polygon points in normal (x,y) positions Return: - - """ + """ clr = tools.rgb2floats(clr) self.ctx.set_source_rgb(clr[0], clr[1], clr[2]) @@ -320,7 +320,7 @@ class draw_opengl_pyglet(object): Parameters: surface .... not used with pyglet - lineWidth .. + lineWidth .. """ print "* OpenGL_Pyglet selected as renderer" @@ -332,23 +332,23 @@ class draw_opengl_pyglet(object): def draw_circle(self, clr, pt, radius, a=0): clr = tools.rgb2floats(clr) - self.gl.glColor3f(clr[0], clr[1], clr[2]) + self.gl.glColor3f(clr[0], clr[1], clr[2]) x, y = pt - segs = 15 - coef = 2.0*pi/segs; - - self.gl.glBegin(self.gl.GL_LINE_LOOP) - for n in range(segs): - rads = n*coef - self.gl.glVertex2f(radius*cos(rads + a) + x, radius*sin(rads + a) + y) - self.gl.glVertex2f(x,y) - self.gl.glEnd() + segs = 15 + coef = 2.0*pi/segs; + + self.gl.glBegin(self.gl.GL_LINE_LOOP) + for n in range(segs): + rads = n*coef + self.gl.glVertex2f(radius*cos(rads + a) + x, radius*sin(rads + a) + y) + self.gl.glVertex2f(x,y) + self.gl.glEnd() def draw_polygon(self, clr, points): clr = tools.rgb2floats(clr) - self.gl.glColor3f(clr[0], clr[1], clr[2]) - + self.gl.glColor3f(clr[0], clr[1], clr[2]) + self.gl.glBegin(self.gl.GL_LINES) p1 = points[0] diff --git a/library/pippy/physics/elements.py b/library/pippy/physics/elements.py index 1e821b3..81a7752 100644 --- a/library/pippy/physics/elements.py +++ b/library/pippy/physics/elements.py @@ -9,7 +9,7 @@ Home: http://elements.linuxuser.at IRC: #elements on irc.freenode.org Code: http://www.assembla.com/wiki/show/elements - svn co http://svn2.assembla.com/svn/elements + svn co http://svn2.assembla.com/svn/elements License: GPLv3 | See LICENSE for the full text This program is free software: you can redistribute it and/or modify @@ -23,7 +23,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. +along with this program. If not, see <http://www.gnu.org/licenses/>. """ __version__= '0.1' __contact__ = '<elements@linuxuser.at>' @@ -50,7 +50,7 @@ class Elements: """ # Settings run_physics = True # Can pause the simulation - element_count = 0 # Element Count + element_count = 0 # Element Count renderer = None # Drawing class (from drawing.py) input = INPUT_PIXELS # Default Input in Pixels! (can change to INPUT_METERS) line_width = 0 # Line Width in Pixels (0 for fill) @@ -99,7 +99,7 @@ class Elements: # Create the World self.world = box2d.b2World(self.worldAABB, self.gravity, self.doSleep) - # Init Colors + # Init Colors self.init_colors() # Set Pixels per Meter @@ -123,7 +123,7 @@ class Elements: top .... True or False -- y = 0 is at the top? Return: - - """ + """ self.inputAxis_x_left = not left self.inputAxis_y_down = top @@ -145,7 +145,7 @@ class Elements: def set_screenSize(self, size): """ Set the current screen size - Parameters: + Parameters: size ... (int(width), int(height)) in pixels Return: - @@ -155,7 +155,7 @@ class Elements: def init_colors(self): """ Init self.colors with a fix set of hex colors - Return: - + Return: - """ self.fixed_color = None self.cur_color = 0 @@ -166,9 +166,9 @@ class Elements: shuffle(self.colors) def set_color(self, clr): - """ Set a fixed color for all future Elements (until reset_color() is called) + """ Set a fixed color for all future Elements (until reset_color() is called) - Parameters: + Parameters: clr ... Hex '#123123' or RGB ((r), (g), (b)) Return: - @@ -178,19 +178,19 @@ class Elements: def reset_color(self): """ All Elements from now on will be drawn in random colors - Return: - + Return: - """ self.fixed_color = None def get_color(self): - """ Get a color - either the fixed one or the next from self.colors + """ Get a color - either the fixed one or the next from self.colors - Return: clr = ((R), (G), (B)) + Return: clr = ((R), (G), (B)) """ if self.fixed_color != None: return self.fixed_color - if self.cur_color == len(self.colors): + if self.cur_color == len(self.colors): self.cur_color = 0 shuffle(self.colors) @@ -215,7 +215,7 @@ class Elements: def translate_coord(self, point): """ Flips the coordinates in another coordinate system orientation, if necessary - (screen <> world coordinate system) + (screen <> world coordinate system) """ x, y = point @@ -228,10 +228,10 @@ class Elements: return (x, y) def translate_coords(self, pointlist): - """ Flips the coordinates in another coordinate system orientation, if necessary - (screen <> world coordinate system) - """ - p_out = [] + """ Flips the coordinates in another coordinate system orientation, if necessary + (screen <> world coordinate system) + """ + p_out = [] for p in pointlist: p_out.append(self.translate_coord(p)) return p_out @@ -247,7 +247,7 @@ class Elements: y = pos[1] / self.camera.scale_factor x, y = self.translate_coord((round(x), round(y))) - return (x+dx, y+dy) + return (x+dx, y+dy) def to_screen(self, pos): """ Transfers a coordinate from the world to the screen coordinate system (pixels) @@ -303,22 +303,22 @@ class Elements: """ self.callbacks.start(CALLBACK_DRAWING_START) - # No need to run through the loop if there's no way to draw - if not self.renderer: + # No need to run through the loop if there's no way to draw + if not self.renderer: return False if self.camera.track_body: # Get Body Center - p1 = self.camera.track_body.GetWorldCenter() + p1 = self.camera.track_body.GetWorldCenter() # Center the Camera There, False = Don't stop the tracking - self.camera.center(self.to_screen((p1.x*self.ppm, p1.y*self.ppm)), stopTrack=False) + self.camera.center(self.to_screen((p1.x*self.ppm, p1.y*self.ppm)), stopTrack=False) # Walk through all known elements body = self.world.GetBodyList() self.renderer.start_drawing() - while body: + while body: xform = body.GetXForm() shape = body.GetShapeList() angle = body.GetAngle() @@ -327,14 +327,14 @@ class Elements: userdata = body.GetUserData() clr = userdata['color'] - while shape: + while shape: type = shape.GetType() if type == box2d.e_circleShape: circle = shape.asCircle() position = box2d.b2Mul(xform, circle.GetLocalPosition()) - pos = self.to_screen((position.x*self.ppm, position.y*self.ppm)) + pos = self.to_screen((position.x*self.ppm, position.y*self.ppm)) self.renderer.draw_circle(clr, pos, self.meter_to_screen(circle.GetRadius()), angle) elif type == box2d.e_polygonShape: @@ -350,7 +350,7 @@ class Elements: else: print " unknown shape type:%d" % shape.GetType() - shape = shape.GetNext() + shape = shape.GetNext() body = body.GetNext() joint = self.world.GetJointList() diff --git a/library/pippy/physics/locals.py b/library/pippy/physics/locals.py index 85528f7..e69af24 100755 --- a/library/pippy/physics/locals.py +++ b/library/pippy/physics/locals.py @@ -8,7 +8,7 @@ Home: http://elements.linuxuser.at IRC: #elements on irc.freenode.org Code: http://www.assembla.com/wiki/show/elements - svn co http://svn2.assembla.com/svn/elements + svn co http://svn2.assembla.com/svn/elements License: GPLv3 | See LICENSE for the full text This program is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. +along with this program. If not, see <http://www.gnu.org/licenses/>. """ INPUT_METERS = 0 INPUT_PIXELS = 1 diff --git a/library/pippy/physics/menu.py b/library/pippy/physics/menu.py index 70d5b4b..4b6ab65 100644 --- a/library/pippy/physics/menu.py +++ b/library/pippy/physics/menu.py @@ -8,7 +8,7 @@ Home: http://elements.linuxuser.at IRC: #elements on irc.freenode.org Code: http://www.assembla.com/wiki/show/elements - svn co http://svn2.assembla.com/svn/elements + svn co http://svn2.assembla.com/svn/elements License: GPLv3 | See LICENSE for the full text This program is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. +along with this program. If not, see <http://www.gnu.org/licenses/>. """ import pygame from pygame.locals import * @@ -32,7 +32,7 @@ import tools COLOR_HEX_BLUE1 = "6491a4" COLOR_HEX_BLUE2 = "9ec9ff" -class MenuItem: +class MenuItem: # padding [px]: left, top, right, bottom padding = (5, 2, 5, 2) @@ -95,7 +95,7 @@ class MenuClass: focus = False # each item is stored as MenuItem - items = [] + items = [] # where to start drawing start_at = (0,0) @@ -127,7 +127,7 @@ class MenuClass: if parent: # Set the info that the item has a child to the parent item - self.items[parent-1].childs.append(len(self.items)-1) + self.items[parent-1].childs.append(len(self.items)-1) else: # New next drawing position @@ -135,7 +135,7 @@ class MenuClass: # Adjust the width of the menu bar if not self.setWidth: - self.width = x+w + self.width = x+w # Adjust the height of the menu bar if h > self.height: self.height = h + 2 @@ -161,7 +161,7 @@ class MenuClass: if len(item.childs) > 0: self.focus = i+1 - # Close any opened menu windows if clicked somewhere else + # Close any opened menu windows if clicked somewhere else if self.focus == focus_in: self.focus = False self.subwin_rect = (0,0,0,0) @@ -175,7 +175,7 @@ class MenuClass: if found: return True - else: + else: return False def draw(self, surface): @@ -188,7 +188,7 @@ class MenuClass: for i in xrange(len(self.items)): item = self.items[i] - if not item.parent: + if not item.parent: x,y,w,h = item.rect if self.focus == i+1: surface.blit(item.surface_active, (x,y)) @@ -212,7 +212,7 @@ class MenuClass: s = pygame.Surface((width, height)) s.fill(tools.hex2rgb(COLOR_HEX_BLUE1)) - # Parent Coordinates + # Parent Coordinates px, py, pw, ph = self.items[self.focus-1].rect # y Counter @@ -222,10 +222,10 @@ class MenuClass: item.visible = True s.blit(item.surface_inactive, (0, y)) - ix, iy, iw, ih = item.rect + ix, iy, iw, ih = item.rect if (ix, iy) == (0, 0): item.rect = item.rect.move((px, y+ph)) - ix, iy, iw, ih = item.rect + ix, iy, iw, ih = item.rect if iw < width: item.rect = (ix,iy,width,ih) diff --git a/library/pippy/physics/tools.py b/library/pippy/physics/tools.py index 9851ff8..9818638 100755 --- a/library/pippy/physics/tools.py +++ b/library/pippy/physics/tools.py @@ -8,7 +8,7 @@ Home: http://elements.linuxuser.at IRC: #elements on irc.freenode.org Code: http://www.assembla.com/wiki/show/elements - svn co http://svn2.assembla.com/svn/elements + svn co http://svn2.assembla.com/svn/elements License: GPLv3 | See LICENSE for the full text This program is free software: you can redistribute it and/or modify @@ -22,18 +22,18 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. +along with this program. If not, see <http://www.gnu.org/licenses/>. """ # Some Hex Tools def hex2dec(hex): """ Convert and hex value in a decimal number - """ + """ return int(hex, 16) -def hex2rgb(hex): +def hex2rgb(hex): """ Convert a hex color (#123abc) in RGB ((r), (g), (b)) """ - if hex[0:1] == '#': hex = hex[1:]; + if hex[0:1] == '#': hex = hex[1:]; return (hex2dec(hex[:2]), hex2dec(hex[2:4]), hex2dec(hex[4:6])) def rgb2floats(rgb): diff --git a/library/pippy/physics/tools_poly.py b/library/pippy/physics/tools_poly.py index 97a0cea..4885169 100755 --- a/library/pippy/physics/tools_poly.py +++ b/library/pippy/physics/tools_poly.py @@ -8,7 +8,7 @@ Home: http://elements.linuxuser.at IRC: #elements on irc.freenode.org Code: http://www.assembla.com/wiki/show/elements - svn co http://svn2.assembla.com/svn/elements + svn co http://svn2.assembla.com/svn/elements License: GPLv3 | See LICENSE for the full text This program is free software: you can redistribute it and/or modify @@ -22,7 +22,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. +along with this program. If not, see <http://www.gnu.org/licenses/>. """ from functools import partial @@ -55,7 +55,7 @@ def ComputeCentroid(pd): # Triangle vertices. p1 = pRef p2 = pd.getVertex(i) - if i + 1 < count: + if i + 1 < count: p3 = pd.getVertex(i+1) else: p3 = pd.getVertex(0) @@ -70,7 +70,7 @@ def ComputeCentroid(pd): # Area weighted centroid c += triangleArea * inv3 * (p1 + p2 + p3) - # Centroid + # Centroid # if area < FLT_EPSILON: #raise ValueError, "ComputeCentroid: area < FLT_EPSILON" @@ -95,7 +95,7 @@ def checkDef(pd): else: v1 = verts[i+1] edge=v1 - v0 # if edge.LengthSquared() < threshold: -# raise ValueError, "edge.LengthSquared < FLT_EPSILON**2" +# raise ValueError, "edge.LengthSquared < FLT_EPSILON**2" normals.append( box2d.b2Cross(edge, 1.0) ) normals[-1].Normalize() v0=v1 @@ -104,7 +104,7 @@ def checkDef(pd): d=box2d.b2Vec2() for i in range(pd.vertexCount): - i1 = i - 1 + i1 = i - 1 if i1 < 0: i1 = pd.vertexCount - 1 i2 = i n1 = normals[i1] @@ -114,17 +114,17 @@ def checkDef(pd): d.x = box2d.b2Dot(n1, v) - box2d.b2_toiSlop d.y = box2d.b2Dot(n2, v) - box2d.b2_toiSlop - # Shifting the edge inward by b2_toiSlop should - # not cause the plane to pass the centroid. + # Shifting the edge inward by b2_toiSlop should + # not cause the plane to pass the centroid. - # Your shape has a radius/extent less than b2_toiSlop. -# if d.x < 0.0 or d.y <= 0.0: + # Your shape has a radius/extent less than b2_toiSlop. +# if d.x < 0.0 or d.y <= 0.0: # raise ValueError, "Your shape has a radius/extent less than b2_toiSlop." A = box2d.b2Mat22() A.col1.x = n1.x; A.col2.x = n1.y A.col1.y = n2.x; A.col2.y = n2.y - #coreVertices[i] = A.Solve(d) + m_centroid + #coreVertices[i] = A.Solve(d) + m_centroid return True @@ -144,7 +144,7 @@ def poly_center_vertices(pointlist): """ Rearranges vectors around the center Return: pointlist ([(x, y), ...]) - """ + """ poly_points_center = [] center = cx, cy = calc_center(pointlist) @@ -165,7 +165,7 @@ def is_line(vertices, tolerance=25.0): Returns: True if line, False if no line """ - if len(vertices) <= 2: + if len(vertices) <= 2: return True # Step 1: Points -> Vectors @@ -178,7 +178,7 @@ def is_line(vertices, tolerance=25.0): x2, y2 = p p_old = p - # Create Vector + # Create Vector vx, vy = (x2-x1, y2-y1) # Check Length @@ -224,7 +224,7 @@ def reduce_poly_by_angle(vertices, tolerance=10.0, minlen=20): p_new = [] p_new.append(vertices[0]) - dir = None + dir = None is_convex = True for i in xrange(len(vertices)-1): @@ -249,7 +249,7 @@ def reduce_poly_by_angle(vertices, tolerance=10.0, minlen=20): b = sqrt((v1x*v1x) + (v1y*v1y)) c = sqrt((v2x*v2x) + (v2y*v2y)) - # No Division by 0 :) + # No Division by 0 :) if (b*c) == 0.0: continue # Get the current degrees @@ -263,7 +263,7 @@ def reduce_poly_by_angle(vertices, tolerance=10.0, minlen=20): # Check if inside tolerance if fabs(angle) > tolerance: - p_new.append(vertices[i]) + p_new.append(vertices[i]) # print "x", 180-angle, is_left(vertices[i-1], vertices[i], vertices[i+1]) # Check if convex: @@ -279,7 +279,7 @@ def reduce_poly_by_angle(vertices, tolerance=10.0, minlen=20): # Returns: (1) New Pointlist, (2) Soft reduced pointlist (reduce_poly()) return p_new, is_convex - """ OLD FUNCTION: """ + """ OLD FUNCTION: """ # Wipe all points too close to each other vxx = vertices = reduce_poly(vertices, minlen) @@ -310,7 +310,7 @@ def reduce_poly_by_angle(vertices, tolerance=10.0, minlen=20): # Get Angle if fabs(vx) < 0.2: alpha = 90 - else: + else: alpha = degrees(atan(vy * 1.0) / (vx*1.0)) if alpha_old == None: @@ -318,7 +318,7 @@ def reduce_poly_by_angle(vertices, tolerance=10.0, minlen=20): continue # Get difference to previous angle - alpha_diff = fabs(alpha - alpha_old) + alpha_diff = fabs(alpha - alpha_old) alpha_old = alpha # If the new vector differs from the old one, we add the old point @@ -334,7 +334,7 @@ def reduce_poly_by_angle(vertices, tolerance=10.0, minlen=20): return p_new, vxx -# The following functions is_left, reduce_poly and convex_hull are +# The following functions is_left, reduce_poly and convex_hull are # from the pymunk project (http://code.google.com/p/pymunk/) def is_left(p0, p1, p2): """Test if p2 is left, on or right of the (infinite) line (p0,p1). @@ -345,7 +345,7 @@ def is_left(p0, p1, p2): """ sorting = (p1[0] - p0[0])*(p2[1]-p0[1]) - (p2[0]-p0[0])*(p1[1]-p0[1]) if sorting > 0: return 1 - elif sorting < 0: return -1 + elif sorting < 0: return -1 else: return 0 def is_convex(points): @@ -362,7 +362,7 @@ def is_convex(points): xc, yc = 0, 0 is_same_winding = is_left(p0, p1, p2) for p2 in points[2:] + [p0] + [p1]: - if is_same_winding != is_left(p0, p1, p2): + if is_same_winding != is_left(p0, p1, p2): return False a = p1[0] - p0[0], p1[1] - p0[1] # p1-p0 b = p2[0] - p1[0], p2[1] - p1[1] # p2-p1 @@ -372,8 +372,8 @@ def is_convex(points): return xc <= 2 and yc <= 2 -def sign(x): - if x < 0: return -1 +def sign(x): + if x < 0: return -1 else: return 1 @@ -426,7 +426,7 @@ def convex_hull(points): pt1 = hull[-1] pt2 = hull[-2] - l = is_left(pt2, pt1, p) + l = is_left(pt2, pt1, p) if l > 0: hull.append(p) else: @@ -436,5 +436,5 @@ def convex_hull(points): pt2 = hull[-2] l = is_left(pt2, pt1, p) hull.append(p) - return hull + return hull diff --git a/library/pippy/query.py b/library/pippy/query.py index ff968e7..1260c98 100644 --- a/library/pippy/query.py +++ b/library/pippy/query.py @@ -19,7 +19,7 @@ import logging import dbus import gobject -from sugar.datastore import datastore +from sugar3.datastore import datastore DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore' DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore' @@ -232,7 +232,7 @@ class ResultSet(gobject.GObject): limit = min(self._offset, max_count) self._offset = max(0, self._offset - max_count) - logging.debug('prepending one more page, offset: %r limit: %r' % + logging.debug('prepending one more page, offset: %r limit: %r' % (self._offset, limit)) jobjects, self._total_count = datastore.find(self._query, sorting=self._sorting, diff --git a/library/pippy/sound.py b/library/pippy/sound.py index 08a5274..7124cfe 100755 --- a/library/pippy/sound.py +++ b/library/pippy/sound.py @@ -18,9 +18,9 @@ import errno import os import sys -import sugar.env +import sugar3.env from gettext import gettext as _ -from sugar.activity import activity +from sugar3.activity import activity path = activity.get_bundle_path() path = path.split("/")[0:-1] @@ -324,7 +324,7 @@ def audioOut(file=None): sound to hp. (file = [None]) """ global temp_path if temp_path is None: - from sugar import env + from sugar3 import env temp_path = env.get_profile_path() + '/pippy' if not os.path.isdir(temp_path): os.mkdir(temp_path) |