Allow platforms that can use a checked image to use one, otherwise this should fallback to plain check (for GTK)

This commit is contained in:
Ryan Holmes
2019-03-24 07:18:16 -04:00
parent ba445e7d4f
commit 2b817c5d22

View File

@@ -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)