diff --git a/CHANGES.rst b/CHANGES.rst index 7f94a23c..1f2de6f2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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. -* 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 diff --git a/buildtools/version.py b/buildtools/version.py index 050966d7..f11b24f0 100644 --- a/buildtools/version.py +++ b/buildtools/version.py @@ -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 diff --git a/docs/sphinx/itemToModuleMap.json b/docs/sphinx/itemToModuleMap.json index ce1b856c..dd795938 100644 --- a/docs/sphinx/itemToModuleMap.json +++ b/docs/sphinx/itemToModuleMap.json @@ -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.", diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialogCustomizeHook.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialogCustomizeHook.1.py new file mode 100644 index 00000000..6906cee9 --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.FileDialogCustomizeHook.1.py @@ -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() diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ToolBar.SetToolBitmapSize.1.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ToolBar.SetToolBitmapSize.1.py new file mode 100644 index 00000000..dd672f1f --- /dev/null +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.ToolBar.SetToolBitmapSize.1.py @@ -0,0 +1,5 @@ + + toolbar.SetToolBitmapSize(self.FromDIP(wx.Size(32, 32))) + toolbar.AddTool(wx.ID_NEW, "New", wx.BitmapBundle.FromXXX(...)) + ... + toolbar.Realize() diff --git a/etg/_core.py b/etg/_core.py index 220c1371..04d47438 100644 --- a/etg/_core.py +++ b/etg/_core.py @@ -196,6 +196,7 @@ INCLUDES = [ # base and core stuff 'dirdlg', 'dirctrl', 'filedlg', + 'filedlgcustomize', 'frame', 'msgdlg', 'richmsgdlg', diff --git a/etg/bmpbndl.py b/etg/bmpbndl.py index 0b502a24..71fded89 100644 --- a/etg/bmpbndl.py +++ b/etg/bmpbndl.py @@ -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) diff --git a/etg/clntdatactnr.py b/etg/clntdatactnr.py index 69364a7b..a2c3c8bc 100644 --- a/etg/clntdatactnr.py +++ b/etg/clntdatactnr.py @@ -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' ] #--------------------------------------------------------------------------- diff --git a/etg/event.py b/etg/event.py index 5f79d888..4a5c30e1 100644 --- a/etg/event.py +++ b/etg/event.py @@ -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="""\ diff --git a/etg/filedlgcustomize.py b/etg/filedlgcustomize.py new file mode 100644 index 00000000..b54579c9 --- /dev/null +++ b/etg/filedlgcustomize.py @@ -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() + diff --git a/etg/grid.py b/etg/grid.py index e63166dc..39f31d99 100644 --- a/etg/grid.py +++ b/etg/grid.py @@ -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 ) diff --git a/etg/propgridpagestate.py b/etg/propgridpagestate.py index 0799adb5..adf085f5 100644 --- a/etg/propgridpagestate.py +++ b/etg/propgridpagestate.py @@ -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() diff --git a/etg/webview.py b/etg/webview.py index 6fec5045..4a6bde2d 100644 --- a/etg/webview.py +++ b/etg/webview.py @@ -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) diff --git a/ext/wxWidgets b/ext/wxWidgets index 3dcee077..7ad1bffa 160000 --- a/ext/wxWidgets +++ b/ext/wxWidgets @@ -1 +1 @@ -Subproject commit 3dcee0777eeece2b4fa87a0368de9de86f5f4c05 +Subproject commit 7ad1bffa875f7a38db58b6069ea3ff0c49c211d2 diff --git a/unittests/test_filedlgcustomize.py b/unittests/test_filedlgcustomize.py new file mode 100644 index 00000000..f366f9f5 --- /dev/null +++ b/unittests/test_filedlgcustomize.py @@ -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() diff --git a/unittests/test_grid.py b/unittests/test_grid.py index 067bfcb3..c6ad1d02 100644 --- a/unittests/test_grid.py +++ b/unittests/test_grid.py @@ -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