mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 20:10:08 +01:00
More steps on the sip 4.16 journey.
This commit is contained in:
8
b
8
b
@@ -2,10 +2,10 @@
|
||||
|
||||
##set -o xtrace
|
||||
|
||||
PYVER=2.7
|
||||
PYVER2=27
|
||||
#PYVER=3.2
|
||||
#PYVER2=32
|
||||
#PYVER=2.7
|
||||
#PYVER2=27
|
||||
PYVER=3.4
|
||||
PYVER2=34
|
||||
|
||||
if [ "$OSTYPE" = "cygwin" ]; then
|
||||
$TOOLS/python$PYVER2/python.exe -u build.py "$@"
|
||||
|
||||
8
build.py
8
build.py
@@ -59,11 +59,11 @@ 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-9e11298be101' # '4.14.7' #
|
||||
sipCurrentVersion = '4.16.7-snapshot-cf1ad8f7be68' # '4.14.7' #
|
||||
sipMD5 = {
|
||||
'darwin' : None, #'50e563860bc83c0ec913d5cb0a0e5536',
|
||||
'win32' : '208e8472342c07c2679868602d96a42b',
|
||||
'linux' : '382c01bae24ace03ec8ae1ba6d76351a',
|
||||
'darwin' : None, #'dfa5a6ec51fe2e1f8522b0823972fd22',
|
||||
'win32' : None, #'208e8472342c07c2679868602d96a42b',
|
||||
'linux' : None, #'382c01bae24ace03ec8ae1ba6d76351a',
|
||||
}
|
||||
|
||||
wafCurrentVersion = '1.7.15-p1'
|
||||
|
||||
@@ -75,6 +75,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 = new wxString(wxItemContainerImmutable::GetStringSelection());
|
||||
%End
|
||||
"""))
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
131
etg/vscroll.py
131
etg/vscroll.py
@@ -9,6 +9,7 @@
|
||||
|
||||
import etgtools
|
||||
import etgtools.tweaker_tools as tools
|
||||
from etgtools import WigCode
|
||||
|
||||
PACKAGE = "wx"
|
||||
MODULE = "_core"
|
||||
@@ -26,6 +27,8 @@ ITEMS = [ "wxVarScrollHelperBase",
|
||||
"wxHVScrolledWindow",
|
||||
]
|
||||
|
||||
KEEP_ALL = False
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def run():
|
||||
@@ -38,6 +41,12 @@ def run():
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
|
||||
|
||||
if KEEP_ALL:
|
||||
# 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
|
||||
|
||||
c = module.find('wxVarScrollHelperBase')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.find('OnGetUnitsSizeHint').ignore(False)
|
||||
@@ -45,12 +54,8 @@ def run():
|
||||
c.find('OnGetUnitSize').ignore(False)
|
||||
|
||||
|
||||
# SIP apparently has some issues when generating code for calling
|
||||
# virtuals in the base class when there is diamond inheritance going on,
|
||||
# it seems to confuse the compiler. By telling SIP that the methods are
|
||||
# reimplemented in the branches of the diamond (which they are in this
|
||||
# case) then that version of the generated code works better. We'll add
|
||||
# this block of declarations to each of the two helper classes below.
|
||||
# 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;
|
||||
@@ -61,24 +66,134 @@ def run():
|
||||
"""
|
||||
|
||||
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.addItem(etgtools.WigCode(baseVirtuals, protection='protected'))
|
||||
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.addItem(etgtools.WigCode(baseVirtuals, protection='protected'))
|
||||
c.find('RefreshColumns.from').name = 'from_'
|
||||
c.find('RefreshColumns.to').name = 'to_'
|
||||
|
||||
|
||||
|
||||
c = module.find('wxVarHVScrollHelper')
|
||||
# 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):
|
||||
code = """\
|
||||
{decl}
|
||||
%MethodCode
|
||||
{impl}
|
||||
%End
|
||||
%VirtualCallCode
|
||||
{impl}
|
||||
%End
|
||||
""".format(**locals())
|
||||
return code
|
||||
|
||||
for decl, impl in [
|
||||
('virtual wxCoord OnGetUnitSize(size_t unit) const;',
|
||||
'sipRes = wxVarVScrollHelper::OnGetUnitSize(unit);'),
|
||||
|
||||
('virtual void OnGetUnitsSizeHint(size_t unitMin, size_t unitMax) const;',
|
||||
'wxVarVScrollHelper::OnGetUnitsSizeHint(unitMin, unitMax);'),
|
||||
|
||||
('virtual wxCoord EstimateTotalSize() const;',
|
||||
'sipRes = wxVarVScrollHelper::EstimateTotalSize();'),
|
||||
|
||||
('virtual wxOrientation GetOrientation() const;',
|
||||
'sipRes = wxVarVScrollHelper::GetOrientation();'),
|
||||
|
||||
('virtual int GetOrientationTargetSize() const;',
|
||||
'sipRes = wxVarVScrollHelper::GetOrientationTargetSize();'),
|
||||
|
||||
('virtual int GetNonOrientationTargetSize() const;',
|
||||
'sipRes = wxVarVScrollHelper::GetNonOrientationTargetSize();'),
|
||||
]:
|
||||
c.addItem(WigCode(_baseVirtualHints(decl, impl), protection='protected'))
|
||||
|
||||
for decl, impl in [
|
||||
('virtual void UpdateScrollbar();',
|
||||
'wxVarVScrollHelper::UpdateScrollbar();'),
|
||||
|
||||
('virtual wxWindow* GetTargetWindow() const;',
|
||||
'sipRes = wxVarVScrollHelper::GetTargetWindow();'),
|
||||
|
||||
('virtual void SetTargetWindow(wxWindow* target);',
|
||||
'wxVarVScrollHelper::SetTargetWindow(target);'),
|
||||
|
||||
('virtual void RefreshAll();',
|
||||
'wxVarVScrollHelper::RefreshAll();'),
|
||||
]:
|
||||
c.addItem(WigCode(_baseVirtualHints(decl, impl), protection='public'))
|
||||
|
||||
|
||||
c = module.find('wxVScrolledWindow')
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
c = module.find('wxHScrolledWindow')
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
#c = module.find('wxHVScrolledWindow')
|
||||
#tools.fixWindowClass(c)
|
||||
|
||||
else:
|
||||
# This version will surgically exclude or unvirtualize things that
|
||||
# may be less important to Python code, in order to untangle the
|
||||
# multiple inheritance mess.
|
||||
|
||||
c = module.find('wxVarScrollHelperBase')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.abstract = True
|
||||
c.find('OnGetUnitsSizeHint').ignore()
|
||||
c.find('OnGetUnitSize').ignore()
|
||||
c.find('EstimateTotalSize').ignore()
|
||||
|
||||
c.find('GetOrientation').ignore()
|
||||
c.find('GetOrientationTargetSize').ignore()
|
||||
c.find('GetNonOrientationTargetSize').ignore()
|
||||
|
||||
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 wxOrientation GetOrientation() const;
|
||||
// virtual int GetOrientationTargetSize() const;
|
||||
// virtual int GetNonOrientationTargetSize() 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')
|
||||
|
||||
|
||||
c = module.find('wxVScrolledWindow')
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
Reference in New Issue
Block a user