From 2b817c5d225aca62879436ba075b83396c7bc6f9 Mon Sep 17 00:00:00 2001 From: Ryan Holmes Date: Sun, 24 Mar 2019 07:18:16 -0400 Subject: [PATCH] Allow platforms that can use a checked image to use one, otherwise this should fallback to plain check (for GTK) --- gui/contextMenu.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gui/contextMenu.py b/gui/contextMenu.py index ec9048429..cf6cea49a 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -20,6 +20,7 @@ # noinspection PyPackageRequirements import wx from logbook import Logger +from gui.bitmap_loader import BitmapLoader pyfalog = Logger(__name__) @@ -80,7 +81,12 @@ class ContextMenu(object): for it, text in enumerate(texts): id = cls.nextID() check = m.checked - rootItem = wx.MenuItem(rootMenu, id, text, kind=wx.ITEM_NORMAL if m.checked is None else wx.ITEM_CHECK) + if check is not None: + rootItem = wx.MenuItem(rootMenu, id, text, kind=wx.ITEM_CHECK) + rootItem.SetBitmap(BitmapLoader.getBitmap("state_active_small", "gui")) + else: + rootItem = wx.MenuItem(rootMenu, id, text, kind=wx.ITEM_NORMAL) + rootMenu.info[id] = (m, fullContext, it) sub = m.getSubMenu(srcContext, selection, rootMenu, it, rootItem)