Merge pull request #2183 from wxWidgets/swt2c-wx_3.1.7

Update wxWidgets to 3.1.7 ++
This commit is contained in:
Robin Dunn
2022-06-09 02:26:06 -04:00
committed by GitHub
16 changed files with 212 additions and 16 deletions

View File

@@ -24,7 +24,7 @@ New and improved in this release:
couple release cycles. I can't say that things are fully back to normal yet,
but at least I now know what I'm doing. Mostly. <wink>
* This release is built using wxWidgets code very near the wxWidgets' 3.1.6
* This release is built using wxWidgets code very near the wxWidgets' 3.1.7
release tag.
* Tweaked the build scripts a bit to ensure that on non-Windows platforms that

View File

@@ -62,5 +62,5 @@ VER_FLAGS = "a1" # wxPython release flags
# The version numbers of wxWidgets to be used in the build
wxVER_MAJOR = 3
wxVER_MINOR = 1
wxVER_RELEASE = 6 # only used when wxVER_MINOR is an odd value
wxVER_RELEASE = 7 # only used when wxVER_MINOR is an odd value

View File

@@ -1261,7 +1261,16 @@
"FileCtrlNameStr":"wx.",
"FileDataObject":"wx.",
"FileDialog":"wx.",
"FileDialogButton":"wx.",
"FileDialogCheckBox":"wx.",
"FileDialogChoice":"wx.",
"FileDialogCustomControl":"wx.",
"FileDialogCustomize":"wx.",
"FileDialogCustomizeHook":"wx.",
"FileDialogNameStr":"wx.",
"FileDialogRadioButton":"wx.",
"FileDialogStaticText":"wx.",
"FileDialogTextCtrl":"wx.",
"FileDirPickerEvent":"wx.",
"FileDropTarget":"wx.",
"FileHistory":"wx.",
@@ -6832,6 +6841,7 @@
"SetDisplayName":"wx.",
"SetEnv":"wx.",
"SettableHeaderColumn":"wx.",
"SharedClientDataContainer":"wx.",
"Shell":"wx.",
"ShowEffect":"wx.",
"ShowEvent":"wx.",
@@ -7903,6 +7913,8 @@
"wxEVT_GRID_RANGE_SELECT":"wx.grid.",
"wxEVT_GRID_RANGE_SELECTED":"wx.grid.",
"wxEVT_GRID_RANGE_SELECTING":"wx.grid.",
"wxEVT_GRID_ROW_AUTO_SIZE":"wx.grid.",
"wxEVT_GRID_ROW_MOVE":"wx.grid.",
"wxEVT_GRID_ROW_SIZE":"wx.grid.",
"wxEVT_GRID_SELECT_CELL":"wx.grid.",
"wxEVT_GRID_TABBING":"wx.grid.",
@@ -8212,6 +8224,7 @@
"wxEVT_WEBVIEW_NAVIGATING":"wx.html2.",
"wxEVT_WEBVIEW_NEWWINDOW":"wx.html2.",
"wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED":"wx.html2.",
"wxEVT_WEBVIEW_SCRIPT_RESULT":"wx.html2.",
"wxEVT_WEBVIEW_TITLE_CHANGED":"wx.html2.",
"wxEVT_WINDOW_MODAL_DIALOG_CLOSED":"wx.",
"wxEVT_WIZARD_BEFORE_PAGE_CHANGED":"wx.adv.",

View File

