More sip-4.16 work. The build now completes w/o errors.

This commit is contained in:
Robin Dunn
2015-03-23 09:09:32 -07:00
parent 211b10d175
commit b553f66b25
7 changed files with 115 additions and 23 deletions

View File

@@ -59,9 +59,9 @@ wxICON = 'docs/sphinx/_static/images/sphinxdocs/mondrian.png'
# Some tools will be downloaded for the builds. These are the versions and
# MD5s of the tool binaries currently in use.
sipCurrentVersion = '4.16.7-snapshot-cf1ad8f7be68' # '4.14.7' #
sipCurrentVersion = '4.16.7-snapshot-bd92aad3cf7d' # '4.14.7' #
sipMD5 = {
'darwin' : None, #'dfa5a6ec51fe2e1f8522b0823972fd22',
'darwin' : None, #'eb1ecdd8806fed1b68487e182ef32b77',
'win32' : None, #'208e8472342c07c2679868602d96a42b',
'linux' : None, #'382c01bae24ace03ec8ae1ba6d76351a',
}

View File

@@ -78,10 +78,10 @@ def run():
virtual wxString GetStringSelection() const;
%MethodCode
sipRes = new wxString(sipCpp->wxItemContainerImmutable::GetStringSelection());
sipRes = new wxString(sipCpp->wxItemContainerImmutable::GetStringSelection());
%End
%VirtualCallCode
sipRes = new wxString(wxItemContainerImmutable::GetStringSelection());
sipRes = wxItemContainerImmutable::GetStringSelection();
%End
"""))

View File

@@ -359,6 +359,16 @@ def run():
return val
""")
# SIP will normally try to add support for overriding this method since
# it is inherited from super classes, but in this case we want it to be
# ignored (because IRL it is private in one of the intermediate classes)
# so we'll tell SIP that it is private here instead.
c.addItem(etgtools.WigCode("""\
wxSize GetSizeAvailableForScrollTarget(const wxSize& size);
""", protection='private'))
#-----------------------------------------------------------------
c = module.find('wxGridUpdateLocker')
c.addPrivateCopyCtor()

View File

