Author: ArcRiley Date: 2008-02-07 00:40:57 -0500 (Thu, 07 Feb 2008) New Revision: 819
Added: trunk/pysoy/include/posix.pxd trunk/pysoy/include/windows.pxd trunk/pysoy/src/_internals/AsyncQueue.pxi trunk/pysoy/src/_internals/_getQueue.pxi trunk/pysoy/src/_internals/_sleep-posix.pxi trunk/pysoy/src/_internals/_sleep-win32.pxi trunk/pysoy/src/_internals/_time-posix.pxi trunk/pysoy/src/_internals/_time-win32.pxi Removed: trunk/pysoy/src/_core-common/_eventLoop.pxi trunk/pysoy/src/_core-w32/_sleep.pxi trunk/pysoy/src/_core-w32/_time.pxi trunk/pysoy/src/_core-w32/windows.pxd trunk/pysoy/src/_core-x11/_sleep.pxi trunk/pysoy/src/_core-x11/_time.pxi trunk/pysoy/src/_datatypes/AsyncQueue.pxi Modified: trunk/pysoy/src/_core-common/_coreLoop.pxi trunk/pysoy/src/_core-w32/Window.pxi trunk/pysoy/src/_core-w32/soy._core.pxd trunk/pysoy/src/_core-w32/soy._core.pyx trunk/pysoy/src/_core-x11/Window.pxi trunk/pysoy/src/_core-x11/soy._core.pxd trunk/pysoy/src/_core-x11/soy._core.pyx trunk/pysoy/src/_datatypes/soy._datatypes.pxd trunk/pysoy/src/_datatypes/soy._datatypes.pyx trunk/pysoy/src/_internals/soy._internals.pxd trunk/pysoy/src/_internals/soy._internals.pyx trunk/pysoy/src/actions/Callback.pxi trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pyx trunk/pysoy/src/scenes/soy.scenes.pyx trunk/pysoy/src/textures/soy.textures.pyx Log: Attempting to sort out cyclic import bug Copied: trunk/pysoy/include/posix.pxd (from rev 817, trunk/pysoy/include/stdio.pxd) =================================================================== --- trunk/pysoy/include/posix.pxd (rev 0) +++ trunk/pysoy/include/posix.pxd 2008-02-07 05:40:57 UTC (rev 819) @@ -0,0 +1,27 @@ +# Posix Declarations +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# 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 extern from "sys/time.h" : + cdef struct timeval : + long int tv_sec + long int tv_usec + int gettimeofday (timeval *tv, void *tz ) + +cdef extern from "unistd.h" : + void usleep(unsigned long usec) Copied: trunk/pysoy/include/windows.pxd (from rev 817, trunk/pysoy/src/_core-w32/windows.pxd) =================================================================== --- trunk/pysoy/include/windows.pxd (rev 0) +++ trunk/pysoy/include/windows.pxd 2008-02-07 05:40:57 UTC (rev 819) @@ -0,0 +1,140 @@ +# PySoy Windows API Declarations +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# 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 extern from "windows.h": + ctypedef void* HDC # handle to device context + ctypedef void* HGLRC # handle to GL rendering context + ctypedef void* HWND # handle to window + ctypedef void* HINSTANCE + ctypedef void* HANDLE + ctypedef int BOOL + ctypedef long LONG + ctypedef unsigned long DWORD + ctypedef unsigned short WORD + ctypedef WORD ATOM + ctypedef unsigned int UINT + ctypedef long long LONGLONG + ctypedef unsigned int UINT_PTR + ctypedef long long LONG_PTR + ctypedef UINT_PTR WPARAM + ctypedef LONG_PTR LPARAM + ctypedef LONG_PTR LRESULT + + ctypedef LRESULT (__stdcall *WNDPROC)(HWND, UINT, WPARAM, LPARAM) + cdef LRESULT DefWindowProc(HWND, UINT, WPARAM, LPARAM) + + ctypedef struct RECT: + LONG left + LONG top + LONG right + LONG bottom + + cdef BOOL AdjustWindowRectEx(RECT*, DWORD, BOOL, DWORD) + + ctypedef struct WNDCLASS: + UINT style + WNDPROC lpfnWndProc + int cbClsExtra + int cbWndExtra + HINSTANCE hInstance + void* hIcon + void* hCursor + void* hBrush + char* lpszMenuName + char* lpszClassName + + cdef void Sleep(DWORD) + + cdef LRESULT SendMessage(HWND, UINT, WPARAM, LPARAM) + cdef BOOL SendNotifyMessage(HWND, UINT, WPARAM, LPARAM) + cdef BOOL SetWindowText(HWND, char*) + + cdef ATOM RegisterClass(WNDCLASS*) + + cdef HWND CreateWindow(char*, char*, DWORD, int, int, int, int, + HWND, void*, HINSTANCE, void*) + cdef BOOL DestroyWindow(HWND) + cdef BOOL IsWindowVisible(HWND) + cdef BOOL ShowWindow(HWND, int) + cdef BOOL SetForegroundWindow(HWND) + cdef HDC GetDC(HWND) + cdef int ReleaseDC(HWND, HDC) + cdef BOOL DeleteDC(HDC) + cdef HGLRC wglCreateContext(HDC) + cdef BOOL wglMakeCurrent(HDC, HGLRC) + cdef BOOL wglDeleteContext(HGLRC) + cdef BOOL SwapBuffers(HDC) + + cdef HANDLE GetCurrentThread() + cdef DWORD GetCurrentThreadId() + + ctypedef struct POINT: + LONG x + LONG y + cdef WORD HIWORD(DWORD) + cdef WORD LOWORD(DWORD) + # Messages + ctypedef struct MSG: + HWND hwnd + UINT message + WPARAM wParam + LPARAM lParam + DWORD time + POINT pt + cdef BOOL PeekMessage(MSG*, HWND, UINT, UINT, UINT) + cdef BOOL GetMessage(MSG*, HWND, UINT, UINT) + cdef LRESULT DispatchMessage(MSG*) + cdef BOOL TranslateMessage(MSG*) + + # Technically, this returns an HMODULE, but for our purposes, this is + # Good Enough. + cdef HINSTANCE GetModuleHandle(char*) + cdef void* LoadCursor(HINSTANCE, char*) + cdef char *IDC_ARROW + + ctypedef struct FILETIME: + DWORD dwLowDateTime + DWORD dwHighDateTime + ctypedef union LARGE_INTEGER: + DWORD LowPart + LONG HighPart + LONGLONG QuadPart + cdef void GetSystemTimeAsFileTime(FILETIME*) + + ctypedef enum: + CS_HREDRAW + CS_VREDRAW + CS_OWNDC + + PM_REMOVE + + WM_SIZE + WM_PAINT + WM_SETTEXT + WM_CLOSE + WM_KEYDOWN + WM_KEYUP + WM_CHAR + + SW_SHOW + + SIZE_MINIMIZED + +# vim: sts=2:sw=2:et + Modified: trunk/pysoy/src/_core-common/_coreLoop.pxi =================================================================== --- trunk/pysoy/src/_core-common/_coreLoop.pxi 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-common/_coreLoop.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -81,6 +81,6 @@ _scene._bodies.unlock() _scenes.unlock() if _maxstep == 0 : - _sleep(10) + soy._internals._sleep(10) else : - _sleep(1) + soy._internals._sleep(1) Deleted: trunk/pysoy/src/_core-common/_eventLoop.pxi =================================================================== --- trunk/pysoy/src/_core-common/_eventLoop.pxi 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-common/_eventLoop.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -1,32 +0,0 @@ -# PySoy _eventLoop -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# 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$ - -cimport glib -cimport py -cimport stdio -cimport soy.transports - -glib.g_thread_init(<glib.GThreadFunctions*> 0) - -cdef soy._datatypes.AsyncQueue _queue -_queue = soy._datatypes.AsyncQueue() - -cdef soy._datatypes.AsyncQueue _get_queue(): - #stdio.printf("_get_queue()\n") - return _queue Modified: trunk/pysoy/src/_core-w32/Window.pxi =================================================================== --- trunk/pysoy/src/_core-w32/Window.pxi 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-w32/Window.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -88,7 +88,7 @@ for i from 0 <= i < 10000 : if self._opened == -1: break - _sleep(100) + soy._internals._sleep(100) if self._opened != -1: self._opened = -1 raise SystemError('timed out while deallocating window') Deleted: trunk/pysoy/src/_core-w32/_sleep.pxi =================================================================== --- trunk/pysoy/src/_core-w32/_sleep.pxi 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-w32/_sleep.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -1,22 +0,0 @@ -# PySoy _sleep Function (for Windows platforms) -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# 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 void _sleep( unsigned int mseconds ) : - windows.Sleep(mseconds) - Deleted: trunk/pysoy/src/_core-w32/_time.pxi =================================================================== --- trunk/pysoy/src/_core-w32/_time.pxi 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-w32/_time.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -1,36 +0,0 @@ -# PySoy _time Function (for Windows platforms) -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# 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 double _time(): - cdef windows.LONGLONG t - cdef windows.FILETIME ft - cdef windows.LARGE_INTEGER li - cdef double result - - windows.GetSystemTimeAsFileTime(&ft) - li.LowPart = ft.dwLowDateTime - li.HighPart = ft.dwHighDateTime - t = li.QuadPart / 10 # in 100-nanoseconds - ## I found this magic number on the Internet! - ## It reconciles Windows's epoch with Unix's. - #t -= 116444736000000000L - #t /= 10 # in microseconds - result = (<double>(t / 1000000)) + ((<double>(t % 1000000)) / 1000000) - return result - Modified: trunk/pysoy/src/_core-w32/soy._core.pxd =================================================================== --- trunk/pysoy/src/_core-w32/soy._core.pxd 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-w32/soy._core.pxd 2008-02-07 05:40:57 UTC (rev 819) @@ -23,16 +23,10 @@ cimport ogg cimport py cimport stdio -cimport soy._datatypes cimport soy._internals cimport soy.colors cimport soy.textures -cdef void _sleep ( unsigned int ) -cdef double _time ( ) - -cdef soy._datatypes.AsyncQueue _get_queue ( ) - cdef class Screen : cdef int _screenID cdef object _fullScreen Modified: trunk/pysoy/src/_core-w32/soy._core.pyx =================================================================== --- trunk/pysoy/src/_core-w32/soy._core.pyx 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-w32/soy._core.pyx 2008-02-07 05:40:57 UTC (rev 819) @@ -36,11 +36,8 @@ include "_windowproc.pxi" include "Screen.pxi" include "Window.pxi" -include "_sleep.pxi" -include "_time.pxi" # These must be last and in this order -include "../_core-common/_eventLoop.pxi" include "../_core-common/quit.pxi" include "../_core-common/_callback.pxi" include "../_core-common/_coreLoop.pxi" Deleted: trunk/pysoy/src/_core-w32/windows.pxd =================================================================== --- trunk/pysoy/src/_core-w32/windows.pxd 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-w32/windows.pxd 2008-02-07 05:40:57 UTC (rev 819) @@ -1,140 +0,0 @@ -# PySoy Windows API Declarations -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# 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 extern from "windows.h": - ctypedef void* HDC # handle to device context - ctypedef void* HGLRC # handle to GL rendering context - ctypedef void* HWND # handle to window - ctypedef void* HINSTANCE - ctypedef void* HANDLE - ctypedef int BOOL - ctypedef long LONG - ctypedef unsigned long DWORD - ctypedef unsigned short WORD - ctypedef WORD ATOM - ctypedef unsigned int UINT - ctypedef long long LONGLONG - ctypedef unsigned int UINT_PTR - ctypedef long long LONG_PTR - ctypedef UINT_PTR WPARAM - ctypedef LONG_PTR LPARAM - ctypedef LONG_PTR LRESULT - - ctypedef LRESULT (__stdcall *WNDPROC)(HWND, UINT, WPARAM, LPARAM) - cdef LRESULT DefWindowProc(HWND, UINT, WPARAM, LPARAM) - - ctypedef struct RECT: - LONG left - LONG top - LONG right - LONG bottom - - cdef BOOL AdjustWindowRectEx(RECT*, DWORD, BOOL, DWORD) - - ctypedef struct WNDCLASS: - UINT style - WNDPROC lpfnWndProc - int cbClsExtra - int cbWndExtra - HINSTANCE hInstance - void* hIcon - void* hCursor - void* hBrush - char* lpszMenuName - char* lpszClassName - - cdef void Sleep(DWORD) - - cdef LRESULT SendMessage(HWND, UINT, WPARAM, LPARAM) - cdef BOOL SendNotifyMessage(HWND, UINT, WPARAM, LPARAM) - cdef BOOL SetWindowText(HWND, char*) - - cdef ATOM RegisterClass(WNDCLASS*) - - cdef HWND CreateWindow(char*, char*, DWORD, int, int, int, int, - HWND, void*, HINSTANCE, void*) - cdef BOOL DestroyWindow(HWND) - cdef BOOL IsWindowVisible(HWND) - cdef BOOL ShowWindow(HWND, int) - cdef BOOL SetForegroundWindow(HWND) - cdef HDC GetDC(HWND) - cdef int ReleaseDC(HWND, HDC) - cdef BOOL DeleteDC(HDC) - cdef HGLRC wglCreateContext(HDC) - cdef BOOL wglMakeCurrent(HDC, HGLRC) - cdef BOOL wglDeleteContext(HGLRC) - cdef BOOL SwapBuffers(HDC) - - cdef HANDLE GetCurrentThread() - cdef DWORD GetCurrentThreadId() - - ctypedef struct POINT: - LONG x - LONG y - cdef WORD HIWORD(DWORD) - cdef WORD LOWORD(DWORD) - # Messages - ctypedef struct MSG: - HWND hwnd - UINT message - WPARAM wParam - LPARAM lParam - DWORD time - POINT pt - cdef BOOL PeekMessage(MSG*, HWND, UINT, UINT, UINT) - cdef BOOL GetMessage(MSG*, HWND, UINT, UINT) - cdef LRESULT DispatchMessage(MSG*) - cdef BOOL TranslateMessage(MSG*) - - # Technically, this returns an HMODULE, but for our purposes, this is - # Good Enough. - cdef HINSTANCE GetModuleHandle(char*) - cdef void* LoadCursor(HINSTANCE, char*) - cdef char *IDC_ARROW - - ctypedef struct FILETIME: - DWORD dwLowDateTime - DWORD dwHighDateTime - ctypedef union LARGE_INTEGER: - DWORD LowPart - LONG HighPart - LONGLONG QuadPart - cdef void GetSystemTimeAsFileTime(FILETIME*) - - ctypedef enum: - CS_HREDRAW - CS_VREDRAW - CS_OWNDC - - PM_REMOVE - - WM_SIZE - WM_PAINT - WM_SETTEXT - WM_CLOSE - WM_KEYDOWN - WM_KEYUP - WM_CHAR - - SW_SHOW - - SIZE_MINIMIZED - -# vim: sts=2:sw=2:et - Modified: trunk/pysoy/src/_core-x11/Window.pxi =================================================================== --- trunk/pysoy/src/_core-x11/Window.pxi 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-x11/Window.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -37,7 +37,7 @@ self._controllers = soy._internals.Children() self._widgets = soy._internals.Children() self._title = str(title) - self._icon = icon + #self.icon = icon if background : self._background = background else : @@ -89,8 +89,8 @@ if self._screen._fullScreen != self and self._splash == 0 : _atom = glx.XInternAtom(_display, "WM_DELETE_WINDOW", True) glx.XSetWMProtocols(_display, self._windowID, &_atom, 1) - if self._icon : - self.icon = self._icon + #if self._icon : + # self.icon = self._icon self._setProperties() glx.XMapWindow(_display, self._windowID) glx.XFlush(_display) @@ -102,7 +102,7 @@ for i from 0 <= i < 10000 : if self._opened == 0 : break - _sleep(100) + soy._internals._sleep(100) if self._opened == 0 : self._resize(_width, _height) self._opened = 1 @@ -175,7 +175,7 @@ cdef void _setProperties(self) : glx.XSetStandardProperties(_display, self._windowID, - self._title, self._title, self.icon, + self._title, self._title, 0, #was self._icon, NULL, 0, NULL) glx.XFlush(_display) @@ -238,14 +238,14 @@ _windows.unlock() - property icon: - '''Window's icon texture - + #property icon: + '''Window's icon texture + This property is the window's "icon", however the window manager uses it. Textures must be 1D or 2D (not 3D) and /should/ be square. Defaults to None. - ''' + def __get__(self) : if self._icon : return self._iconID @@ -273,7 +273,7 @@ glx.XPutImage(_display, self._iconID, gc_cache, ximage_buffer, 0, 0, 0, 0, value.width, value.height) #_windows.lock() #self._setProperties() - #_windows.unlock() + #_windows.unlock() ''' property background: Deleted: trunk/pysoy/src/_core-x11/_sleep.pxi =================================================================== --- trunk/pysoy/src/_core-x11/_sleep.pxi 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-x11/_sleep.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -1,21 +0,0 @@ -# PySoy _sleep Function (for Unix platforms) -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# 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 void _sleep( unsigned int mseconds ) : - usleep( mseconds * 1000 ) Deleted: trunk/pysoy/src/_core-x11/_time.pxi =================================================================== --- trunk/pysoy/src/_core-x11/_time.pxi 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-x11/_time.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -1,23 +0,0 @@ -# PySoy _time Function (for Unix platforms) -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# 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 double _time( ) : - cdef timeval tv - gettimeofday(&tv, NULL) - return tv.tv_sec + ( <double> tv.tv_usec / 1000000.0 ) Modified: trunk/pysoy/src/_core-x11/soy._core.pxd =================================================================== --- trunk/pysoy/src/_core-x11/soy._core.pxd 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-x11/soy._core.pxd 2008-02-07 05:40:57 UTC (rev 819) @@ -24,16 +24,9 @@ cimport ogg cimport py cimport stdio -cimport soy._datatypes cimport soy._internals cimport soy.colors -cimport soy.textures -cdef void _sleep ( unsigned int ) -cdef double _time ( ) - -cdef soy._datatypes.AsyncQueue _get_queue ( ) - cdef class Screen : cdef glx.Screen *_screen cdef int _screenID @@ -52,7 +45,7 @@ cdef Screen _screen cdef glx.Window _windowID cdef object _title - cdef soy.textures.Texture _icon + cdef void* _icon cdef glx.Pixmap _iconID cdef soy.colors.Color _background cdef int _width Modified: trunk/pysoy/src/_core-x11/soy._core.pyx =================================================================== --- trunk/pysoy/src/_core-x11/soy._core.pyx 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_core-x11/soy._core.pyx 2008-02-07 05:40:57 UTC (rev 819) @@ -33,13 +33,10 @@ import soy.colors include "../_core-common/_Transports.pxi" -include "_sleep.pxi" -include "_time.pxi" include "Screen.pxi" include "Window.pxi" # These must be last and in this order -include "../_core-common/_eventLoop.pxi" include "../_core-common/quit.pxi" include "../_core-common/_callback.pxi" include "../_core-common/_coreLoop.pxi" Deleted: trunk/pysoy/src/_datatypes/AsyncQueue.pxi =================================================================== --- trunk/pysoy/src/_datatypes/AsyncQueue.pxi 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_datatypes/AsyncQueue.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -1,45 +0,0 @@ -# PySoy AsyncQueue class -# -# Copyright (C) 2006,2007,2008 PySoy Group -# -# 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$ - -cimport py - -cdef class AsyncQueue : - '''GLib AsyncQueue - - wrapped to allow ease of use by other PySoy classes. - ''' - - def __cinit__(self) : - self._asyncqueue = glib.g_async_queue_new() - - def __dealloc__(self) : - glib.g_async_queue_unref(self._asyncqueue) - - cdef void _push(self, void* data) : - glib.g_async_queue_push(self._asyncqueue, data) - - cdef void* _pop(self) : - with nogil: - return glib.g_async_queue_pop(self._asyncqueue) - - def pop(self): - cdef object obj - obj = <object>self._pop() - py.Py_DECREF(obj) - return obj Modified: trunk/pysoy/src/_datatypes/soy._datatypes.pxd =================================================================== --- trunk/pysoy/src/_datatypes/soy._datatypes.pxd 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_datatypes/soy._datatypes.pxd 2008-02-07 05:40:57 UTC (rev 819) @@ -51,11 +51,6 @@ int offset int length -cdef class AsyncQueue : - cdef glib.GAsyncQueue* _asyncqueue - cdef void _push(self, void*) - cdef void* _pop(self) - cdef class HashTable : cdef glib.GHashTable* _hashtable cdef void _insert(self, char*, float) Modified: trunk/pysoy/src/_datatypes/soy._datatypes.pyx =================================================================== --- trunk/pysoy/src/_datatypes/soy._datatypes.pyx 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_datatypes/soy._datatypes.pyx 2008-02-07 05:40:57 UTC (rev 819) @@ -34,7 +34,6 @@ cimport soy.meshes cimport soy.scenes -include "AsyncQueue.pxi" include "Datatype.pxi" include "HashTable.pxi" include "PointerSet.pxi" Copied: trunk/pysoy/src/_internals/AsyncQueue.pxi (from rev 817, trunk/pysoy/src/_datatypes/AsyncQueue.pxi) =================================================================== --- trunk/pysoy/src/_internals/AsyncQueue.pxi (rev 0) +++ trunk/pysoy/src/_internals/AsyncQueue.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -0,0 +1,45 @@ +# PySoy AsyncQueue class +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# 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$ + +cimport py + +cdef class AsyncQueue : + '''GLib AsyncQueue + + wrapped to allow ease of use by other PySoy classes. + ''' + + def __cinit__(self) : + self._asyncqueue = glib.g_async_queue_new() + + def __dealloc__(self) : + glib.g_async_queue_unref(self._asyncqueue) + + cdef void _push(self, void* data) : + glib.g_async_queue_push(self._asyncqueue, data) + + cdef void* _pop(self) : + with nogil: + return glib.g_async_queue_pop(self._asyncqueue) + + def pop(self): + cdef object obj + obj = <object>self._pop() + py.Py_DECREF(obj) + return obj Copied: trunk/pysoy/src/_internals/_getQueue.pxi (from rev 818, trunk/pysoy/src/_core-common/_eventLoop.pxi) =================================================================== --- trunk/pysoy/src/_internals/_getQueue.pxi (rev 0) +++ trunk/pysoy/src/_internals/_getQueue.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -0,0 +1,26 @@ +# PySoy _internals._get_queue function +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# 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$ + +glib.g_thread_init(<glib.GThreadFunctions*> 0) + +cdef AsyncQueue _queue +_queue = AsyncQueue() + +cdef AsyncQueue _get_queue(): + return _queue Copied: trunk/pysoy/src/_internals/_sleep-posix.pxi (from rev 817, trunk/pysoy/src/_core-x11/_sleep.pxi) =================================================================== --- trunk/pysoy/src/_internals/_sleep-posix.pxi (rev 0) +++ trunk/pysoy/src/_internals/_sleep-posix.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -0,0 +1,21 @@ +# PySoy _sleep Function (for Unix platforms) +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# 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 void _sleep( unsigned int mseconds ) : + posix.usleep( mseconds * 1000 ) Copied: trunk/pysoy/src/_internals/_sleep-win32.pxi (from rev 817, trunk/pysoy/src/_core-w32/_sleep.pxi) =================================================================== --- trunk/pysoy/src/_internals/_sleep-win32.pxi (rev 0) +++ trunk/pysoy/src/_internals/_sleep-win32.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -0,0 +1,22 @@ +# PySoy _sleep Function (for Windows platforms) +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# 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 void _sleep( unsigned int mseconds ) : + windows.Sleep(mseconds) + Copied: trunk/pysoy/src/_internals/_time-posix.pxi (from rev 817, trunk/pysoy/src/_core-x11/_time.pxi) =================================================================== --- trunk/pysoy/src/_internals/_time-posix.pxi (rev 0) +++ trunk/pysoy/src/_internals/_time-posix.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -0,0 +1,23 @@ +# PySoy _time Function (for Unix platforms) +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# 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 double _time( ) : + cdef posix.timeval tv + posix.gettimeofday(&tv, NULL) + return tv.tv_sec + ( <double> tv.tv_usec / 1000000.0 ) Copied: trunk/pysoy/src/_internals/_time-win32.pxi (from rev 817, trunk/pysoy/src/_core-w32/_time.pxi) =================================================================== --- trunk/pysoy/src/_internals/_time-win32.pxi (rev 0) +++ trunk/pysoy/src/_internals/_time-win32.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -0,0 +1,36 @@ +# PySoy _time Function (for Windows platforms) +# +# Copyright (C) 2006,2007,2008 PySoy Group +# +# 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 double _time(): + cdef windows.LONGLONG t + cdef windows.FILETIME ft + cdef windows.LARGE_INTEGER li + cdef double result + + windows.GetSystemTimeAsFileTime(&ft) + li.LowPart = ft.dwLowDateTime + li.HighPart = ft.dwHighDateTime + t = li.QuadPart / 10 # in 100-nanoseconds + ## I found this magic number on the Internet! + ## It reconciles Windows's epoch with Unix's. + #t -= 116444736000000000L + #t /= 10 # in microseconds + result = (<double>(t / 1000000)) + ((<double>(t % 1000000)) / 1000000) + return result + Modified: trunk/pysoy/src/_internals/soy._internals.pxd =================================================================== --- trunk/pysoy/src/_internals/soy._internals.pxd 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_internals/soy._internals.pxd 2008-02-07 05:40:57 UTC (rev 819) @@ -17,6 +17,16 @@ # # $Id$ +cimport glib + +cdef void _sleep ( unsigned int ) +cdef double _time ( ) + +cdef class AsyncQueue : + cdef glib.GAsyncQueue* _asyncqueue + cdef void _push(self, void*) + cdef void* _pop(self) + cdef class Children : cdef int size cdef int current @@ -41,3 +51,5 @@ cdef int _load(self, void*, int) cdef int _save(self, void*, int) cdef int _ready(self) + +cdef AsyncQueue _get_queue ( ) Modified: trunk/pysoy/src/_internals/soy._internals.pyx =================================================================== --- trunk/pysoy/src/_internals/soy._internals.pyx 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/_internals/soy._internals.pyx 2008-02-07 05:40:57 UTC (rev 819) @@ -26,5 +26,16 @@ 'by '+'$Author$'[9:-2] __version__ = 'Trunk (r'+'$Rev$'[6:-2]+')' +include "AsyncQueue.pxi" include "Children.pxi" include "Loadable.pxi" +include "_get_queue.pxi" + +IF UNAME_SYSNAME == "Windows": + cimport windows + include "_sleep-win32.pxi" + include "_time-win32.pxi" +ELSE: + cimport posix + include "_sleep-posix.pxi" + include "_time-posix.pxi" Modified: trunk/pysoy/src/actions/Callback.pxi =================================================================== --- trunk/pysoy/src/actions/Callback.pxi 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/actions/Callback.pxi 2008-02-07 05:40:57 UTC (rev 819) @@ -17,8 +17,6 @@ # # $Id$ -cimport soy._core -cimport soy._datatypes cimport py cdef class Callback (Action) : @@ -26,12 +24,11 @@ self._callback = callback cdef void _perform(self, unsigned int _duration): - cdef soy._datatypes.AsyncQueue _queue + cdef soy._internals.AsyncQueue _queue #stdio.printf("Callback._perform\n") py.Py_INCREF(self._callback) #stdio.printf("Callback._perform: Incremented reference count\n") - _queue = soy._core._get_queue() + _queue = soy._internals._get_queue() #stdio.printf("Callback._perform: Got queue: %p\n", <void *>_queue) _queue._push(<void *>self._callback) #stdio.printf("Callback._perform: Done.\n") - Modified: trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pyx =================================================================== --- trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pyx 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/bodies._bodies/soy.bodies._bodies.pyx 2008-02-07 05:40:57 UTC (rev 819) @@ -32,7 +32,7 @@ 'by '+'$Author$'[9:-2] __version__ = 'Trunk (r'+'$Rev$'[6:-2]+')' -from soy._core cimport _time +from soy._internals cimport _time include "Body.pxi" include "Camera.pxi" Modified: trunk/pysoy/src/scenes/soy.scenes.pyx =================================================================== --- trunk/pysoy/src/scenes/soy.scenes.pyx 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/scenes/soy.scenes.pyx 2008-02-07 05:40:57 UTC (rev 819) @@ -25,7 +25,7 @@ 'by '+'$Author$'[9:-2] __version__ = 'Trunk (r'+'$Rev$'[6:-2]+')' -#from soy._core cimport _time +from soy._internals cimport _time cimport soy.joints cimport soy.bodies.fields Modified: trunk/pysoy/src/textures/soy.textures.pyx =================================================================== --- trunk/pysoy/src/textures/soy.textures.pyx 2008-02-07 05:17:23 UTC (rev 818) +++ trunk/pysoy/src/textures/soy.textures.pyx 2008-02-07 05:40:57 UTC (rev 819) @@ -23,7 +23,7 @@ 'by '+'$Author$'[9:-2] __version__ = 'Trunk (r'+'$Rev$'[6:-2]+')' -from soy._core cimport _time +from soy._internals cimport _time import soy.colors include "_tables4YUV.pxi" _______________________________________________ PySoy-SVN mailing list [email protected] http://www.pysoy.org/mailman/listinfo/pysoy-svn
