diff --git a/etg/progdlg.py b/etg/progdlg.py index c592e874..fe47f2d4 100644 --- a/etg/progdlg.py +++ b/etg/progdlg.py @@ -46,7 +46,6 @@ 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 @@ -59,6 +58,7 @@ def run(): not item.isDtor): c.addItem(copy.deepcopy(item)) + tools.fixWindowClass(c) #----------------------------------------------------------------- tools.doCommonTweaks(module) diff --git a/etgtools/tweaker_tools.py b/etgtools/tweaker_tools.py index 5938312f..337ea971 100644 --- a/etgtools/tweaker_tools.py +++ b/etgtools/tweaker_tools.py @@ -261,17 +261,27 @@ def fixWindowClass(klass, hideVirtuals=True, ignoreProtected=True): removeVirtuals(klass) addWindowVirtuals(klass) - if not klass.findItem('GetClassDefaultAttributes'): - klass.addItem(extractors.WigCode("""\ - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - """)) - if not ignoreProtected: for item in klass.allItems(): if isinstance(item, extractors.MethodDef) and item.protection == 'protected': item.ignore(False) + fixDefaultAttributesMethods(klass) + + +def fixDefaultAttributesMethods(klass): + if not klass.findItem('GetClassDefaultAttributes'): + m = extractors.MethodDef( + type='wxVisualAttributes', name='GetClassDefaultAttributes', + isStatic=True, protection='public', + items=[extractors.ParamDef( + type='wxWindowVariant', name='variant', default='wxWINDOW_VARIANT_NORMAL')] + ) + klass.addItem(m) + + if klass.findItem('GetDefaultAttributes'): + klass.find('GetDefaultAttributes').mustHaveApp() + klass.find('GetClassDefaultAttributes').mustHaveApp() def fixTopLevelWindowClass(klass, hideVirtuals=True, ignoreProtected=True): @@ -308,6 +318,8 @@ def fixTopLevelWindowClass(klass, hideVirtuals=True, ignoreProtected=True): if isinstance(item, extractors.MethodDef) and item.protection == 'protected': item.ignore(False) + fixDefaultAttributesMethods(klass) + def fixSizerClass(klass):