Author: ArcRiley
Date: 2008-02-12 04:35:13 -0500 (Tue, 12 Feb 2008)
New Revision: 868
Modified:
trunk/pysoy/src/widgets/Canvas.pxi
trunk/pysoy/src/widgets/Projector.pxi
trunk/pysoy/src/widgets/StackX.pxi
trunk/pysoy/src/widgets/StackY.pxi
trunk/pysoy/src/widgets/StackZ.pxi
trunk/pysoy/src/widgets/Widget.pxi
Log:
enabled parent-less widgets, eliminated redundant __repr__ functions
Modified: trunk/pysoy/src/widgets/Canvas.pxi
===================================================================
--- trunk/pysoy/src/widgets/Canvas.pxi 2008-02-12 08:36:36 UTC (rev 867)
+++ trunk/pysoy/src/widgets/Canvas.pxi 2008-02-12 09:35:13 UTC (rev 868)
@@ -32,7 +32,7 @@
See also Widget,Projector,Window
'''
- def __cinit__(self, parent, margin=None, aspect=-1.0,
+ def __cinit__(self, parent=None, margin=None, aspect=-1.0,
texture=None,
*args, **keywords) :
self._verts[1].px = 1.0
Modified: trunk/pysoy/src/widgets/Projector.pxi
===================================================================
--- trunk/pysoy/src/widgets/Projector.pxi 2008-02-12 08:36:36 UTC (rev
867)
+++ trunk/pysoy/src/widgets/Projector.pxi 2008-02-12 09:35:13 UTC (rev
868)
@@ -28,7 +28,7 @@
See also soy.Widget, soy.Camera, soy.Screen
'''
- def __cinit__(self, parent, margin=None, aspect=-1.0,
+ def __cinit__(self, parent=None, margin=None, aspect=-1.0,
camera=None,
*args, **keywords) :
self._camera = camera
Modified: trunk/pysoy/src/widgets/StackX.pxi
===================================================================
--- trunk/pysoy/src/widgets/StackX.pxi 2008-02-12 08:36:36 UTC (rev 867)
+++ trunk/pysoy/src/widgets/StackX.pxi 2008-02-12 09:35:13 UTC (rev 868)
@@ -22,10 +22,6 @@
This stacking widget packs children horizontally without overlap.
'''
- def __repr__(self) :
- return '<StackX Widget in Window id %d>' % (self._window._windowID)
-
-
cdef void _resize(self, int _x, int _y, int _width, int _height) :
cdef int i, _part
Widget._resize(self, _x, _y, _width, _height)
Modified: trunk/pysoy/src/widgets/StackY.pxi
===================================================================
--- trunk/pysoy/src/widgets/StackY.pxi 2008-02-12 08:36:36 UTC (rev 867)
+++ trunk/pysoy/src/widgets/StackY.pxi 2008-02-12 09:35:13 UTC (rev 868)
@@ -22,10 +22,6 @@
This stacking widget packs children vertically without overlap.
'''
- def __repr__(self) :
- return '<StackY Widget in Window id %d>' % (self._window._windowID)
-
-
cdef void _resize(self, int _x, int _y, int _width, int _height) :
cdef int i, _part
Widget._resize(self, _x, _y, _width, _height)
Modified: trunk/pysoy/src/widgets/StackZ.pxi
===================================================================
--- trunk/pysoy/src/widgets/StackZ.pxi 2008-02-12 08:36:36 UTC (rev 867)
+++ trunk/pysoy/src/widgets/StackZ.pxi 2008-02-12 09:35:13 UTC (rev 868)
@@ -23,15 +23,11 @@
This stacking widget overlaps children as "layers". This behavior is
identical to how a soy.Window stacks top-level widgets. Z widget indexing.
'''
- def __cinit__(self, parent, margin=None, aspect=-1.0,
+ def __cinit__(self, parent=None, margin=None, aspect=-1.0,
*args, **keywords) :
self._widgets = soy._internals.Children()
- def __repr__(self) :
- return '<StackX Widget in Window id %d>' % (self._window._windowID)
-
-
cdef void _resize(self, int _x, int _y, int _width, int _height) :
cdef int i
Widget._resize(self, _x, _y, _width, _height)
@@ -40,4 +36,3 @@
(<Widget> self._widgets.list[i])._resize(self._xpos, self._ypos,
self._width, self._height)
self._widgets.unlock()
-
Modified: trunk/pysoy/src/widgets/Widget.pxi
===================================================================
--- trunk/pysoy/src/widgets/Widget.pxi 2008-02-12 08:36:36 UTC (rev 867)
+++ trunk/pysoy/src/widgets/Widget.pxi 2008-02-12 09:35:13 UTC (rev 868)
@@ -33,13 +33,16 @@
-soy.Widget.StackY
-soy.Widget.StackZ
'''
- def __cinit__(self, parent, margin=None, aspect=-1.0,
+ def __cinit__(self, parent=None, margin=None, aspect=-1.0,
*args, **keywords) :
if not self._setMargin(margin) :
raise TypeError('margin must be a (int, int, int, int)')
if aspect > 0.0 :
self._aspect = aspect
- if isinstance(parent, soy._core.Window) :
+ if parent == None :
+ self._window = None
+ self._parent = None
+ elif isinstance(parent, soy._core.Window) :
self._window = parent
self._parent = None
self._topLevel = 1
@@ -72,7 +75,12 @@
def __repr__(self) :
- return '<Widget in Window id %d>' % (self._window._windowID)
+ cdef object _name
+ _name = self.__class__.__name__
+ if self._window :
+ return '<%s in Window id %d>' % (_name, self._window._windowID)
+ else :
+ return '<%s>' % (_name)
cdef int _setMargin(self, object margin) :
_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn