Merge branch 'wxPy-4.0.x' into release-prep

This commit is contained in:
Robin Dunn
2019-01-03 22:17:39 -08:00
5 changed files with 24 additions and 3 deletions

View File

@@ -113,7 +113,7 @@ Changes in this release include the following:
* Added the ability to generate stub classes for use when optional wxWidgets
features are not part of the build. So far, stubs are available for
wx.Accessible, wx.glcanvas, wx.media and wx.html2.
wx.Accessible, wx.FileSystemWatcher, wx.glcanvas, wx.media and wx.html2.
* Moved the wxpy_api.h file into the wx package at wx/include/wxPython so it
will be included in the wheel file. (#961)

View File

@@ -6108,6 +6108,7 @@
"USER_ATTENTION_ERROR":"wx.",
"USER_ATTENTION_INFO":"wx.",
"USE_ACCESSIBILITY":"wx.",
"USE_FSWATCHER":"wx.",
"USE_GLCANVAS":"wx.glcanvas.",
"USE_JOYSTICK":"wx.adv.",
"USE_MEDIACTRL":"wx.media.",

View File

@@ -32,11 +32,22 @@ def run():
# Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings.
c = module.find('wxFileSystemWatcherEvent')
assert isinstance(c, etgtools.ClassDef)
c.addItem(etgtools.MethodDef(name='Clone', type='wxEvent*', argsString='() const',
isConst=True, isVirtual=True))
tools.generateStubs('wxUSE_FSWATCHER', module,
extraHdrCode='static wxFileName _NullFileName;\n',
typeValMap={'const wxFileName &': '_NullFileName',
'wxFSWWarningType': 'wxFSW_WARNING_NONE'}
)
# In the C++ code the wxFSW_EVENT_UNMOUNT item is only part of the enum
# for platforms that have INOTIFY so we need to fake it elsewhere.
module.addHeaderCode("""
#include <wx/fswatcher.h>
#ifndef wxHAS_INOTIFY
#if wxUSE_FSWATCHER && !defined(wxHAS_INOTIFY)
const int wxFSW_EVENT_UNMOUNT = 0x2000;
#endif
""")

View File

@@ -1270,7 +1270,8 @@ def guessTypeStr(v):
# generating stubs then we can still provide the wrapper classes but simply
# have them raise NotImplemented errors or whatnot.
def generateStubs(cppFlag, module, excludes=[], typeValMap={}):
def generateStubs(cppFlag, module, excludes=[], typeValMap={},
extraHdrCode=None, extraCppCode=None):
"""
Generate C++ stubs for all items in the module, except those that are
in the optional excludes list.
@@ -1306,6 +1307,12 @@ def generateStubs(cppFlag, module, excludes=[], typeValMap={}):
if isinstance(item, extractors.ClassDef):
code.hdr.append('class {};'.format(item.name))
if extraHdrCode:
code.hdr.append(extraHdrCode)
if extraCppCode:
code.cpp.append(extraCppCode)
# Now write code for all the items in the module.
for item in module:
if item.name in excludes:

View File

@@ -2135,6 +2135,8 @@ class ScaledBitmap(TextObjectMixin, DrawObject):
self.Image = Bitmap.ConvertToImage()
elif type(Bitmap) == wx.Image:
self.Image = Bitmap
else:
raise ValueError("'Bitmap' must be a wx.Bitmap or wx.Image object not %s" % type(Bitmap))
self.XY = XY
self.Height = Height