Merge pull request #2068 from swt2c/taskbar_getpopup

Fix GetPopupMenu override for wx.adv.TaskbarIcon
This commit is contained in:
Scott Talbert
2022-01-09 10:09:55 -05:00
committed by GitHub
2 changed files with 33 additions and 0 deletions

View File

@@ -66,6 +66,8 @@ def run():
sipTransferTo(sipResObj, Py_None);
}
"""
method = c.find('GetPopupMenu')
method.ignore(False)
c.find('Destroy').transferThis = True

View File

@@ -36,6 +36,37 @@ class taskbar_Tests(wtc.WidgetTestCase):
wx.adv.wxEVT_TASKBAR_BALLOON_TIMEOUT
wx.adv.wxEVT_TASKBAR_BALLOON_CLICK
# Test that the CreatePopupMenu override works
def test_taskbar3(self):
class MyTaskBarIcon(wx.adv.TaskBarIcon):
def __init__(self):
super().__init__()
self.flag = False
def CreatePopupMenu(self):
self.flag = True
tbi = MyTaskBarIcon()
evt = wx.adv.TaskBarIconEvent(wx.adv.wxEVT_TASKBAR_RIGHT_DOWN, tbi)
wx.PostEvent(tbi, evt)
self.myYield()
self.assertTrue(tbi.flag)
# Test that the GetPopupMenu override works
def test_taskbar4(self):
class MyTaskBarIcon(wx.adv.TaskBarIcon):
def __init__(self):
super().__init__()
self.flag = False
def GetPopupMenu(self):
self.flag = True
tbi = MyTaskBarIcon()
evt = wx.adv.TaskBarIconEvent(wx.adv.wxEVT_TASKBAR_RIGHT_DOWN, tbi)
wx.PostEvent(tbi, evt)
self.myYield()
self.assertTrue(tbi.flag)
#---------------------------------------------------------------------------
if __name__ == '__main__':