From fcf0d8cc178a847ec133a16b3e1680e843f4873e Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 22 Jan 2018 11:52:36 -0800 Subject: [PATCH] Copy methods from wxGenericProgressDialog to wxProgressDialog. This is needed because some of the methods are non-virtual, and they are reimplemented in the MSW version of wxProgressDialog. In order for those methods to be called they need to have wrappers generated. --- CHANGES.rst | 3 ++- etg/progdlg.py | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 189df972..bec74e38 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -106,7 +106,8 @@ Changes in this release include the following: * Fix displaying '&' in the label of wx.RadioBox on GTK. (#39) - +* Fix problems of the wrong C++ method being called in wx.ProgressDialog on MS + Windows. (#701) diff --git a/etg/progdlg.py b/etg/progdlg.py index f454185a..c34efa32 100644 --- a/etg/progdlg.py +++ b/etg/progdlg.py @@ -9,6 +9,7 @@ import etgtools import etgtools.tweaker_tools as tools +import copy PACKAGE = "wx" MODULE = "_core" @@ -34,7 +35,7 @@ def run(): module.addHeaderCode("#include ") - c = module.find('wxGenericProgressDialog') + c = gpd = module.find('wxGenericProgressDialog') assert isinstance(c, etgtools.ClassDef) tools.fixWindowClass(c)#, False) @@ -47,6 +48,18 @@ def run(): c = module.find('wxProgressDialog') tools.fixWindowClass(c) + # Copy methods from the generic to the native class. This is needed + # because none of the methods are declared in the interface files, and + # since on MSW some non-virtual methods are reimplemented in + # wxProgressDialogs they will not be called if SIP doesn't know about + # them. We'll copy all of them and let the C++ compiler sort things out. + for item in gpd: + if (isinstance(item, etgtools.MethodDef) and + not item.isCtor and + not item.isDtor): + c.addItem(copy.deepcopy(item)) + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)