Skip to content

Commit

Permalink
Lots of changes needed to get things building again after switching t…
Browse files Browse the repository at this point in the history
…o wxWidgets master
  • Loading branch information
RobinD42 committed Feb 9, 2018
1 parent f1a24d4 commit 87d7eda
Show file tree
Hide file tree
Showing 33 changed files with 219 additions and 65 deletions.
17 changes: 11 additions & 6 deletions etg/_glcanvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,18 @@ def run():

# We already have a MappedType for wxArrayInt, so just tweak the
# interfaces to use that instead of a const int pointer.
c.find('wxGLCanvas').ignore()
c.find('wxGLCanvas').findOverload('const int *attribList').ignore()
m = c.addCppCtor_sip(
argsString="""(
wxWindow* parent, wxWindowID id=wxID_ANY, wxArrayInt* attribList=NULL,
const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize,
long style=0, const wxString& name="GLCanvas",
const wxPalette& palette=wxNullPalette)""",
wxWindow* parent /TransferThis/,
wxWindowID id=wxID_ANY,
wxArrayInt* attribList=NULL,
const wxPoint& pos=wxDefaultPosition,
const wxSize& size=wxDefaultSize,
long style=0,
const wxString& name="GLCanvas",
const wxPalette& palette=wxNullPalette)
""",
cppSignature="""(
wxWindow* parent, wxWindowID id=wxID_ANY, const int* attribList=NULL,
const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize,
Expand All @@ -102,7 +107,7 @@ def run():
)


m = c.find('IsDisplaySupported')
m = c.find('IsDisplaySupported').findOverload('attribList')
m.find('attribList').type = 'wxArrayInt*'
m.setCppCode_sip("""\
const int* attribPtr = NULL;
Expand Down
4 changes: 4 additions & 0 deletions etg/_stc.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ def run():
EVT_STC_INDICATOR_RELEASE = wx.PyEventBinder( wxEVT_STC_INDICATOR_RELEASE, 1 )
EVT_STC_AUTOCOMP_CANCELLED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_CANCELLED, 1 )
EVT_STC_AUTOCOMP_CHAR_DELETED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_CHAR_DELETED, 1 )
EVT_STC_CLIPBOARD_COPY = wx.PyEventBinder( wxEVT_STC_CLIPBOARD_COPY, 1)
EVT_STC_CLIPBOARD_PASTE = wx.PyEventBinder( wxEVT_STC_CLIPBOARD_PASTE, 1)
EVT_STC_AUTOCOMP_COMPLETED = wx.PyEventBinder( wxEVT_STC_AUTOCOMP_COMPLETED, 1)
EVT_STC_MARGIN_RIGHT_CLICK = wx.PyEventBinder( wxEVT_STC_MARGIN_RIGHT_CLICK, 1)
""")

#-----------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions etg/apptrait.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def run():
]:
c.find(name).factory = True

c.find('GetToolkitVersion.major').out = True
c.find('GetToolkitVersion.minor').out = True
c.find('GetToolkitVersion.micro').out = True

#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
Expand Down
4 changes: 3 additions & 1 deletion etg/bitmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ def run():
c = module.find('wxBitmap')
assert isinstance(c, etgtools.ClassDef)
c.mustHaveApp()

tools.removeVirtuals(c)

# TODO: The wxCursor version of the ctor is not implemented on OSX...
c.find('wxBitmap').findOverload('wxCursor').ignore()

c.find('wxBitmap.bits').type = 'const char*'
c.find('wxBitmap.type').default = 'wxBITMAP_TYPE_ANY'
c.find('LoadFile.type').default = 'wxBITMAP_TYPE_ANY'
Expand Down
3 changes: 2 additions & 1 deletion etg/ctrlsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def pickOverloads(m):
assert isinstance(m, etgtools.MethodDef)
if 'void *' in m.argsString or \
'wxClientData **' in m.argsString or \
'wxString *' in m.argsString:
'wxString *' in m.argsString or \
'std::vector' in m.argsString:
m.ignore()

for m in c.findAll('Append'):
Expand Down
17 changes: 16 additions & 1 deletion etg/dataview.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,22 @@ def _fixupBoolGetters(method, sig):
method.find('value').type = 'wxDVCVariant&'
method.cppSignature = sig

def _fixupTypeParam(klass):
param = klass.findItem('{}.varianttype'.format(klass.name))
if param and param.default == 'GetDefaultType()':
param.default = '{}::GetDefaultType()'.format(klass.name)


c = module.find('wxDataViewRenderer')
c.addPrivateCopyCtor()
c.abstract = True
c.addAutoProperties()
c.find('GetView').ignore(False)

# TODO: This is only available when wxUSE_ACCESSIBILITY is set to 1
c.find('GetAccessibleDescription').ignore()

c.addAutoProperties()

