From 8e14cac1641e2c4fc427380582c6f2490156c33f Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 17 Jul 2018 20:11:33 -0700 Subject: [PATCH] Added wx.Treebook.GetTreeCtrl and wx.Choicebook.GetChoiceCtrl --- CHANGES.rst | 2 ++ etg/choicebk.py | 5 +++++ etg/treebook.py | 4 ++++ unittests/test_choicebk.py | 8 ++++++++ unittests/test_treebook.py | 10 ++++++++++ 5 files changed, 29 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index bb57cac4..10d6add9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -36,6 +36,8 @@ Changes in this release include the following: * Added a Python 3.7 builder on Fedora 28. (#925) +* Added wx.Treebook.GetTreeCtrl and wx.Choicebook.GetChoiceCtrl. (#918) + diff --git a/etg/choicebk.py b/etg/choicebk.py index 2c65059d..e908a938 100644 --- a/etg/choicebk.py +++ b/etg/choicebk.py @@ -38,6 +38,11 @@ def run(): tools.fixWindowClass(c) tools.fixBookctrlClass(c) + c.addCppMethod('wxChoice*', 'GetChoiceCtrl', '()', + doc="Returns the choice control used for selecting pages.", + body="return(self->GetChoiceCtrl());") + + module.addPyCode("""\ EVT_CHOICEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGED, 1 ) EVT_CHOICEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_CHOICEBOOK_PAGE_CHANGING, 1 ) diff --git a/etg/treebook.py b/etg/treebook.py index 86a7c17c..11aad0f5 100644 --- a/etg/treebook.py +++ b/etg/treebook.py @@ -38,6 +38,10 @@ def run(): tools.fixWindowClass(c) tools.fixBookctrlClass(c) + c.addCppMethod('wxTreeCtrl*', 'GetTreeCtrl', '()', + doc="Returns the tree control used for selecting pages.", + body="return(self->GetTreeCtrl());") + module.addPyCode("""\ EVT_TREEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_TREEBOOK_PAGE_CHANGED, 1 ) EVT_TREEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_TREEBOOK_PAGE_CHANGING, 1) diff --git a/unittests/test_choicebk.py b/unittests/test_choicebk.py index fdde2ac7..a064af76 100644 --- a/unittests/test_choicebk.py +++ b/unittests/test_choicebk.py @@ -31,6 +31,14 @@ class choicebk_Tests(wtc.WidgetTestCase): book.AddPage(wx.Panel(book), 'two') + def test_choicebk4(self): + book = wx.Choicebook(self.frame) + book.AddPage(wx.Panel(book), 'one') + book.AddPage(wx.Panel(book), 'two') + + choice = book.GetChoiceCtrl() + assert isinstance(choice, wx.Choice) + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/unittests/test_treebook.py b/unittests/test_treebook.py index 8507b4c1..73186882 100644 --- a/unittests/test_treebook.py +++ b/unittests/test_treebook.py @@ -30,6 +30,16 @@ class treebook_Tests(wtc.WidgetTestCase): book.AddSubPage(wx.Panel(book), 'three') + def test_treebook4(self): + book = wx.Treebook(self.frame) + book.AddPage(wx.Panel(book), 'one') + book.AddPage(wx.Panel(book), 'two') + book.AddSubPage(wx.Panel(book), 'three') + + tree = book.GetTreeCtrl() + assert isinstance(tree, wx.TreeCtrl) + + #--------------------------------------------------------------------------- if __name__ == '__main__':