From d6bda86a0ee2991ea7ef4b1abbf7c9d24fc814f2 Mon Sep 17 00:00:00 2001
From: Robin Dunn <>
Date: Wed, 7 Aug 2019 20:12:50 -0700
Subject: [PATCH] Some docstring updates, and add wx.svg to the docs to be
built
---
build.py | 2 +-
docs/sphinx/rest_substitutions/overviews/index.rst | 9 +++++++++
wx/svg/__init__.py | 13 +++++++++++--
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/build.py b/build.py
index 4f9669ff..a342493e 100755
--- a/build.py
+++ b/build.py
@@ -1095,7 +1095,7 @@ def cmd_wxlib(options, args):
cmdTimer = CommandTimer('wx.lib')
pwd = pushDir(phoenixDir())
- for wx_pkg in ['lib', 'py', 'tools']:
+ for wx_pkg in ['lib', 'py', 'svg', 'tools']:
libDir = os.path.join(phoenixDir(), 'wx', wx_pkg)
if not os.path.isdir(libDir):
diff --git a/docs/sphinx/rest_substitutions/overviews/index.rst b/docs/sphinx/rest_substitutions/overviews/index.rst
index 7da348f7..37dc6a6c 100644
--- a/docs/sphinx/rest_substitutions/overviews/index.rst
+++ b/docs/sphinx/rest_substitutions/overviews/index.rst
@@ -74,6 +74,8 @@ and launch the wxPython demo for you.
wx.aui
Docking/floating window panes, draggable notebook tabs, etc.
+ wx.svg
+ Classes to parse and render Scalable Vector Graphics files.
@@ -149,3 +151,10 @@ and launch the wxPython demo for you.
wx.lib
wx.py
wx.tools
+ wx.svg
+
+.. automodule:: wx.svg._nanosvg
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
\ No newline at end of file
diff --git a/wx/svg/__init__.py b/wx/svg/__init__.py
index 9c548d4b..964a6e05 100644
--- a/wx/svg/__init__.py
+++ b/wx/svg/__init__.py
@@ -10,7 +10,9 @@
# Licence: wxWindows license
#----------------------------------------------------------------------
"""
+wx.svg docstring (TBW)
"""
+
import wx
from six.moves import zip_longest
@@ -21,21 +23,28 @@ from ._nanosvg import *
# let's leave this in place in case it's needed again in the future.
_RenderersWithoutGradientTransforms = []
+
class SVGimage(SVGimageBase):
"""
+ SVGimage docstring (TBW)
"""
def RasterizeToBitmap(self, tx=0.0, ty=0.0, scale=1.0,
width=-1, height=-1, stride=-1):
"""
+ SVGimage.RasterizeToBitmap docstring (TBW)
"""
- buff = self.RasterizeToBytes(tx, ty, scale, width, height, stride)
- bmp = wx.Bitmap.FromBufferRGBA(width, height, buff)
+ buf = self.RasterizeToBytes(tx, ty, scale, width, height, stride)
+ # import numpy as np
+ # buf = np.zeros((width, height, 4), np.uint8)
+ # self.RasterizeToBuffer(buf, tx, ty, scale, width, height, stride)
+ bmp = wx.Bitmap.FromBufferRGBA(width, height, buf)
return bmp
def RenderToGC(self, ctx, scale=None, size=None, translate=(0.0, 0.0)):
"""
+ SVGimage.RenderToGC docstring (TBW)
"""
ctx.PushState()
# set scale either from the parameter or as ratio of sizes
|