[pyglet] 4 new revisions pushed by useboxnet on 2014-04-17 18:50 GMT

3 views
Skip to first unread message

pyg...@googlecode.com

unread,
Apr 17, 2014, 2:50:38 PM4/17/14
to pyglet-...@googlegroups.com
4 new revisions:

Revision: abed89cec737
Branch: default
Author: Juan J. Martínez <j...@usebox.net>
Date: Thu Apr 17 17:48:52 2014 UTC
Log: Fixed import
http://code.google.com/p/pyglet/source/detail?r=abed89cec737

Revision: c3b2b4396680
Branch: default
Author: Juan J. Martínez <j...@usebox.net>
Date: Thu Apr 17 18:21:01 2014 UTC
Log: Python 3 compatibility (BytesIO and div disambiguity)...
http://code.google.com/p/pyglet/source/detail?r=c3b2b4396680

Revision: 511763701504
Branch: default
Author: Juan J. Martínez <j...@usebox.net>
Date: Thu Apr 17 18:23:11 2014 UTC
Log: Python 3 compatibility...
http://code.google.com/p/pyglet/source/detail?r=511763701504

Revision: 1fb79ae476eb
Branch: default
Author: Juan J. Martínez <j...@usebox.net>
Date: Thu Apr 17 18:49:52 2014 UTC
Log: Python 3 compatibility...
http://code.google.com/p/pyglet/source/detail?r=1fb79ae476eb

==============================================================================
Revision: abed89cec737
Branch: default
Author: Juan J. Martínez <j...@usebox.net>
Date: Thu Apr 17 17:48:52 2014 UTC
Log: Fixed import
http://code.google.com/p/pyglet/source/detail?r=abed89cec737

Modified:
/tests/image/MATRIX_RGB.py
/tests/image/MATRIX_RGBA.py

=======================================
--- /tests/image/MATRIX_RGB.py Thu Apr 3 18:10:52 2014 UTC
+++ /tests/image/MATRIX_RGB.py Thu Apr 17 17:48:52 2014 UTC
@@ -7,7 +7,7 @@
end the test.
'''

-from future import print_function
+from __future__ import print_function

__docformat__ = 'restructuredtext'
__version__ = '$Id$'
=======================================
--- /tests/image/MATRIX_RGBA.py Thu Apr 3 18:10:52 2014 UTC
+++ /tests/image/MATRIX_RGBA.py Thu Apr 17 17:48:52 2014 UTC
@@ -7,7 +7,7 @@
end the test.
'''

-from future import print_function
+from __future__ import print_function

__docformat__ = 'restructuredtext'
__version__ = '$Id$'

==============================================================================
Revision: c3b2b4396680
Branch: default
Author: Juan J. Martínez <j...@usebox.net>
Date: Thu Apr 17 18:21:01 2014 UTC
Log: Python 3 compatibility (BytesIO and div disambiguity)

Thanks to Claudio for the patch.

Fixes issue #735.
http://code.google.com/p/pyglet/source/detail?r=c3b2b4396680

Modified:
/pyglet/image/__init__.py

=======================================
--- /pyglet/image/__init__.py Thu Apr 3 18:09:41 2014 UTC
+++ /pyglet/image/__init__.py Thu Apr 17 18:21:01 2014 UTC
@@ -128,6 +128,8 @@

