omnipython-desktop 0.8.0.dev25__tar.gz → 0.8.1.dev2__tar.gz

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 (68) hide show
  1. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/PKG-INFO +2 -2
  2. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/pyproject.toml +2 -2
  3. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/omnipython_desktop.egg-info/PKG-INFO +2 -2
  4. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/omnipython_desktop.egg-info/requires.txt +1 -1
  5. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/usdl2.py +1 -1
  6. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/uwin32-stubs/__init__.pyi +7 -0
  7. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/uwin32.py +126 -0
  8. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/README.md +0 -0
  9. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/setup.cfg +0 -0
  10. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/_svgio_canvas.py +0 -0
  11. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/_svgio_colour.py +0 -0
  12. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/_svgio_compact.py +0 -0
  13. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/_svgio_resvg.py +0 -0
  14. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/__init__.py +0 -0
  15. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/active_sensing.py +0 -0
  16. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/channel_pressure.py +0 -0
  17. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/control_change.py +0 -0
  18. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/control_change_values.py +0 -0
  19. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/midi_continue.py +0 -0
  20. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/midi_message.py +0 -0
  21. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/midi_reset.py +0 -0
  22. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/mtc_quarter_frame.py +0 -0
  23. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/note_off.py +0 -0
  24. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/note_on.py +0 -0
  25. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/pitch_bend.py +0 -0
  26. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/polyphonic_key_pressure.py +0 -0
  27. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/program_change.py +0 -0
  28. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/start.py +0 -0
  29. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/stop.py +0 -0
  30. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/system_exclusive.py +0 -0
  31. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/adafruit_midi/timing_clock.py +0 -0
  32. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/board_config.py +0 -0
  33. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/board_peripherals.py +0 -0
  34. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/frame_recorder-stubs/__init__.pyi +0 -0
  35. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/frame_recorder.py +0 -0
  36. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/jpegio-stubs/__init__.pyi +0 -0
  37. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/jpegio.py +0 -0
  38. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/manifest.py +0 -0
  39. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/mdns-stubs/__init__.pyi +0 -0
  40. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/mdns.py +0 -0
  41. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/micropython.py +0 -0
  42. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/__init__.py +0 -0
  43. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/__init__.pyi +0 -0
  44. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/ble.py +0 -0
  45. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/ble.pyi +0 -0
  46. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/linux.py +0 -0
  47. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/linux.pyi +0 -0
  48. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/loopback.py +0 -0
  49. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/loopback.pyi +0 -0
  50. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/py.typed +0 -0
  51. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/uart.py +0 -0
  52. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/uart.pyi +0 -0
  53. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/usb_device.py +0 -0
  54. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/usb_device.pyi +0 -0
  55. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/usb_host.py +0 -0
  56. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/usb_host.pyi +0 -0
  57. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/webmidi.py +0 -0
  58. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/webmidi.pyi +0 -0
  59. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/windows.py +0 -0
  60. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/midiports/windows.pyi +0 -0
  61. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/omnipython_desktop.egg-info/SOURCES.txt +0 -0
  62. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/omnipython_desktop.egg-info/dependency_links.txt +0 -0
  63. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/omnipython_desktop.egg-info/top_level.txt +0 -0
  64. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/pngio-stubs/__init__.pyi +0 -0
  65. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/pngio.py +0 -0
  66. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/svgio-stubs/__init__.pyi +0 -0
  67. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/svgio.py +0 -0
  68. {omnipython_desktop-0.8.0.dev25 → omnipython_desktop-0.8.1.dev2}/src/usdl2-stubs/__init__.pyi +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omnipython-desktop
3
- Version: 0.8.0.dev25
3
+ Version: 0.8.1.dev2
4
4
  Summary: Complete OmniPython desktop stack and board configuration
5
5
  Author: Brad Barnett
6
6
  License-Expression: MIT
@@ -8,7 +8,7 @@ Project-URL: Homepage, https://github.com/PyDevices/omnipython
8
8
  Project-URL: Repository, https://github.com/PyDevices/omnipython
9
9
  Requires-Python: >=3.9
10
10
  Description-Content-Type: text/markdown
11
- Requires-Dist: omnipython==0.8.0.dev25
11
+ Requires-Dist: omnipython==0.8.1.dev2
12
12
  Requires-Dist: zeroconf>=0.132
