From 2904ab6afa06d7182d983adba16b3cb2384c2103 Mon Sep 17 00:00:00 2001 From: Will Wykeham Date: Tue, 18 Aug 2015 15:59:02 +0100 Subject: [PATCH] Non-windows platform fix for variations menu --- gui/builtinContextMenus/metaSwap.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gui/builtinContextMenus/metaSwap.py b/gui/builtinContextMenus/metaSwap.py index e233060d6..35ae4b36f 100644 --- a/gui/builtinContextMenus/metaSwap.py +++ b/gui/builtinContextMenus/metaSwap.py @@ -45,6 +45,13 @@ class MetaSwap(ContextMenu): m = wx.Menu() + # If on Windows we need to bind out events into the root menu, on other + # platforms they need to go to our sub menu + if "wxMSW" in wx.PlatformInfo: + bindmenu = rootMenu + else: + bindmenu = m + # Sort items by metalevel, and group within that metalevel items = list(self.variations) items.sort(key=get_metalevel) @@ -66,7 +73,7 @@ class MetaSwap(ContextMenu): id = wx.NewId() mitem = wx.MenuItem(rootMenu, id, item.name) - rootMenu.Bind(wx.EVT_MENU, self.handleModule, mitem) + bindmenu.Bind(wx.EVT_MENU, self.handleModule, mitem) self.moduleLookup[id] = item m.AppendItem(mitem) return m