From f993afa72364bce7704f59d028c3b5139870eb40 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 8 Jun 2022 18:08:20 -0700 Subject: [PATCH] Change wx.FileDialogCustomize.AddChoice to accept a list of strings --- etg/filedlgcustomize.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/etg/filedlgcustomize.py b/etg/filedlgcustomize.py index 9f8e72cf..b54579c9 100644 --- a/etg/filedlgcustomize.py +++ b/etg/filedlgcustomize.py @@ -59,6 +59,17 @@ def run(): assert isinstance(c, etgtools.ClassDef) c.noDefCtor = True + # Change the AddChoice method to use a wxArrayString instead of a C array + # and size. + m = c.find('AddChoice') + m.find('n').ignore() + m.find('strings').type = 'const wxArrayString&' + m.argsString = '(size_t n, const wxArrayString& strings)' + m.setCppCode("""\ + const wxString* ptr = &strings->front(); + return self->AddChoice(strings->size(), ptr); + """) + c = module.find('wxFileDialogCustomizeHook') assert isinstance(c, etgtools.ClassDef)