mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-08 04:50:07 +01:00
Merge pull request #832 from RobinD42/fix-issue820
Workaround the lack of checking valid page numbers in book ctrls
This commit is contained in:
@@ -102,6 +102,9 @@ Changes in this release include the following:
|
||||
|
||||
* Change winid parameter in wx.ScrolledWindow to id, for consistency. (#816)
|
||||
|
||||
* Ensure that the page exists in book controls GetPage and RemovePage methods.
|
||||
At least one of the wx ports do not do this. (#830)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -42,6 +42,21 @@ def run():
|
||||
|
||||
c.find('HitTest.flags').out = True
|
||||
|
||||
# Workaround the lack of checking valid page numbers in wxGTK.
|
||||
c.addPyCode("""\
|
||||
def _checkBookPageCount(f):
|
||||
import functools
|
||||
@functools.wraps(f)
|
||||
def wrapper(self, page):
|
||||
if page >= self.GetPageCount():
|
||||
raise wx.PyAssertionError("invalid notebook page")
|
||||
return f(self, page)
|
||||
return wrapper
|
||||
|
||||
BookCtrlBase.RemovePage = _checkBookPageCount(BookCtrlBase.RemovePage)
|
||||
BookCtrlBase.GetPage = _checkBookPageCount(BookCtrlBase.GetPage)
|
||||
""")
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
tools.doCommonTweaks(module)
|
||||
|
||||
Reference in New Issue
Block a user