Some docstring updates, and add wx.svg to the docs to be built

This commit is contained in:
Robin Dunn
2019-08-07 20:12:50 -07:00
committed by Robin Dunn
parent 43c2b5c96c
commit d6bda86a0e
3 changed files with 21 additions and 3 deletions

View File

@@ -1095,7 +1095,7 @@ def cmd_wxlib(options, args):
cmdTimer = CommandTimer('wx.lib') cmdTimer = CommandTimer('wx.lib')
pwd = pushDir(phoenixDir()) 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) libDir = os.path.join(phoenixDir(), 'wx', wx_pkg)
if not os.path.isdir(libDir): if not os.path.isdir(libDir):

View File

@@ -74,6 +74,8 @@ and launch the wxPython demo for you.
<p class="mybiglink"><a class="mybiglink" href="wx.aui.1moduleindex.html">wx.aui</a><br/> <p class="mybiglink"><a class="mybiglink" href="wx.aui.1moduleindex.html">wx.aui</a><br/>
<span class="linkdescr">Docking/floating window panes, draggable notebook tabs, etc.</span></p> <span class="linkdescr">Docking/floating window panes, draggable notebook tabs, etc.</span></p>
<p class="mybiglink"><a class="mybiglink" href="wx.svg.html">wx.svg</a><br/>
<span class="linkdescr">Classes to parse and render Scalable Vector Graphics files.</span></p>
</td> </td>
<td valign="top" width="50%" style="margin-left: 5px"> <td valign="top" width="50%" style="margin-left: 5px">
@@ -149,3 +151,10 @@ and launch the wxPython demo for you.
wx.lib wx.lib
wx.py wx.py
wx.tools wx.tools
wx.svg
.. automodule:: wx.svg._nanosvg
:members:
:undoc-members:
:show-inheritance:

View File

@@ -10,7 +10,9 @@
# Licence: wxWindows license # Licence: wxWindows license
#---------------------------------------------------------------------- #----------------------------------------------------------------------
""" """
wx.svg docstring (TBW)
""" """
import wx import wx
from six.moves import zip_longest 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. # let's leave this in place in case it's needed again in the future.
_RenderersWithoutGradientTransforms = [] _RenderersWithoutGradientTransforms = []
class SVGimage(SVGimageBase): class SVGimage(SVGimageBase):
""" """
SVGimage docstring (TBW)
""" """
def RasterizeToBitmap(self, tx=0.0, ty=0.0, scale=1.0, def RasterizeToBitmap(self, tx=0.0, ty=0.0, scale=1.0,
width=-1, height=-1, stride=-1): width=-1, height=-1, stride=-1):
""" """
SVGimage.RasterizeToBitmap docstring (TBW)
""" """
buff = self.RasterizeToBytes(tx, ty, scale, width, height, stride) buf = self.RasterizeToBytes(tx, ty, scale, width, height, stride)
bmp = wx.Bitmap.FromBufferRGBA(width, height, buff) # 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 return bmp
def RenderToGC(self, ctx, scale=None, size=None, translate=(0.0, 0.0)): def RenderToGC(self, ctx, scale=None, size=None, translate=(0.0, 0.0)):
""" """
SVGimage.RenderToGC docstring (TBW)
""" """
ctx.PushState() ctx.PushState()
# set scale either from the parameter or as ratio of sizes # set scale either from the parameter or as ratio of sizes