@@ -67,6 +67,14 @@ def run():
virtual void SetString(unsigned int n, const wxString& s);
virtual int GetSelection() const;
virtual void SetSelection(int n);
virtual wxString GetStringSelection() const;
%MethodCode
sipRes = new wxString(sipCpp->wxItemContainerImmutable::GetStringSelection());
%End
%VirtualCallCode
sipRes = wxItemContainerImmutable::GetStringSelection();
%End
"""))
# wxComboCtrl virtuals that have an implementation in this class

View File

@@ -27,7 +27,7 @@ ITEMS = [ "wxVarScrollHelperBase",
"wxHVScrolledWindow",
]
KEEP_ALL = False
KEEP_ALL = 3
#---------------------------------------------------------------------------
@@ -42,7 +42,7 @@ def run():
if KEEP_ALL:
if KEEP_ALL == 1:
# First (more like 3rd...) attempt. Try to keep all the classes and
# virtuals available to Python, and untangle things using SIP's
# directive's etc. as needed
@@ -87,53 +87,63 @@ def run():
# This class is the bottom of a diamond inheritance hierarchy, and since
# the same virtual methods may be inherited from both sides we need to
# help the generator know which version of the methods to call.
def _baseVirtualHints(decl, impl):
def _baseVirtualHints(decl, methCode, vCallCode):
code = """\
{decl}
%MethodCode
{impl}
{methCode}
%End
%VirtualCallCode
{impl}
{vCallCode}
%End
""".format(**locals())
return code
for decl, impl in [
for decl, methCode, vCallCode in [
('virtual wxCoord OnGetUnitSize(size_t unit) const;',
'sipRes = sipCpp->wxVarVScrollHelper::OnGetUnitSize(unit);',
'sipRes = wxVarVScrollHelper::OnGetUnitSize(unit);'),
('virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const;',
'sipCpp->wxVarVScrollHelper::OnGetUnitsSizeHint(unitMin, unitMax);',
'wxVarVScrollHelper::OnGetUnitsSizeHint(unitMin, unitMax);'),
('virtual wxCoord EstimateTotalSize() const;',
'sipRes = sipCpp->wxVarVScrollHelper::EstimateTotalSize();',
'sipRes = wxVarVScrollHelper::EstimateTotalSize();'),
('virtual wxOrientation GetOrientation() const;',
'sipRes = sipCpp->wxVarVScrollHelper::GetOrientation();',
'sipRes = wxVarVScrollHelper::GetOrientation();'),
('virtual int GetOrientationTargetSize() const;',
'sipRes = sipCpp->wxVarVScrollHelper::GetOrientationTargetSize();',
'sipRes = wxVarVScrollHelper::GetOrientationTargetSize();'),
('virtual int GetNonOrientationTargetSize() const;',
'sipRes = wxVarVScrollHelper::GetNonOrientationTargetSize();'),
'sipRes = sipCpp->wxVarVScrollHelper::GetNonOrientationTargetSize();',
'sipRes = wxVarVScrollHelper::GetNonOrientationTargetSize();'),
]:
c.addItem(WigCode(_baseVirtualHints(decl, impl), protection='protected'))
c.addItem(WigCode(_baseVirtualHints(decl, methCode, vCallCode), protection='protected'))
for decl, impl in [
for decl, methCode, vCallCode in [
('virtual void UpdateScrollbar();',
'sipCpp->wxVarVScrollHelper::UpdateScrollbar();',
'wxVarVScrollHelper::UpdateScrollbar();'),
('virtual wxWindow* GetTargetWindow() const;',
'sipRes = sipCpp->wxVarVScrollHelper::GetTargetWindow();',
'sipRes = wxVarVScrollHelper::GetTargetWindow();'),
('virtual void SetTargetWindow(wxWindow* target);',
'sipCpp->wxVarVScrollHelper::SetTargetWindow(target);',
'wxVarVScrollHelper::SetTargetWindow(target);'),
('virtual void RefreshAll();',
'sipCpp->wxVarVScrollHelper::RefreshAll();',
'wxVarVScrollHelper::RefreshAll();'),
]:
c.addItem(WigCode(_baseVirtualHints(decl, impl), protection='public'))
c.addItem(WigCode(_baseVirtualHints(decl, methCode, vCallCode), protection='public'))
c = module.find('wxVScrolledWindow')
@@ -145,7 +155,9 @@ def run():
#c = module.find('wxHVScrolledWindow')
#tools.fixWindowClass(c)
else:
elif KEEP_ALL == 2:
# This version will surgically exclude or unvirtualize things that
# may be less important to Python code, in order to untangle the
# multiple inheritance mess.
@@ -190,10 +202,69 @@ def run():
c.find('RefreshColumns.from').name = 'from_'
c.find('RefreshColumns.to').name = 'to_'
c = module.find('wxVarHVScrollHelper')
c = module.find('wxVScrolledWindow')
tools.fixWindowClass(c)
c = module.find('wxHScrolledWindow')
tools.fixWindowClass(c)
#c = module.find('wxHVScrolledWindow')
#tools.fixWindowClass(c)
elif KEEP_ALL == 3:
c = module.find('wxVarScrollHelperBase')
assert isinstance(c, etgtools.ClassDef)
c.abstract = True
c.find('OnGetUnitsSizeHint').ignore(False)
c.find('EstimateTotalSize').ignore(False)
c.find('OnGetUnitSize').ignore(False)
c.find('GetTargetWindow').isVirtual = False
c.find('SetTargetWindow').isVirtual = False
c.find('RefreshAll').isVirtual = False
c.find('UpdateScrollbar').isVirtual = False
# Ensure that SIP knows that there are implementations of these base
# class virtual methods in each of the two helper classes below.
baseVirtuals = """\
virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const;
virtual wxCoord EstimateTotalSize() const;
virtual int GetNonOrientationTargetSize() const;
virtual wxOrientation GetOrientation() const;
virtual int GetOrientationTargetSize() const;
virtual wxCoord OnGetUnitSize(size_t unit) const;
"""
c = module.find('wxVarVScrollHelper')
c.addItem(WigCode(baseVirtuals, protection='protected'))
c.find('EstimateTotalHeight').ignore(False)
c.find('OnGetRowsHeightHint').ignore(False)
c.find('OnGetRowHeight').ignore(False)
c.find('RefreshRows.from').name = 'from_'
c.find('RefreshRows.to').name = 'to_'
c = module.find('wxVarHScrollHelper')
c.addItem(WigCode(baseVirtuals, protection='protected'))
c.find('EstimateTotalWidth').ignore(False)
c.find('OnGetColumnsWidthHint').ignore(False)
c.find('OnGetColumnWidth').ignore(False)
c.find('RefreshColumns.from').name = 'from_'
c.find('RefreshColumns.to').name = 'to_'
c = module.find('wxVarHVScrollHelper')
# For this class those methods shouldn't be overridden, (since there
# are orientation-specfic versions in the 2 superclasses) so tell SIP
# that they are private so it won't add support for them and end up
# with multiple inheritance ambiguities.
c.addItem(WigCode(baseVirtuals, protection='private'))
c = module.find('wxVScrolledWindow')
tools.fixWindowClass(c)

View File

@@ -55,7 +55,7 @@ extern "C" {
* Define the SIP version number.
*/
#define SIP_VERSION 0x041007
#define SIP_VERSION_STR "4.16.7-snapshot-9e11298be101"
#define SIP_VERSION_STR "4.16.7-snapshot-bd92aad3cf7d"
/*

View File

@@ -3720,8 +3720,7 @@ static int parsePass1(PyObject **parseErrp, sipSimpleWrapper **selfp,
if (nr_kwd_args_used == 0 && unused != NULL)
{
Py_INCREF(sipKwdArgs);
*unused = sipKwdArgs;
failure.reason = TooMany;
*unused = sipKwdArgs;
}
else
{
@@ -9632,7 +9631,7 @@ static int sipSimpleWrapper_init(sipSimpleWrapper *self, PyObject *args,
sipTypeDef *td = wt->type;
sipClassTypeDef *ctd = (sipClassTypeDef *)td;
PyObject *unused = NULL;
sipFinalFunc final_func;
sipFinalFunc final_func = find_finalisation(ctd);
/* Check for an existing C++ instance waiting to be wrapped. */
if (sipGetPending(&sipNew, &owner, &sipFlags) < 0)
@@ -9640,12 +9639,16 @@ static int sipSimpleWrapper_init(sipSimpleWrapper *self, PyObject *args,
if (sipNew == NULL)
{
PyObject *parseErr = NULL;
PyObject *parseErr = NULL, **unused_p = NULL;
/* See if we are interested in any unused keyword arguments. */
if (sipTypeCallSuperInit(&ctd->ctd_base) || final_func != NULL || kw_handler != NULL)
unused_p = &unused;
/* Call the C++ ctor. */
owner = NULL;
sipNew = ctd->ctd_init(self, args, kwds, &unused, (PyObject **)&owner,
sipNew = ctd->ctd_init(self, args, kwds, unused_p, (PyObject **)&owner,
&parseErr);
if (sipNew != NULL)