Fix GetExtWildcard to return the output arg

in a tuple with the return value, like in Classic.
This commit is contained in:
Robin Dunn
2017-11-07 13:25:57 -08:00
parent e141c95e50
commit de655e45dc
2 changed files with 27 additions and 0 deletions

View File

@@ -48,6 +48,9 @@ Changes in this release include the following:
pass a value that is larger than what will fit in that type of integer then
an OverflowError exception will be raised.
* Fixed wx.richtext.RichTextBuffer.GetExtWildcard to return a tuple of 2
values, as was done in Classic. (#594)

View File

@@ -354,6 +354,30 @@ def run():
c.find('FindHandlerFilenameOrType').pyName = 'FindHandlerByFilename'
c.find('GetExtWildcard').ignore()
c.addCppMethod('PyObject*', 'GetExtWildcard', '(bool combine=false, bool save=false)',
doc="""\
Gets a wildcard string for the file dialog based on all the currently
loaded richtext file handlers, and a list that can be used to map
those filter types to the file handler type.""",
body="""\
wxString wildcards;
wxArrayInt types;
wildcards = wxRichTextBuffer::GetExtWildcard(combine, save, &types);
wxPyThreadBlocker blocker;
PyObject* list = PyList_New(0);
for (size_t i=0; i < types.GetCount(); i++) {
PyObject* number = wxPyInt_FromLong(types[i]);
PyList_Append(list, number);
Py_DECREF(number);
}
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, wx2PyString(wildcards));
PyTuple_SET_ITEM(tup, 1, list);
return tup;
""",
isStatic=True)
#-------------------------------------------------------
c = module.find('wxRichTextTable')