mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 19:40:12 +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:
@@ -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