# Change variant getters to return the value
for name, sig in [
('GetValue', 'bool (wxVariant& value)'),
Expand All @@ -264,6 +273,7 @@ def _fixupBoolGetters(method, sig):


c = module.find('wxDataViewCustomRenderer')
_fixupTypeParam(c)
m = c.find('GetValueFromEditorCtrl')
_fixupBoolGetters(m, 'bool (wxWindow * editor, wxVariant& value)')

Expand Down Expand Up @@ -305,6 +315,7 @@ def _fixupBoolGetters(method, sig):
]:
c = module.find(name)
c.addAutoProperties()
_fixupTypeParam(c)

c.addItem(etgtools.WigCode("""\
virtual bool SetValue( const wxDVCVariant &value ) [bool (const wxVariant& value)];
Expand Down Expand Up @@ -436,6 +447,10 @@ def _fixupBoolGetters(method, sig):
""")


# TODO: add support for wxVector templates
c.find('GetSortingColumns').ignore()


#-----------------------------------------------------------------
c = module.find('wxDataViewEvent')
tools.fixEventClass(c)
Expand Down
7 changes: 5 additions & 2 deletions etg/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

# The classes and/or the basename of the Doxygen XML files to be processed by
# this script.
ITEMS = [ 'defs_8h.xml' ]
ITEMS = [ 'defs_8h.xml',
'textfile_8h.xml',
]

#---------------------------------------------------------------------------

Expand Down Expand Up @@ -101,8 +103,9 @@ class wxExecuteEnv;
const int RELEASE_NUMBER;
"""))

# TODO: these should be removed someday
module.addPyCode("BG_STYLE_CUSTOM = BG_STYLE_PAINT")
module.addItem(etgtools.DefineDef(name='wxADJUST_MINSIZE', value='0'))
module.addPyCode("ADJUST_MINSIZE = 0")


#-----------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions etg/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ def run():
c.find('wxDialog.title').default = 'wxEmptyString'
c.find('Create.title').default = 'wxEmptyString'

# PocketPC only, don't think we'll need these ;)
c.find('DoOK').ignore()
c.find('GetToolBar').ignore()

# Uses a template, but it would be easier to reimplement it in Python if
Expand Down
19 changes: 8 additions & 11 deletions etg/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ def run():
// pointer and disconnect that one. Unfortunately since we
// wrapped the PyObject function pointer in another object we
// have to do the searching ourselves...
wxList::compatibility_iterator node = self->GetDynamicEventTable()->GetFirst();
while (node)
size_t cookie;
wxDynamicEventTableEntry *entry = self->GetFirstDynamicEntry(cookie);
while (entry)
{
wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData();
if ((entry->m_id == id) &&
((entry->m_lastId == lastId) || (lastId == wxID_ANY)) &&
((entry->m_eventType == eventType) || (eventType == wxEVT_NULL)) &&
Expand All @@ -247,12 +247,13 @@ def run():
// is evaluated. (!!!)
if (PyObject_RichCompareBool(cb->m_func, func, Py_EQ) == 1) {
delete cb;
self->GetDynamicEventTable()->Erase(node);
delete entry;
return true;
entry->m_callbackUserData = NULL;
// Now Disconnect should work
return self->Disconnect(id, lastId, eventType,
(wxObjectEventFunction)&wxPyCallback::EventThunker);
}
}
node = node->GetNext();
entry = self->GetNextDynamicEntry(cookie);
}
return false;
}
Expand All @@ -269,10 +270,6 @@ def run():
for m in c.find('CallAfter').all():
m.ignore()

# wxEventTable is not documented so we have to ignore SearchEventTable.
# TODO: Should wxEventTable be available to language bindings?
c.find('SearchEventTable').ignore()

c.find('QueueEvent.event').transfer = True
module.find('wxQueueEvent.event').transfer = True

Expand Down
3 changes: 3 additions & 0 deletions etg/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def run():
# TODO: maybe these should go into a tools.addFrameVirtuals function?
c.find('OnCreateStatusBar').isVirtual = True
c.find('OnCreateToolBar').isVirtual = True
c.find('DoGiveHelp').isVirtual = True

# TODO: support this
c.find('MSWGetTaskBarButton').ignore()

#-----------------------------------------------------------------
tools.doCommonTweaks(module)
Expand Down
2 changes: 1 addition & 1 deletion etg/fswatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def run():
# for platforms that have INOTIFY so we need to fake it elsewhere.
module.addHeaderCode("""
#include <wx/fswatcher.h>
#ifndef wxHAS_INOTIFY
#if !defined(wxHAS_INOTIFY) && !defined(wxHAVE_FSEVENTS_FILE_NOTIFICATIONS)
const int wxFSW_EVENT_UNMOUNT = 0x2000;
#endif
""")
Expand Down
1 change: 0 additions & 1 deletion etg/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def run():
c.find('GetRounded.y').out = True

# these have link errors
c.find('SetPolarCoordinates').ignore()
c.find('operator/=').findOverload('wxDouble').ignore()
c.find('operator*=').findOverload('wxDouble').ignore()

Expand Down
30 changes: 29 additions & 1 deletion etg/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ def markFactories(klass):
}
""")

# TODO: support this?
c.find('CreateFromNativeHDC').ignore()

