pyglet 2.1.2__py3-none-any.whl → 2.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. pyglet/__init__.py +21 -9
  2. pyglet/__init__.pyi +3 -1
  3. pyglet/app/cocoa.py +6 -3
  4. pyglet/app/xlib.py +1 -1
  5. pyglet/display/cocoa.py +2 -2
  6. pyglet/display/win32.py +17 -18
  7. pyglet/display/xlib.py +2 -2
  8. pyglet/display/xlib_vidmoderestore.py +1 -1
  9. pyglet/extlibs/earcut.py +2 -2
  10. pyglet/font/__init__.py +3 -3
  11. pyglet/font/base.py +118 -51
  12. pyglet/font/dwrite/__init__.py +1381 -0
  13. pyglet/font/dwrite/d2d1_lib.py +637 -0
  14. pyglet/font/dwrite/d2d1_types_lib.py +60 -0
  15. pyglet/font/dwrite/dwrite_lib.py +1577 -0
  16. pyglet/font/fontconfig.py +79 -16
  17. pyglet/font/freetype.py +252 -77
  18. pyglet/font/freetype_lib.py +234 -125
  19. pyglet/font/harfbuzz/__init__.py +275 -0
  20. pyglet/font/harfbuzz/harfbuzz_lib.py +212 -0
  21. pyglet/font/quartz.py +432 -112
  22. pyglet/font/user.py +18 -11
  23. pyglet/font/win32.py +9 -1
  24. pyglet/gl/wgl.py +94 -87
  25. pyglet/gl/wglext_arb.py +472 -218
  26. pyglet/gl/wglext_nv.py +410 -188
  27. pyglet/gui/frame.py +4 -4
  28. pyglet/gui/widgets.py +6 -1
  29. pyglet/image/__init__.py +0 -2
  30. pyglet/image/codecs/bmp.py +3 -5
  31. pyglet/image/codecs/dds.py +1 -1
  32. pyglet/image/codecs/gdiplus.py +28 -9
  33. pyglet/image/codecs/wic.py +198 -489
  34. pyglet/image/codecs/wincodec_lib.py +413 -0
  35. pyglet/input/base.py +3 -2
  36. pyglet/input/linux/x11_xinput.py +3 -3
  37. pyglet/input/linux/x11_xinput_tablet.py +2 -2
  38. pyglet/input/macos/darwin_hid.py +28 -2
  39. pyglet/input/win32/directinput.py +3 -2
  40. pyglet/input/win32/wintab.py +1 -1
  41. pyglet/input/win32/xinput.py +10 -9
  42. pyglet/lib.py +14 -2
  43. pyglet/libs/darwin/cocoapy/cocoalibs.py +74 -3
  44. pyglet/libs/darwin/coreaudio.py +0 -2
  45. pyglet/libs/win32/__init__.py +4 -2
  46. pyglet/libs/win32/com.py +65 -12
  47. pyglet/libs/win32/constants.py +1 -0
  48. pyglet/libs/win32/dinput.py +1 -9
  49. pyglet/libs/win32/types.py +72 -8
  50. pyglet/math.py +5 -5
  51. pyglet/media/codecs/coreaudio.py +1 -0
  52. pyglet/media/codecs/wmf.py +93 -72
  53. pyglet/media/devices/win32.py +5 -4
  54. pyglet/media/drivers/directsound/lib_dsound.py +4 -4
  55. pyglet/media/drivers/xaudio2/interface.py +21 -17
  56. pyglet/media/drivers/xaudio2/lib_xaudio2.py +42 -25
  57. pyglet/model/__init__.py +78 -57
  58. pyglet/shapes.py +1 -1
  59. pyglet/text/document.py +7 -53
  60. pyglet/text/formats/attributed.py +3 -1
  61. pyglet/text/formats/plaintext.py +1 -1
  62. pyglet/text/formats/structured.py +1 -1
  63. pyglet/text/layout/base.py +76 -68
  64. pyglet/text/layout/incremental.py +38 -8
  65. pyglet/text/layout/scrolling.py +1 -1
  66. pyglet/text/runlist.py +2 -114
  67. pyglet/window/__init__.py +11 -8
  68. pyglet/window/win32/__init__.py +1 -3
  69. pyglet/window/xlib/__init__.py +2 -2
  70. {pyglet-2.1.2.dist-info → pyglet-2.1.4.dist-info}/METADATA +2 -3
  71. {pyglet-2.1.2.dist-info → pyglet-2.1.4.dist-info}/RECORD +73 -67
  72. pyglet/font/directwrite.py +0 -2798
  73. {pyglet-2.1.2.dist-info → pyglet-2.1.4.dist-info}/LICENSE +0 -0
  74. {pyglet-2.1.2.dist-info → pyglet-2.1.4.dist-info}/WHEEL +0 -0
