mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 11:30:06 +01:00
Generate optional stubs for the wxFileSystemWatcher* classes
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -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
|
||||
""")
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user