#---------------------------------------------
c = module.find('wxGraphicsPath')
tools.removeVirtuals(c)
Expand All @@ -191,9 +194,34 @@ def markFactories(klass):
p.keepReference = True
c.find('CreateContextFromImage.image').keepReference = True

# FIXME: Handle wxEnhMetaFileDC?
# TODO: support this?
c.find('CreateContext').findOverload('wxEnhMetaFileDC').ignore()

# TODO: support this?
c.find('CreateContextFromNativeHDC').ignore()


c.find('GetGDIPlusRenderer').ignore()
c.addCppMethod('wxGraphicsRenderer*', 'GetGDIPlusRenderer', '()', isStatic=True,
doc="Returns GDI+ renderer (MSW only).",
body="""\
#ifdef __WXMSW__
return wxGraphicsRenderer::GetGDIPlusRenderer();
#else
return NULL;
#endif
""")

c.find('GetDirect2DRenderer').ignore()
c.addCppMethod('wxGraphicsRenderer*', 'GetDirect2DRenderer', '()', isStatic=True,
doc="Returns Direct2D renderer (MSW only).",
body="""\
#ifdef __WXMSW__
return wxGraphicsRenderer::GetDirect2DRenderer();
#else
return NULL;
#endif
""")

#---------------------------------------------
c = module.find('wxGraphicsMatrix')
Expand Down
7 changes: 7 additions & 0 deletions etg/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,10 @@ def fixEditorClass(name):
c.find('SetValueAsCustom').ignore()


#-----------------------------------------------------------------
c = module.find('wxGridStringTable')
c.addPrivateCopyCtor()


#-----------------------------------------------------------------
c = module.find('wxGridTableMessage')
Expand Down Expand Up @@ -474,6 +478,9 @@ def fixEditorClass(name):
Grid.wxGridSelectRowsOrColumns = Grid.SelectRowsOrColumns
""")

c.find('SetCellAlignment').findOverload('align').ignore()
c.find('SetCellTextColour').overloads = []

#-----------------------------------------------------------------
c = module.find('wxGridUpdateLocker')
c.addPrivateCopyCtor()
Expand Down
4 changes: 4 additions & 0 deletions etg/htmltag.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def run():
for m in c.findAll('ScanParam'):
m.ignore()

c.find('GetBeginPos').ignore()
c.find('GetEndPos1').ignore()
c.find('GetEndPos2').ignore()

#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
Expand Down
5 changes: 5 additions & 0 deletions etg/iconbndl.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def run():
assert isinstance(c, etgtools.ClassDef)
c.mustHaveApp()

# Ignore the overloads that require a WXHINSTANCE
c.find('wxIconBundle').findOverload('WXHINSTANCE').ignore()
c.find('AddIcon').findOverload('WXHINSTANCE').ignore()


#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
Expand Down
1 change: 1 addition & 0 deletions etg/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def run():

c = module.find('wxLogStderr')
c.find('wxLogStderr.fp').ignore()
c.find('wxLogStderr.conv').ignore()
c.addPrivateCopyCtor()
c.addPrivateAssignOp()

Expand Down
2 changes: 1 addition & 1 deletion etg/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def addTransferAnnotations(c, arg):
GetMenus() -> (menu, label)\n
Return a list of (menu, label) items for the menus in the :class:`MenuBar`.""",
body="""\
return [(self.GetMenu(i), self.GetLabelTop(i)) for i in range(self.GetMenuCount())]
return [(self.GetMenu(i), self.GetMenuLabel(i)) for i in range(self.GetMenuCount())]
""")
c.addPyMethod('SetMenus', '(self, items)',
doc="""\
Expand Down
19 changes: 19 additions & 0 deletions etg/notifmsg.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ def run():
c = module.find('wxNotificationMessage')
assert isinstance(c, etgtools.ClassDef)

# take care of some methods only available on MSW
c.find('UseTaskBarIcon').setCppCode("""\
#ifdef __WXMSW__
return wxNotificationMessage::UseTaskBarIcon(icon);
#else
wxPyRaiseNotImplemented();
return NULL;
#endif
""")

c.find('MSWUseToasts').setCppCode("""\
#ifdef __WXMSW__
return wxNotificationMessage::MSWUseToasts(*shortcutPath, *appId);
#else
wxPyRaiseNotImplemented();
return false;
#endif
""")


#-----------------------------------------------------------------
tools.doCommonTweaks(module)
Expand Down
3 changes: 2 additions & 1 deletion etg/odcombo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run():
tools.fixWindowClass(c)


# Ignore the old C array verison of the ctor and Create methods, and
# Ignore the old C array version of the ctor and Create methods, and
# fixup the remaining ctor and Create with the typical default values for
# the args
c.find('wxOwnerDrawnComboBox').findOverload('wxString choices').ignore()
Expand All @@ -52,6 +52,7 @@ def run():
m.find('value').default = 'wxEmptyString'
m.find('choices').default = 'wxArrayString()'

c.find('IsEmpty').ignore()

# Unignore the protected methods that should be overridable in Python
c.find('OnDrawBackground').ignore(False).isVirtual = True
Expand Down
Loading

0 comments on commit 87d7eda

Please sign in to comment.