Python API improvements: Vectors, bounds, window singleton, hidden types

- #177: GridPoint.grid_pos property returns (x, y) tuple
- #179: Grid.grid_size returns Vector instead of tuple
- #181: Grid.center returns Vector instead of tuple
- #182: Caption.size/w/h read-only properties for text dimensions
- #184: mcrfpy.window singleton for window access
- #185: Removed get_bounds() method, use .bounds property instead
- #188: bounds/global_bounds return (pos, size) as pair of Vectors
- #189: Hide internal types from module namespace (iterators, collections)

Also fixed critical bug: Changed static PyTypeObject to inline in headers
to ensure single instance across translation units (was causing segfaults).

Closes #177, closes #179, closes #181, closes #182, closes #184, closes #185, closes #188, closes #189

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John McCardle 2026-01-05 23:00:48 -05:00
commit f9b6cdef1c
17 changed files with 448 additions and 87 deletions

35
tests/test_layer_docs.py Normal file
View file

@ -0,0 +1,35 @@
#!/usr/bin/env python3
"""Test layer documentation"""
import sys
import mcrfpy
print("Testing layer documentation (#190)...")
# Verify layer types exist and have docstrings
print("Checking TileLayer...")
if not hasattr(mcrfpy, 'TileLayer'):
print("FAIL: TileLayer should exist")
sys.exit(1)
print("Checking ColorLayer...")
if not hasattr(mcrfpy, 'ColorLayer'):
print("FAIL: ColorLayer should exist")
sys.exit(1)
# Check that docstrings exist and contain useful info
tile_doc = mcrfpy.TileLayer.__doc__
color_doc = mcrfpy.ColorLayer.__doc__
print(f"TileLayer.__doc__ length: {len(tile_doc) if tile_doc else 0}")
print(f"ColorLayer.__doc__ length: {len(color_doc) if color_doc else 0}")
if tile_doc is None or len(tile_doc) < 50:
print(f"FAIL: TileLayer should have substantial docstring")
sys.exit(1)
if color_doc is None or len(color_doc) < 50:
print(f"FAIL: ColorLayer should have substantial docstring")
sys.exit(1)
print("PASS: Layer documentation exists!")
sys.exit(0)