Populate wx.svg with _nanosvg enum values.

This is for compatibility with wxpython 4.2.2 and any version compiled
with cython 3.1.

Added test cases for these enum values.
This commit is contained in:
udifuchs
2025-11-13 15:40:58 -06:00
parent afddb14f78
commit 7c7a7eea62
2 changed files with 46 additions and 1 deletions

View File

@@ -77,6 +77,15 @@ cpdef enum SVGfillRule:
cpdef enum SVGflags:
SVG_FLAGS_VISIBLE = NSVG_FLAGS_VISIBLE
# Populate the module namespace with enum values to keep compatibility with packages
# compiled with cython > 3.1 (see https://github.com/cython/cython/issues/4571)
globals().update(getattr(SVGpaintType, "__members__"))
globals().update(getattr(SVGspreadType, "__members__"))
globals().update(getattr(SVGlineJoin, "__members__"))
globals().update(getattr(SVGlineCap, "__members__"))
globals().update(getattr(SVGfillRule, "__members__"))
globals().update(getattr(SVGflags, "__members__"))
#----------------------------------------------------------------------------
# Cython classes for wrapping the nanosvg structs