@@ -0,0 +1,54 @@
class EncryptHook(wx.FileDialogCustomizeHook):
def __init__(self):
super().__init__()
self.encrypt = False
# Override to add custom controls using the provided customizer object.
def AddCustomControls(self, customizer):
# Suppose we can encrypt files when saving them.
self.checkbox = customizer.AddCheckBox("Encrypt")
# While self.checkbox is not really a wx.CheckBox, it looks almost like one
# and, in particular, we can bind to custom control events as usual.
self.checkbox.Bind(wx.EVT_CHECKBOX, self.OnCheckbox)
# The encryption parameters can be edited in a dedicated dialog.
self.button = customizer.AddButton("Parameters...")
self.button.Bind(wx.EVT_BUTTON, self.OnButton)
def OnCheckbox(self, event):
self.button.Enable(event.IsChecked())
def OnButton(self, event):
... show the encryption parameters dialog here ...
# Override this to save the values of the custom controls.
def TransferDataFromCustomControls(self):
# Save the checkbox value, as we won't be able to use it any more
# once this function returns.
self.encrypt = self.checkbox.GetValue()
...
def SomeOtherEventHandlerFunc(self, event):
dialog = wx.FileDialog(None, "Save document", "", "file.my",
"My files (*.my)|*.my", wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
# This object may be destroyed before the dialog, but must remain alive
# until ShowModal() returns. So you should hold a separate reference to
# it.
customizeHook = EncryptHook()
dialog.SetCustomizeHook(customizeHook)
if dialog.ShowModal() == wx.ID_OK:
if (customizeHook.encrypt)
... save with encryption ...
else:
... save without encryption ...
dialog.Destroy()

View File

@@ -0,0 +1,5 @@
toolbar.SetToolBitmapSize(self.FromDIP(wx.Size(32, 32)))
toolbar.AddTool(wx.ID_NEW, "New", wx.BitmapBundle.FromXXX(...))
...
toolbar.Realize()

View File

@@ -196,6 +196,7 @@ INCLUDES = [ # base and core stuff
'dirdlg',
'dirctrl',
'filedlg',
'filedlgcustomize',
'frame',
'msgdlg',
'richmsgdlg',

View File

@@ -95,6 +95,10 @@ def run():
m = MethodDef(name='~wxBitmapBundleImpl', isDtor=True, isVirtual=True, protection='protected')
c.addItem(m)
c.find('DoGetPreferredSize').ignore(False)
c.find('GetIndexToUpscale').ignore(False)
c.find('GetNextAvailableScale').ignore(False)
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)

View File

@@ -17,7 +17,8 @@ DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by
# this script.
ITEMS = [ 'wxClientDataContainer' ]
ITEMS = [ 'wxClientDataContainer',
'wxSharedClientDataContainer' ]
#---------------------------------------------------------------------------

View File

@@ -100,11 +100,6 @@ def run():
#endif
""")
# Missing in 3.1.6
module.addItem(etgtools.WigCode("""\
wxEventType wxEVT_FULLSCREEN /PyName=wxEVT_FULLSCREEN/;
"""))
module.addPyClass('PyEventBinder', ['object'],
doc="""\

97
etg/filedlgcustomize.py Normal file
View File

@@ -0,0 +1,97 @@
#---------------------------------------------------------------------------
# Name: etg/filedlgcustomize.py
# Author: Scott Talbert
#
# Created: 07-Jun-2022
# Copyright: (c) 2022 by Total Control Software
# License: wxWindows License
#---------------------------------------------------------------------------
import etgtools
import etgtools.tweaker_tools as tools
PACKAGE = "wx"
MODULE = "_core"
NAME = "filedlgcustomize" # Base name of the file to generate to for this script
DOCSTRING = ""
# The classes and/or the basename of the Doxygen XML files to be processed by
# this script.
ITEMS = [ 'wxFileDialogButton',
'wxFileDialogChoice',
'wxFileDialogCheckBox',
'wxFileDialogCustomControl',
'wxFileDialogCustomize',
'wxFileDialogCustomizeHook',
'wxFileDialogRadioButton',
'wxFileDialogStaticText',
'wxFileDialogTextCtrl',
]
#---------------------------------------------------------------------------
def run():
# Parse the XML file(s) building a collection of Extractor objects
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS)
#-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings.
c = module.find('wxFileDialogButton')
assert isinstance(c, etgtools.ClassDef)
c.noDefCtor = True
c = module.find('wxFileDialogChoice')
assert isinstance(c, etgtools.ClassDef)
c.noDefCtor = True
c = module.find('wxFileDialogCheckBox')
assert isinstance(c, etgtools.ClassDef)
c.noDefCtor = True
c = module.find('wxFileDialogCustomControl')
assert isinstance(c, etgtools.ClassDef)
c.noDefCtor = True
c = module.find('wxFileDialogCustomize')
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)
c = module.find('wxFileDialogRadioButton')
assert isinstance(c, etgtools.ClassDef)
c.noDefCtor = True
c = module.find('wxFileDialogStaticText')
assert isinstance(c, etgtools.ClassDef)
c.noDefCtor = True
c = module.find('wxFileDialogTextCtrl')
assert isinstance(c, etgtools.ClassDef)
c.noDefCtor = True
#-----------------------------------------------------------------
tools.doCommonTweaks(module)
tools.runGenerators(module)
#---------------------------------------------------------------------------
if __name__ == '__main__':
run()

View File

