Author: ArcRiley
Date: 2007-07-06 19:56:22 -0400 (Fri, 06 Jul 2007)
New Revision: 387
Modified:
trunk/pysoy/src/_core-x11/Window.pxi
trunk/pysoy/src/widgets/StackZ.pxi
trunk/pysoy/src/widgets/Widget.pxi
trunk/pysoy/src/widgets/soy.widgets.pxd
trunk/pysoy/src/widgets/soy.widgets.pyx
trunk/pysoy/tests/tex_pyramid.py
Log:
StackZ now works
Modified: trunk/pysoy/src/_core-x11/Window.pxi
===================================================================
--- trunk/pysoy/src/_core-x11/Window.pxi 2007-07-06 22:35:26 UTC (rev
386)
+++ trunk/pysoy/src/_core-x11/Window.pxi 2007-07-06 23:56:22 UTC (rev
387)
@@ -127,10 +127,12 @@
cdef int i
self._width = _width
self._height = _height
- # Resize widgets
+ # Resize top-level widgets
self._widgets.lock()
for i from 0 <= i < self._widgets.current :
- (<soy.widgets.Widget> self._widgets.list[i])._resize(0,0,_width,_height)
+ if (<soy.widgets.Widget> self._widgets.list[i])._topLevel :
+ (<soy.widgets.Widget> self._widgets.list[i])._resize(0, 0,
+ _width, _height)
self._widgets.unlock()
Modified: trunk/pysoy/src/widgets/StackZ.pxi
===================================================================
--- trunk/pysoy/src/widgets/StackZ.pxi 2007-07-06 22:35:26 UTC (rev 386)
+++ trunk/pysoy/src/widgets/StackZ.pxi 2007-07-06 23:56:22 UTC (rev 387)
@@ -30,3 +30,14 @@
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)
+ self._widgets.lock()
+ for i from 0 <= i < self._widgets.current :
+ (<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 2007-07-06 22:35:26 UTC (rev 386)
+++ trunk/pysoy/src/widgets/Widget.pxi 2007-07-06 23:56:22 UTC (rev 387)
@@ -32,23 +32,26 @@
if isinstance(parent, soy._core.Window) :
self._window = parent
self._parent = None
- self._xpos = 0
- self._ypos = 0
- self._width = self._window._width
- self._height = self._window._height
+ self._topLevel = 1
+ self._window._widgets.lock()
+ self._window._widgets.append(<void *>self)
+ self._resize(0, 0, self._window._width, self._window._height)
+ self._window._widgets.unlock()
elif isinstance(parent, StackZ) :
self._parent = parent
self._window = (<StackZ> self._parent)._window
- (<StackZ> self._parent)._widgets.lock()
- (<StackZ> self._parent)._widgets.append(<void *>self)
- (<StackZ> self._parent)._widgets.unlock()
- (<StackZ> self._parent)._resize(self._parent._xpos, self._parent._ypos,
- self._parent._width,
self._parent._height)
+ self._window._widgets.lock()
+ self._window._widgets.append(<void *>self)
+ (<StackZ> parent)._widgets.lock()
+ (<StackZ> parent)._widgets.append(<void *>self)
+ (<StackZ> parent)._widgets.unlock()
+ (<StackZ> parent)._resize((<StackZ> parent)._xpos,
+ (<StackZ> parent)._ypos,
+ (<StackZ> parent)._width,
+ (<StackZ> parent)._height)
+ self._window._widgets.unlock()
else :
raise TypeError('parent must be either a soy.Window or stacking widget')
- self._window._widgets.lock()
- self._window._widgets.append(<void *>self)
- self._window._widgets.unlock()
def __dealloc__(self) :
@@ -81,6 +84,7 @@
self._marginLeft = margin[3]
return 1
+
cdef void _render(self) :
return
Modified: trunk/pysoy/src/widgets/soy.widgets.pxd
===================================================================
--- trunk/pysoy/src/widgets/soy.widgets.pxd 2007-07-06 22:35:26 UTC (rev
386)
+++ trunk/pysoy/src/widgets/soy.widgets.pxd 2007-07-06 23:56:22 UTC (rev
387)
@@ -28,6 +28,7 @@
cdef class Widget :
cdef soy._core.Window _window
cdef object _parent
+ cdef int _topLevel
cdef int _xpos
cdef int _ypos
cdef int _width
Modified: trunk/pysoy/src/widgets/soy.widgets.pyx
===================================================================
--- trunk/pysoy/src/widgets/soy.widgets.pyx 2007-07-06 22:35:26 UTC (rev
386)
+++ trunk/pysoy/src/widgets/soy.widgets.pyx 2007-07-06 23:56:22 UTC (rev
387)
@@ -27,3 +27,4 @@
include "Widget.pxi"
include "Canvas.pxi"
include "Projector.pxi"
+include "StackZ.pxi"
Modified: trunk/pysoy/tests/tex_pyramid.py
===================================================================
--- trunk/pysoy/tests/tex_pyramid.py 2007-07-06 22:35:26 UTC (rev 386)
+++ trunk/pysoy/tests/tex_pyramid.py 2007-07-06 23:56:22 UTC (rev 387)
@@ -20,9 +20,11 @@
cam = soy.bodies.Camera(sce)
cam.position = (0.0, 0.0, 5.0)
-ca1 = soy.widgets.Canvas(win, margin=10, aspect=0.0, texture=lava)
-pro = soy.widgets.Projector(win, camera=cam)
-ca2 = soy.widgets.Canvas(win, texture=face)
+wid = soy.widgets.Widget(win, margin=1)
+stk = soy.widgets.StackZ(win, margin=10)
+ca1 = soy.widgets.Canvas(stk, aspect=0.0, texture=lava)
+pro = soy.widgets.Projector(stk, camera=cam)
+ca2 = soy.widgets.Canvas(stk, texture=face)
pyr = soy.bodies.Pyramid(sce, luma)
pyr.rotation = (1.0, 1.0, 0.0)
_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn