Author: ArcRiley Date: 2008-03-04 19:36:38 -0500 (Tue, 04 Mar 2008) New Revision: 1038
Modified: 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: Ticket #901 : * soy.widgets upgraded for new Children API * moved cdef i to _i * widgets are now resized before appending Modified: trunk/pysoy/src/widgets/StackX.pxi =================================================================== --- trunk/pysoy/src/widgets/StackX.pxi 2008-03-05 00:15:28 UTC (rev 1037) +++ trunk/pysoy/src/widgets/StackX.pxi 2008-03-05 00:36:38 UTC (rev 1038) @@ -23,13 +23,13 @@ This stacking widget packs children horizontally without overlap. ''' cdef void _resize(self, int _x, int _y, int _width, int _height) : - cdef int i, _part + cdef int _i, _part Widget._resize(self, _x, _y, _width, _height) - 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() + self._widgets._iterStart() + if self._widgets._current > 0 : + _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._iterDone() Modified: trunk/pysoy/src/widgets/StackY.pxi =================================================================== --- trunk/pysoy/src/widgets/StackY.pxi 2008-03-05 00:15:28 UTC (rev 1037) +++ trunk/pysoy/src/widgets/StackY.pxi 2008-03-05 00:36:38 UTC (rev 1038) @@ -23,13 +23,13 @@ This stacking widget packs children vertically without overlap. ''' cdef void _resize(self, int _x, int _y, int _width, int _height) : - cdef int i, _part + 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() + self._widgets._iterStart() + if self._widgets._current > 0 : + _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._iterDone() Modified: trunk/pysoy/src/widgets/StackZ.pxi =================================================================== --- trunk/pysoy/src/widgets/StackZ.pxi 2008-03-05 00:15:28 UTC (rev 1037) +++ trunk/pysoy/src/widgets/StackZ.pxi 2008-03-05 00:36:38 UTC (rev 1038) @@ -29,10 +29,10 @@ cdef void _resize(self, int _x, int _y, int _width, int _height) : - cdef int i + 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() + self._widgets._iterStart() + for _i from 0 <= _i < self._widgets._current : + (<Widget> self._widgets._list[_i])._resize(self._xpos, self._ypos, + self._width, self._height) + self._widgets._iterDone() Modified: trunk/pysoy/src/widgets/Widget.pxi =================================================================== --- trunk/pysoy/src/widgets/Widget.pxi 2008-03-05 00:15:28 UTC (rev 1037) +++ trunk/pysoy/src/widgets/Widget.pxi 2008-03-05 00:36:38 UTC (rev 1038) @@ -47,28 +47,26 @@ self._window = parent self._parent = None 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() + self._window._widgets._append(<void *> self) elif isinstance(parent, StackZ) : self._parent = parent self._window = (<StackZ> self._parent)._window - self._window._widgets.lock() - self._window._widgets.append(<void *>self) - (<StackZ> parent)._widgets._append(<void *>self) (<StackZ> parent)._resize((<StackZ> parent)._xpos, (<StackZ> parent)._ypos, (<StackZ> parent)._width, (<StackZ> parent)._height) - self._window._widgets.unlock() + self._window._widgets._append(<void *> self) + (<StackZ> parent)._widgets._append(<void *> self) else : raise TypeError('parent must be either a soy.Window or stacking widget') def __dealloc__(self) : if self._window : - self._window._widgets._remove(<void *>self) + self._window._widgets._remove(<void *> self) + if self._parent != None : + (<StackZ> self._parent)._widgets._remove(<void *> self) def __repr__(self) : @@ -203,4 +201,4 @@ return (self._width, self._height) -# !DIRTY: 50-53, 57-66 \ No newline at end of file +# !DIRTY: 50-53, 57-66 _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn