From c76880a6c3d278e01327f447efce2c15235e6d26 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 12 Sep 2017 16:07:44 -0700 Subject: [PATCH] Ensure all window classes declare GetClassDefaultAttributes. Many do not actually have it, but the docs only declare it in wx.Window so we will miss the ones that really do have one unless we let sip know about them. --- etgtools/tweaker_tools.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/etgtools/tweaker_tools.py b/etgtools/tweaker_tools.py index a4ef4de6..ba93f0f8 100644 --- a/etgtools/tweaker_tools.py +++ b/etgtools/tweaker_tools.py @@ -229,7 +229,7 @@ def fixWindowClass(klass, hideVirtuals=True, ignoreProtected=True): """ Do common tweaks for a window class. """ - # NOTE: it may be okay to just do this for top-level windows + # NOTE: it may be okay to just do mustHaveApp for top-level windows # TODO: look into that possibility klass.mustHaveApp() @@ -261,6 +261,12 @@ 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':