@@ -700,6 +700,7 @@ def run():
EVT_GRID_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN )
EVT_GRID_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED )
EVT_GRID_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG )
EVT_GRID_ROW_MOVE = wx.PyEventBinder( wxEVT_GRID_ROW_MOVE )
EVT_GRID_COL_MOVE = wx.PyEventBinder( wxEVT_GRID_COL_MOVE )
EVT_GRID_COL_SORT = wx.PyEventBinder( wxEVT_GRID_COL_SORT )
EVT_GRID_TABBING = wx.PyEventBinder( wxEVT_GRID_TABBING )
@@ -725,6 +726,7 @@ def run():
EVT_GRID_CMD_EDITOR_HIDDEN = wx.PyEventBinder( wxEVT_GRID_EDITOR_HIDDEN, 1 )
EVT_GRID_CMD_EDITOR_CREATED = wx.PyEventBinder( wxEVT_GRID_EDITOR_CREATED, 1 )
EVT_GRID_CMD_CELL_BEGIN_DRAG = wx.PyEventBinder( wxEVT_GRID_CELL_BEGIN_DRAG, 1 )
EVT_GRID_CMD_ROW_MOVE = wx.PyEventBinder( wxEVT_GRID_ROW_MOVE, 1 )
EVT_GRID_CMD_COL_MOVE = wx.PyEventBinder( wxEVT_GRID_COL_MOVE, 1 )
EVT_GRID_CMD_COL_SORT = wx.PyEventBinder( wxEVT_GRID_COL_SORT, 1 )
EVT_GRID_CMD_TABBING = wx.PyEventBinder( wxEVT_GRID_TABBING, 1 )

View File

@@ -46,6 +46,8 @@ def run():
c = module.find('wxPropertyGridPageState')
tools.ignoreConstOverloads(c)
# Incorrectly documented in 3.1.7
c.find('GetColumnFullWidth.p').type = 'wxPGProperty *'
module.find('wxPG_IT_CHILDREN').ignore()

View File

@@ -103,13 +103,6 @@ def run():
'wxVersionInfo': 'wxVersionInfo()',
})
# Missing in 3.1.6
module.addItem(etgtools.WigCode("""\
wxEventType wxEVT_WEBVIEW_FULLSCREEN_CHANGED /PyName=wxEVT_WEBVIEW_FULLSCREEN_CHANGED/;
wxEventType wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED /PyName=wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED/;
wxEventType wxEVT_WEBVIEW_SCRIPT_RESULT /PyName=wxEVT_WEBVIEW_SCRIPT_RESULT/;
"""))
c = module.find('wxWebView')
assert isinstance(c, etgtools.ClassDef)
tools.fixWindowClass(c)

View File

@@ -0,0 +1,27 @@
import unittest
from unittests import wtc
import wx
#---------------------------------------------------------------------------
class filedlgcustomize_Tests(wtc.WidgetTestCase):
def test_filedlgcustomize1(self):
class MyFileDialogCustomizeHook(wx.FileDialogCustomizeHook):
def __init__(self):
super().__init__()
self.add_called = False
def AddCustomControls(self, customizer):
self.add_called = True
hook = MyFileDialogCustomizeHook()
dlg = wx.FileDialog(None, 'Save Document', '', 'file.my')
dlg.SetCustomizeHook(hook)
wx.CallLater(250, dlg.EndModal, wx.ID_OK)
dlg.ShowModal()
assert(hook.add_called)
#---------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()

View File

@@ -261,6 +261,7 @@ class grid_Tests(wtc.WidgetTestCase):
wx.grid.wxEVT_GRID_EDITOR_HIDDEN
wx.grid.wxEVT_GRID_EDITOR_CREATED
wx.grid.wxEVT_GRID_CELL_BEGIN_DRAG
wx.grid.wxEVT_GRID_ROW_MOVE
wx.grid.wxEVT_GRID_COL_MOVE
wx.grid.wxEVT_GRID_COL_SORT
wx.grid.wxEVT_GRID_TABBING
@@ -287,6 +288,7 @@ class grid_Tests(wtc.WidgetTestCase):
wx.grid.EVT_GRID_EDITOR_HIDDEN
wx.grid.EVT_GRID_EDITOR_CREATED
wx.grid.EVT_GRID_CELL_BEGIN_DRAG
wx.grid.EVT_GRID_ROW_MOVE
wx.grid.EVT_GRID_COL_MOVE
wx.grid.EVT_GRID_COL_SORT
wx.grid.EVT_GRID_TABBING