pyglet/gui/frame.py CHANGED
@@ -32,7 +32,7 @@ class Frame:
32
32
  The cell ("bucket") size for each cell in the hash.
33
33
  Widgets may span multiple cells.
34
34
  order:
35
- Widgets use internal OrderedGroups for draw sorting.
35
+ Widgets use internal ordered Groups for draw sorting.
36
36
  This is the base value for these Groups.
37
37
  """
38
38
  self._window = window
@@ -149,7 +149,7 @@ class MovableFrame(Frame):
149
149
  When a specified modifier key is held down, Widgets can be
150
150
  repositioned by dragging them. Examples of modifier keys are
151
151
  Ctrl, Alt, Shift. These are defined in the `pyglet.window.key`
152
- module, and start witih `MOD_`. For example::
152
+ module, and start with `MOD_`. For example::
153
153
 
154
154
  from pyglet.window.key import MOD_CTRL
155
155
 
@@ -163,7 +163,7 @@ class MovableFrame(Frame):
163
163
  """Create an instance of a MovableFrame.
164
164
 
165
165
  This is a similar to the standard Frame class, except that
166
- you can specify a modifer key. When this key is held down,
166
+ you can specify a modifier key. When this key is held down,
167
167
  Widgets can be re-positioned by drag-and-dropping.
168
168
 
169
169
  Args:
@@ -173,7 +173,7 @@ class MovableFrame(Frame):
173
173
  enable:
174
174
  Whether to enable frame.
175
175
  order:
176
- Widgets use internal OrderedGroups for draw sorting.
176
+ Widgets use internal ordered Groups for draw sorting.
177
177
  This is the base value for these Groups.
178
178
  modifier:
179
179
  A key modifier, such as `pyglet.window.key.MOD_CTRL`
pyglet/gui/widgets.py CHANGED
@@ -370,7 +370,12 @@ class Slider(WidgetBase):
370
370
 
371
371
  def _update_position(self) -> None:
372
372
  self._base_spr.position = self._x, self._y, 0
373
- self._knob_spr.position = self._x + self._edge, self._y + self._base_img.height / 2, 0
373
+ self._min_knob_x = self._x + self._edge
374
+ self._max_knob_x = self._x + self._base_img.width - self._knob_img.width - self._edge
375
+ x = (self._max_knob_x - self._min_knob_x) * self._value / 100 + self._min_knob_x + self._half_knob_width
376
+ x = max(self._min_knob_x, min(x - self._half_knob_width, self._max_knob_x))
377
+ y = self._y + self._base_img.height / 2
378
+ self._knob_spr.position = x, y, 0
374
379
 
375
380
  @property
376
381
  def value(self) -> float:
pyglet/image/__init__.py CHANGED
@@ -1258,8 +1258,6 @@ class Texture(AbstractImage):
1258
1258
 
1259
1259
  return cls(width, height, target, tex_id.value, min_filter, mag_filter)
1260
1260
 
1261
- return texture
1262
-
1263
1261
  def get_image_data(self, z: int = 0) -> ImageData:
