Author: ArcRiley
Date: 2007-07-06 21:29:34 -0400 (Fri, 06 Jul 2007)
New Revision: 393

Added:
   trunk/pysoy/src/widgets/StackY.pxi
Modified:
   trunk/pysoy/src/widgets/StackX.pxi
   trunk/pysoy/src/widgets/soy.widgets.pyx
   trunk/pysoy/tests/tex_canvas.py
Log:
Finishing ticket #270


Modified: trunk/pysoy/src/widgets/StackX.pxi
===================================================================
--- trunk/pysoy/src/widgets/StackX.pxi  2007-07-07 01:14:38 UTC (rev 392)
+++ trunk/pysoy/src/widgets/StackX.pxi  2007-07-07 01:29:34 UTC (rev 393)
@@ -29,10 +29,11 @@
   cdef void _resize(self, int _x, int _y, int _width, int _height) :
     cdef int i, _part
     Widget._resize(self, _x, _y, _width, _height)
-    self._widgets.lock()
-    _part = self._width / self._widgets.current
-    for i from 0 <= i < self._widgets.current :
-      (<Widget> self._widgets.list[i])._resize(self._xpos + (i * _part), 
-                                               self._ypos,
-                                               _part, self._height)
-    self._widgets.unlock()
+    if self._widgets.current > 0 :
+      self._widgets.lock()
+      _part = self._width / self._widgets.current
+      for i from 0 <= i < self._widgets.current :
+        (<Widget> self._widgets.list[i])._resize(self._xpos + (i * _part), 
+                                                 self._ypos,
+                                                 _part, self._height)
+      self._widgets.unlock()

Copied: trunk/pysoy/src/widgets/StackY.pxi (from rev 392, 
trunk/pysoy/src/widgets/StackX.pxi)
===================================================================
--- trunk/pysoy/src/widgets/StackY.pxi                          (rev 0)
+++ trunk/pysoy/src/widgets/StackY.pxi  2007-07-07 01:29:34 UTC (rev 393)
@@ -0,0 +1,39 @@
+# PySoy widgets.StackY class
+#
+# Copyright (C) 2007 Team PySoy
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  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
+#
+# $Id$
+
+cdef class StackY (StackZ) :
+  '''PySoy widgets.StackY Class
+
+     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)
+    if self._widgets.current > 0 :
+      self._widgets.lock()
+      _part = self._height / self._widgets.current
+      for i from 0 <= i < self._widgets.current :
+        (<Widget> self._widgets.list[i])._resize(self._xpos, 
+                                                 self._ypos + (i * _part),
+                                                 self._width, _part)
+      self._widgets.unlock()

Modified: trunk/pysoy/src/widgets/soy.widgets.pyx
===================================================================
--- trunk/pysoy/src/widgets/soy.widgets.pyx     2007-07-07 01:14:38 UTC (rev 
392)
+++ trunk/pysoy/src/widgets/soy.widgets.pyx     2007-07-07 01:29:34 UTC (rev 
393)
@@ -28,4 +28,5 @@
 include "Canvas.pxi"
 include "Projector.pxi"
 include "StackX.pxi"
+include "StackY.pxi"
 include "StackZ.pxi"

Modified: trunk/pysoy/tests/tex_canvas.py
===================================================================
--- trunk/pysoy/tests/tex_canvas.py     2007-07-07 01:14:38 UTC (rev 392)
+++ trunk/pysoy/tests/tex_canvas.py     2007-07-07 01:29:34 UTC (rev 393)
@@ -10,8 +10,10 @@
 scr = soy.Screen()
 win = soy.Window(scr, 'Textured Canvas')
 win.background.hex = '#fff'
-can = soy.widgets.Canvas(win, margin=10, texture=tex)
-ca2 = soy.widgets.Canvas(win, margin=20, texture=tex)
+stx = soy.widgets.StackY(win)
+ca1 = soy.widgets.Canvas(stx, margin=10, texture=tex)
+ca2 = soy.widgets.Canvas(stx, margin=10, texture=tex)
+ca3 = soy.widgets.Canvas(stx, margin=10, texture=tex)
 
 if __name__ == '__main__' :
   while True:

_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to