Skip to content

Commit

Permalink
Some docstring updates, and add wx.svg to the docs to be built
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Dunn committed Aug 8, 2019
1 parent e979af6 commit e59d160
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
9 changes: 9 additions & 0 deletions docs/sphinx/rest_substitutions/overviews/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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/>
<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 valign="top" width="50%" style="margin-left: 5px">
Expand Down Expand Up @@ -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:

13 changes: 11 additions & 2 deletions wx/svg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
# Licence: wxWindows license
#----------------------------------------------------------------------
"""
wx.svg docstring (TBW)
"""

import wx
from six.moves import zip_longest

Expand All @@ -21,21 +23,28 @@
# 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
Expand Down

0 comments on commit e59d160

Please sign in to comment.