From 3bf04aa77170e2aecedd38af4ea05ead12b7e2b9 Mon Sep 17 00:00:00 2001 From: Mesalu Date: Thu, 8 Feb 2018 21:19:45 -0800 Subject: [PATCH 1/6] Add iterability to sizer classes and corresponding unittest --- etg/sizer.py | 6 +++++- unittests/test_sizer.py | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/etg/sizer.py b/etg/sizer.py index a5533eab..d0a7d366 100644 --- a/etg/sizer.py +++ b/etg/sizer.py @@ -151,8 +151,12 @@ def run(): import wx.siplib return not wx.siplib.isdeleted(self) """) - c.addPyCode('Sizer.__bool__ = Sizer.__nonzero__') # For Python 3 + c.addPyMethod('__iter__', '(self)', + doc = "A Py convenience method that allows Sizers to act as iterables that will yield their wx.SizerItems." + body = "for item in self.GetChildren(): yield item") + + c.addPyCode('Sizer.__bool__ = Sizer.__nonzero__') # For Python 3 #--------------------------------------------- diff --git a/unittests/test_sizer.py b/unittests/test_sizer.py index abd0a36f..7703c972 100644 --- a/unittests/test_sizer.py +++ b/unittests/test_sizer.py @@ -71,6 +71,15 @@ class sizer_Tests(wtc.WidgetTestCase): self.assertTrue(items[1].IsSpacer()) self.assertTrue(items[2].Border == 5) + def test_iter(self): + bs = wx.BoxSizer() + widgetlist = [wx.Panel(self.frame) for _ in range(5)] + + sizeritems = [x for x in bs] + for item in sizeritems: + self.assertTrue(isinstance(item, wx.SizerItem)) + + self.assertTrue([x.GetWidget() for x in bs] == widgetlist) def test_sizerSpacers1(self): bs = wx.BoxSizer() From e42e7044443eec10b97e90f8bb039658608d7c03 Mon Sep 17 00:00:00 2001 From: Mesalu Date: Thu, 8 Feb 2018 21:49:37 -0800 Subject: [PATCH 2/6] FIX, er, I mean, tweak build.py to have clean_all, which is the same as callign cleanall --- build.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.py b/build.py index 41ed39ac..8fc83da4 100755 --- a/build.py +++ b/build.py @@ -1731,6 +1731,8 @@ def cmd_clean_vagrant(options, args): if os.path.exists(d): shutil.rmtree(d) +def cmd_clean_all(options, args): + cmd_cleanall(options, args) def cmd_cleanall(options, args): # These take care of all the object, lib, shared lib files created by the From 62a84b8c1d04457a3c311b6328171190a2b351bf Mon Sep 17 00:00:00 2001 From: Mesalu Date: Thu, 8 Feb 2018 22:45:05 -0800 Subject: [PATCH 3/6] Fix silly little mistake --- etg/sizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etg/sizer.py b/etg/sizer.py index d0a7d366..8e7b6450 100644 --- a/etg/sizer.py +++ b/etg/sizer.py @@ -153,7 +153,7 @@ def run(): """) c.addPyMethod('__iter__', '(self)', - doc = "A Py convenience method that allows Sizers to act as iterables that will yield their wx.SizerItems." + doc = "A Py convenience method that allows Sizers to act as iterables that will yield their wx.SizerItems.", body = "for item in self.GetChildren(): yield item") c.addPyCode('Sizer.__bool__ = Sizer.__nonzero__') # For Python 3 From a08c293511433295d7e092137950d2340731c1c8 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 13 Feb 2018 18:09:41 -0800 Subject: [PATCH 4/6] Add changelog header for 4.0.2 --- CHANGES.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 1c3b3e29..60ddd113 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,7 @@ wxPython Changelog ================== + 4.1.0 ----- * (not yet released) @@ -20,6 +21,18 @@ Pip: ``pip install wxPython==4.1.0`` +4.0.2 +----- +* (not yet released) + +PyPI: https://pypi.python.org/pypi/wxPython/4.0.2 +Extras: https://extras.wxPython.org/wxPython4/extras/ +Pip: ``pip install wxPython==4.0.2`` + + + + + 4.0.1 "Lemonade" ---------------- * 2-Feb-2018 From 779501315a6b7d6228d939078acb150d6fcacc40 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 13 Feb 2018 18:37:34 -0800 Subject: [PATCH 5/6] Add changelog items --- CHANGES.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 60ddd113..190770b3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -29,6 +29,13 @@ PyPI: https://pypi.python.org/pypi/wxPython/4.0.2 Extras: https://extras.wxPython.org/wxPython4/extras/ Pip: ``pip install wxPython==4.0.2`` +Changes in this release include the following: + +* Fixed wx.html2.EVT_WEBVIEW_NAVIGATING event not being sent on some versions + of Linux. (#741) + +* wx.Sizers can now be used as an iterator to iterate over the items within + the sizer. (#738) From 929269e606f5b27a87fc96a774ede434800eddf2 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 13 Feb 2018 18:43:08 -0800 Subject: [PATCH 6/6] Fix Python3 division in ThumbnailCtrl --- CHANGES.rst | 2 ++ wx/lib/agw/thumbnailctrl.py | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 190770b3..a82b1cba 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -37,6 +37,8 @@ Changes in this release include the following: * wx.Sizers can now be used as an iterator to iterate over the items within the sizer. (#738) +* Fix Python3 division in ThumbnailCtrl. (#746) + diff --git a/wx/lib/agw/thumbnailctrl.py b/wx/lib/agw/thumbnailctrl.py index 5e950f78..7d97cb05 100644 --- a/wx/lib/agw/thumbnailctrl.py +++ b/wx/lib/agw/thumbnailctrl.py @@ -1790,7 +1790,7 @@ class ScrolledThumbnail(wx.ScrolledWindow): :param `y`: the mouse `y` position. """ - col = (x - self._tBorder)/(self._tWidth + self._tBorder) + col = (x - self._tBorder)//(self._tWidth + self._tBorder) if col >= self._cols: col = self._cols - 1 @@ -1942,7 +1942,7 @@ class ScrolledThumbnail(wx.ScrolledWindow): return # get row - row = self.GetSelection()/self._cols + row = self.GetSelection()//self._cols # calc position to scroll view paintRect = self.GetPaintRect() @@ -2586,4 +2586,3 @@ class ScrolledThumbnail(wx.ScrolledWindow): self.Refresh() -