'''

+from __future__ import division
+
__docformat__ = 'restructuredtext'
__version__ = '$Id$'

@@ -138,7 +140,6 @@

from ctypes import *
from math import ceil
-from StringIO import StringIO

from pyglet import gl
from pyglet.gl import *
@@ -147,7 +148,7 @@
from pyglet.window import *

from pyglet.image import atlas
-from pyglet.compat import asbytes, bytes_type
+from pyglet.compat import asbytes, bytes_type, BytesIO

class ImageException(Exception):
pass
@@ -180,7 +181,7 @@
opened_file = None

if not hasattr(file, 'seek'):
- file = StringIO(file.read())
+ file = BytesIO(file.read())

try:
if decoder:
@@ -1760,11 +1761,11 @@
owner_v2 = owner.tex_coords[7]
scale_u = owner_u2 - owner_u1
scale_v = owner_v2 - owner_v1
- u1 = x / float(owner.width) * scale_u + owner_u1
- v1 = y / float(owner.height) * scale_v + owner_v1
- u2 = (x + width) / float(owner.width) * scale_u + owner_u1
- v2 = (y + height) / float(owner.height) * scale_v + owner_v1
- r = z / float(owner.images) + owner.tex_coords[2]
+ u1 = x / owner.width * scale_u + owner_u1
+ v1 = y / owner.height * scale_v + owner_v1
+ u2 = (x + width) / owner.width * scale_u + owner_u1
+ v2 = (y + height) / owner.height * scale_v + owner_v1
+ r = z / owner.images + owner.tex_coords[2]
self.tex_coords = (u1, v1, r, u2, v1, r, u2, v2, r, u1, v2, r)

def get_image_data(self):
@@ -1880,10 +1881,10 @@
The image will be tiled with the bottom-left corner of the
destination
rectangle aligned with the anchor point of this texture.
'''
- u1 = self.anchor_x / float(self.width)
- v1 = self.anchor_y / float(self.height)
- u2 = u1 + width / float(self.width)
- v2 = v1 + height / float(self.height)
+ u1 = self.anchor_x / self.width
+ v1 = self.anchor_y / self.height
+ u2 = u1 + width / self.width
+ v2 = v1 + height / self.height
w, h = width, height
t = self.tex_coords
array = (GLfloat * 32)(
@@ -2216,10 +2217,10 @@

if item_width is None:
item_width = \
- int((image.width - column_padding * (columns - 1)) /
columns)
+ (image.width - column_padding * (columns - 1)) // columns
if item_height is None:
item_height = \
- int((image.height - row_padding * (rows - 1)) / rows)
+ (image.height - row_padding * (rows - 1)) // rows
self.image = image
self.rows = rows
self.columns = columns
@@ -2348,7 +2349,7 @@
if type(index.start) is tuple:
row1, col1 = index.start
elif type(index.start) is int:
- row1 = index.start / self.columns
+ row1 = index.start // self.columns
col1 = index.start % self.columns
assert row1 >= 0 and col1 >= 0 and \
row1 < self.rows and col1 < self.columns
@@ -2356,7 +2357,7 @@
if type(index.stop) is tuple:
row2, col2 = index.stop
elif type(index.stop) is int:
- row2 = index.stop / self.columns
+ row2 = index.stop // self.columns
col2 = index.stop % self.columns
assert row2 >= 0 and col2 >= 0 and \
row2 <= self.rows and col2 <= self.columns
@@ -2427,7 +2428,7 @@
if not file:
file = open(filename, 'rb')
if not hasattr(file, 'seek'):
- file = StringIO(file.read())
+ file = BytesIO(file.read())

if decoder:
return decoder.decode(file, filename)

==============================================================================
Revision: 511763701504
Branch: default
Author: Juan J. Martínez <j...@usebox.net>
Date: Thu Apr 17 18:23:11 2014 UTC
Log: Python 3 compatibility

Thanks to Claudio for the patch.

Fixes issue #729.
http://code.google.com/p/pyglet/source/detail?r=511763701504

Modified:
/tests/test.py

=======================================
--- /tests/test.py Sat Dec 7 19:02:32 2013 UTC
+++ /tests/test.py Thu Apr 17 18:23:11 2014 UTC
@@ -197,6 +197,8 @@

'''

+from __future__ import print_function
+
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'

@@ -313,7 +315,7 @@
if (module_interactive and
len(result.failures) == 0 and
len(result.errors) == 0):
-# print module.__doc__
+# print(module.__doc__)
user_result = prompt('Passed [Yn]: ')
while user_result and user_result not in 'YyNn':
print("Unrecognized response '%s'" % user_result)

==============================================================================
Revision: 1fb79ae476eb
Branch: default
Author: Juan J. Martínez <j...@usebox.net>
Date: Thu Apr 17 18:49:52 2014 UTC
Log: Python 3 compatibility

Added a note with details to run the tests with python 3.

Thanks to Claudio for the patch.

Fixes issue #726.
http://code.google.com/p/pyglet/source/detail?r=1fb79ae476eb

Modified:
/tests/test.py

=======================================
--- /tests/test.py Thu Apr 17 18:23:11 2014 UTC
+++ /tests/test.py Thu Apr 17 18:49:52 2014 UTC
@@ -195,6 +195,17 @@
capture_regression_image() several times; only the final image will be
used.

+Python 3
+--------
+
+The tests have to be processed by 2to3 in order to run them with Python 3.
+
+This can be done with::
+
+ 2to3 --output-dir=tests3 -W -n tests
+
+And then run the tests int tests3 directory.
+
'''

from __future__ import print_function
@@ -211,16 +222,6 @@
import time
import unittest

-# --- Python 2/3 compatibility helpers ---
-PY3K = True if sys.version_info[0] == 3 else False
-
-def prompt(message):
- if PY3K:
- return input(message)
- else:
- return raw_input(message)
-
-
# So we can find tests.regression and ensure local pyglet copy is tested.
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))

@@ -292,7 +293,7 @@
if module.__doc__:
print(' ' + module.__doc__.replace('\n','\n '))
if module_interactive:
- prompt('Press return to begin test...')
+ raw_input('Press return to begin test...')


suite = unittest.TestLoader().loadTestsFromModule(module)
@@ -316,13 +317,13 @@
len(result.failures) == 0 and
len(result.errors) == 0):
# print(module.__doc__)
- user_result = prompt('Passed [Yn]: ')
+ user_result = raw_input('Passed [Yn]: ')
while user_result and user_result not in 'YyNn':
print("Unrecognized response '%s'" % user_result)
- user_result = prompt('Passed [Yn]: ')
+ user_result = raw_input('Passed [Yn]: ')
if user_result and user_result in 'Nn':
print('Enter failure description: ')
- description = prompt('> ')
+ description = raw_input('> ')
options.log.error('User marked fail for %s', self)
options.log.error(description)
else:
Reply all
Reply to author
Forward
0 new messages