13
13
  Requires-Dist: Pillow>=9
14
14
  Requires-Dist: resvg-py>=0.5
@@ -4,14 +4,14 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "omnipython-desktop"
7
- version = "0.8.0.dev25"
7
+ version = "0.8.1.dev2"
8
8
  description = "Complete OmniPython desktop stack and board configuration"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
11
11
  license = "MIT"
12
12
  authors = [{ name = "Brad Barnett" }]
13
13
  dependencies = [
14
- "omnipython==0.8.0.dev25",
14
+ "omnipython==0.8.1.dev2",
15
15
  "zeroconf>=0.132",
16
16
  "Pillow>=9",
17
17
  "resvg-py>=0.5",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omnipython-desktop
3
- Version: 0.8.0.dev25
3
+ Version: 0.8.1.dev2
4
4
  Summary: Complete OmniPython desktop stack and board configuration
5
5
  Author: Brad Barnett
6
6
  License-Expression: MIT
@@ -8,7 +8,7 @@ Project-URL: Homepage, https://github.com/PyDevices/omnipython
8
8
  Project-URL: Repository, https://github.com/PyDevices/omnipython
9
9
  Requires-Python: >=3.9
10
10
  Description-Content-Type: text/markdown
11
- Requires-Dist: omnipython==0.8.0.dev25
11
+ Requires-Dist: omnipython==0.8.1.dev2
12
12
  Requires-Dist: zeroconf>=0.132
13
13
  Requires-Dist: Pillow>=9
14
14
  Requires-Dist: resvg-py>=0.5
@@ -1,4 +1,4 @@
1
- omnipython==0.8.0.dev25
1
+ omnipython==0.8.1.dev2
2
2
  zeroconf>=0.132
3
3
  Pillow>=9
4
4
  resvg-py>=0.5
@@ -24,7 +24,7 @@ with the same subviews, ``SDL_Rect``/``SDL_Point`` as packed bytes, timer API
24
24
  via ``SDL_TimerCallback`` / ``SDL_AddTimer`` / ``SDL_RemoveTimer``. Opaque
25
25
  handles are plain ints (falsy when 0/NULL).
26
26
 
27
- Lives at ``lib/usdl2.py`` in this repo. Published as TestPyPI ``usdl2-py`` /
27
+ Lives at ``lib/usdl2.py`` in this repo. Published as PyPI ``usdl2-py`` /
28
28
  MIP ``usdl2`` (same release tag as the native ``usdl2`` wheels). Uses
29
29
  **ctypes** on CPython (unix and win32); **ffi** on MicroPython unix.
30
30
  """
@@ -110,6 +110,9 @@ AUDCLNT_SHAREMODE_SHARED: int
110
110
  AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM: int
111
111
  AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY: int
112
112
  WAVE_FORMAT_PCM: int
113
+ DEVICE_STATE_ACTIVE: int
114
+ STGM_READ: int
115
+ VT_LPWSTR: int
113
116
  KMOD_LSHIFT: int
114
117
  KMOD_RSHIFT: int
115
118
  KMOD_LCTRL: int
@@ -400,6 +403,10 @@ def CoCreateInstance(clsid: GUID, iid: GUID) -> int: ...
400
403
  def MMDeviceEnumerator_Create() -> int: ...
401
404
  def IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator: int, data_flow: int, role: int = ...) -> int: ...
402
405
  def IMMDevice_Activate_IAudioClient(device: int) -> int: ...
406
+ def IMMDeviceEnumerator_EnumAudioEndpoints(enumerator: int, data_flow: int, state_mask: int = ...) -> int: ...
407
+ def IMMDeviceCollection_GetCount(collection: int) -> int: ...
408
+ def IMMDeviceCollection_Item(collection: int, index: int) -> int: ...
409
+ def IMMDevice_GetFriendlyName(device: int) -> str | None: ...
403
410
  def WAVEFORMATEX_pcm(rate: int, channels: int, bits: int) -> WAVEFORMATEX: ...
404
411
  def IAudioClient_Initialize_shared_pcm(client: int, fmt: WAVEFORMATEX, buffer_ms: int) -> None: ...
405
412
  def IAudioClient_GetBufferSize(client: int) -> int: ...
@@ -154,6 +154,9 @@ AUDCLNT_SHAREMODE_SHARED = 0
154
154
  AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM = 0x80000000
155
155
  AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY = 0x08000000
156
156
  WAVE_FORMAT_PCM = 1
157
+ DEVICE_STATE_ACTIVE = 0x00000001
158
+ STGM_READ = 0x00000000
159
+ VT_LPWSTR = 31
157
160
 
158
161
  # SDL-style keycodes used by keys.py
159
162
  _SDLK_SCANCODE_MASK = 1 << 30
@@ -328,6 +331,7 @@ if _use_ffi:
328
331
  _raw_CoUninitialize = ole32.func("v", "CoUninitialize", "")
329
332
  _raw_CoCreateInstance = ole32.func("i", "CoCreateInstance", "pPIpp")
330
333
  _raw_CoTaskMemFree = ole32.func("v", "CoTaskMemFree", "P")
334
+ _raw_PropVariantClear = ole32.func("i", "PropVariantClear", "p")
331
335
 
332
336
  # --- cfgmgr32: device enumeration.
333
337
  #
@@ -1315,6 +1319,8 @@ else:
1315
1319
  ole32.CoCreateInstance.restype = HRESULT
1316
1320
  ole32.CoTaskMemFree.argtypes = [LPVOID]
1317
1321
  ole32.CoTaskMemFree.restype = None
1322
+ ole32.PropVariantClear.argtypes = [LPVOID]
1323
+ ole32.PropVariantClear.restype = HRESULT
1318
1324
 
1319
1325
  # --- cfgmgr32: device enumeration. See the ffi branch for why CfgMgr32
1320
1326
  # rather than SetupAPI.
@@ -2294,6 +2300,126 @@ def IMMDevice_Activate_IAudioClient(device):
2294
2300
  return client.value
2295
2301
 
2296
2302
 
2303
+ # PKEY_Device_FriendlyName, {a45c254e-df1c-4efd-8020-67d146a850e0} 14, packed
2304
+ # as a PROPERTYKEY. A PROPVARIANT keeps its pointer at offset 8 on both widths.
2305
+ _PKEY_Device_FriendlyName = struct.pack(
2306
+ "<IHH8BI", 0xA45C254E, 0xDF1C, 0x4EFD, 0x80, 0x20, 0x67, 0xD1, 0x46, 0xA8, 0x50, 0xE0, 14
2307
+ )
2308
+ _PROPVARIANT_SIZE = 24 if _IS_64 else 16
2309
+
2310
+
2311
+ def _wstr_from_ptr(ptr):
2312
+ if not _use_ffi:
2313
+ return ctypes.wstring_at(ptr)
2314
+ chars = []
2315
+ while True:
2316
+ pair = uctypes.bytearray_at(ptr + 2 * len(chars), 2)
2317
+ code = pair[0] | (pair[1] << 8)
2318
+ if not code:
2319
+ return "".join(chars)
2320
+ chars.append(chr(code))
2321
+
2322
+
2323
+ def IMMDeviceEnumerator_EnumAudioEndpoints(enumerator, data_flow, state_mask=DEVICE_STATE_ACTIVE):
2324
+ """Return an ``IMMDeviceCollection`` of the endpoints in ``state_mask``."""
2325
+ if _use_ffi:
2326
+ coll_buf = bytearray(_PTR_SIZE)
2327
+ _check(
2328
+ _vcall(enumerator, 3, "i", "iIp", int(data_flow), int(state_mask), coll_buf),
2329
+ "EnumAudioEndpoints",
2330
+ )
2331
+ return _ptr_read(uctypes.addressof(coll_buf))
2332
+ coll = c_void_p()
2333
+ _check(
2334
+ _vcall(
2335
+ enumerator,
2336
+ 3,
2337
+ HRESULT,
2338
+ (INT, DWORD, POINTER(c_void_p)),
2339
+ int(data_flow),
2340
+ int(state_mask),
2341
+ byref(coll),
2342
+ ),
2343
+ "EnumAudioEndpoints",
2344
+ )
2345
+ return coll.value
2346
+
2347
+
2348
+ def IMMDeviceCollection_GetCount(collection):
2349
+ if _use_ffi:
2350
+ count_buf = bytearray(4)
2351
+ _check(_vcall(collection, 3, "i", "p", count_buf), "IMMDeviceCollection.GetCount")
2352
+ return struct.unpack("<I", count_buf)[0]
2353
+ count = UINT32()
2354
+ _check(
2355
+ _vcall(collection, 3, HRESULT, (POINTER(UINT32),), byref(count)),
2356
+ "IMMDeviceCollection.GetCount",
2357
+ )
2358
+ return int(count.value)
2359
+
2360
+
2361
+ def IMMDeviceCollection_Item(collection, index):
2362
+ """Return the ``IMMDevice`` at ``index``; the caller releases it."""
2363
+ if _use_ffi:
2364
+ device_buf = bytearray(_PTR_SIZE)
2365
+ _check(
2366
+ _vcall(collection, 4, "i", "Ip", int(index), device_buf),
2367
+ "IMMDeviceCollection.Item",
2368
+ )
2369
+ return _ptr_read(uctypes.addressof(device_buf))
2370
+ device = c_void_p()
2371
+ _check(
2372
+ _vcall(collection, 4, HRESULT, (UINT, POINTER(c_void_p)), int(index), byref(device)),
2373
+ "IMMDeviceCollection.Item",
2374
+ )
2375
+ return device.value
2376
+
2377
+
2378
+ def IMMDevice_GetFriendlyName(device):
2379
+ """Return an endpoint's friendly name, such as ``"Speakers (USB Audio)"``.
2380
+
2381
+ Opens the endpoint's property store read-only and reads
2382
+ ``PKEY_Device_FriendlyName``. Returns None when the endpoint has no name.
2383
+ """
2384
+ if _use_ffi:
2385
+ store_buf = bytearray(_PTR_SIZE)
2386
+ _check(
2387
+ _vcall(device, 4, "i", "Ip", STGM_READ, store_buf),
2388
+ "IMMDevice.OpenPropertyStore",
2389
+ )
2390
+ store = _ptr_read(uctypes.addressof(store_buf))
2391
+ key = bytearray(_PKEY_Device_FriendlyName)
2392
+ value = bytearray(_PROPVARIANT_SIZE)
2393
+ try:
2394
+ _check(_vcall(store, 5, "i", "pp", key, value), "IPropertyStore.GetValue")
2395
+ vt = struct.unpack_from("<H", value, 0)[0]
2396
+ ptr = struct.unpack_from("<" + ("Q" if _IS_64 else "I"), value, 8)[0]
2397
+ name = _wstr_from_ptr(ptr) if vt == VT_LPWSTR and ptr else None
2398
+ _raw_PropVariantClear(value)
2399
+ finally:
2400
+ IUnknown_Release(store)
2401
+ return name
2402
+ store = c_void_p()
2403
+ _check(
2404
+ _vcall(device, 4, HRESULT, (DWORD, POINTER(c_void_p)), STGM_READ, byref(store)),
2405
+ "IMMDevice.OpenPropertyStore",
2406
+ )
2407
+ key = ctypes.create_string_buffer(_PKEY_Device_FriendlyName, len(_PKEY_Device_FriendlyName))
2408
+ value = ctypes.create_string_buffer(_PROPVARIANT_SIZE)
2409
+ try:
2410
+ _check(
2411
+ _vcall(store.value, 5, HRESULT, (LPVOID, LPVOID), ctypes.addressof(key), ctypes.addressof(value)),
2412
+ "IPropertyStore.GetValue",
2413
+ )
2414
+ vt = struct.unpack_from("<H", value.raw, 0)[0]
2415
+ ptr = struct.unpack_from("<" + ("Q" if _IS_64 else "I"), value.raw, 8)[0]
2416
+ name = ctypes.wstring_at(ptr) if vt == VT_LPWSTR and ptr else None
2417
+ ole32.PropVariantClear(ctypes.addressof(value))
2418
+ finally:
2419
+ IUnknown_Release(store.value)
2420
+ return name
2421
+
2422
+
2297
2423
  def WAVEFORMATEX_pcm(rate, channels, bits):
2298
2424
  fmt = WAVEFORMATEX()
2299
2425
  fmt.wFormatTag = WAVE_FORMAT_PCM