1264
1262
  """Get the image data of this texture.
1265
1263
 
@@ -11,14 +11,12 @@ encoding. Alpha channel is supported for 32-bit BI_RGB only.
11
11
  # http://www.fileformat.info/format/bmp/egff.htm
12
12
 
13
13
  import ctypes
14
+ from ctypes.wintypes import DWORD, LONG, WORD
14
15
 
15
16
  from pyglet.image import ImageData
16
- from pyglet.image.codecs import ImageDecoder, ImageDecodeException
17
+ from pyglet.image.codecs import ImageDecodeException, ImageDecoder
18
+ from pyglet.libs.win32.types import BYTE
17
19
 
18
- BYTE = ctypes.c_ubyte
19
- WORD = ctypes.c_uint16
20
- DWORD = ctypes.c_uint32
21
- LONG = ctypes.c_int32
22
20
  FXPT2DOT30 = ctypes.c_uint32
23
21
 
24
22
  BI_RGB = 0
@@ -86,7 +86,7 @@ class DDSURFACEDESC2(_FileStruct):
86
86
  ]
87
87
 
88
88
  def __init__(self, data):
89
- super(DDSURFACEDESC2, self).__init__(data)
89
+ super().__init__(data)
90
90
  self.ddpfPixelFormat = DDPIXELFORMAT(self.ddpfPixelFormat)
91
91
 
92
92
 
@@ -1,11 +1,30 @@
1
- from pyglet.libs.win32.com import pIUnknown
2
- from pyglet.image import *
3
- from pyglet.image.codecs import *
4
- from pyglet.libs.win32.constants import *
5
- from pyglet.libs.win32.types import *
1
+ from ctypes import (
2
+ POINTER,
3
+ Structure,
4
+ c_buffer,
5
+ c_byte,
6
+ c_float,
7
+ c_long,
8
+ c_short,
9
+ c_uint32,
10
+ c_ulong,
11
+ c_void_p,
12
+ c_wchar,
13
+ c_wchar_p,
14
+ cast,
15
+ create_string_buffer,
16
+ memmove,
17
+ windll,
18
+ )
19
+ from ctypes.wintypes import BOOL, BYTE, INT, UINT, ULONG
20
+
21
+ from pyglet.image import Animation, AnimationFrame, ImageData, byref, c_int, c_uint, sizeof
22
+ from pyglet.image.codecs import ImageDecodeException, ImageDecoder
6
23
  from pyglet.libs.win32 import _kernel32 as kernel32
7
24
  from pyglet.libs.win32 import _ole32 as ole32
8
-
25
+ from pyglet.libs.win32.com import pIUnknown
26
+ from pyglet.libs.win32.constants import GMEM_MOVEABLE
27
+ from pyglet.libs.win32.types import LONG_PTR
9
28
 
10
29
  gdiplus = windll.gdiplus
11
30
 
@@ -248,13 +267,13 @@ class GDIPlusDecoder(ImageDecoder):
248
267
  if not file:
249
268
  file = open(filename, 'rb')
250
269
  bitmap = self._load_bitmap(filename, file)
251
-
270
+
252
271
  dimension_count = c_uint()
253
272
  gdiplus.GdipImageGetFrameDimensionsCount(bitmap, byref(dimension_count))
254
273
  if dimension_count.value < 1:
255
274
  self._delete_bitmap(bitmap)
256
275
  raise ImageDecodeException('Image has no frame dimensions')
257
-
276
+
258
277
  # XXX Make sure this dimension is time?
259
278
  dimensions = (c_void_p * dimension_count.value)()
260
279
  gdiplus.GdipImageGetFrameDimensionsList(bitmap, dimensions, dimension_count.value)
@@ -274,7 +293,7 @@ class GDIPlusDecoder(ImageDecoder):
274
293
  delays = cast(prop_item.value, POINTER(c_long * n_delays)).contents
275
294
 
276
295
  frames = []
277
-
296
+
278
297
  for i in range(frame_count.value):
279
298
  gdiplus.GdipImageSelectActiveFrame(bitmap, dimensions, i)
280
299
  image = self._get_image(bitmap)