Use checked api instead of bitmap for factor reload (#1897)
This commit is contained in:
@@ -29,12 +29,9 @@ class FactorReload(ContextMenu):
|
|||||||
sFit.refreshFit(fitID)
|
sFit.refreshFit(fitID)
|
||||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||||
|
|
||||||
def getBitmap(self, context, selection):
|
@property
|
||||||
|
def checked(self):
|
||||||
sFit = Fit.getInstance()
|
sFit = Fit.getInstance()
|
||||||
if sFit.serviceFittingOptions["useGlobalForceReload"]:
|
return sFit.serviceFittingOptions["useGlobalForceReload"]
|
||||||
return BitmapLoader.getBitmap("state_active_small", "gui")
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
FactorReload.register()
|
FactorReload.register()
|
||||||
|
|||||||
@@ -79,7 +79,8 @@ class ContextMenu(object):
|
|||||||
multiple = not isinstance(bitmap, wx.Bitmap)
|
multiple = not isinstance(bitmap, wx.Bitmap)
|
||||||
for it, text in enumerate(texts):
|
for it, text in enumerate(texts):
|
||||||
id = cls.nextID()
|
id = cls.nextID()
|
||||||
rootItem = wx.MenuItem(rootMenu, id, text)
|
check = m.checked
|
||||||
|
rootItem = wx.MenuItem(rootMenu, id, text, kind=wx.ITEM_NORMAL if m.checked is None else wx.ITEM_CHECK)
|
||||||
rootMenu.info[id] = (m, fullContext, it)
|
rootMenu.info[id] = (m, fullContext, it)
|
||||||
|
|
||||||
sub = m.getSubMenu(srcContext, selection, rootMenu, it, rootItem)
|
sub = m.getSubMenu(srcContext, selection, rootMenu, it, rootItem)
|
||||||
@@ -114,6 +115,9 @@ class ContextMenu(object):
|
|||||||
|
|
||||||
rootMenu.Append(rootItem)
|
rootMenu.Append(rootItem)
|
||||||
|
|
||||||
|
if check is not None:
|
||||||
|
rootItem.Check(check)
|
||||||
|
|
||||||
empty = False
|
empty = False
|
||||||
|
|
||||||
if display_amount > 0 and i != len(fullContexts) - 1:
|
if display_amount > 0 and i != len(fullContexts) - 1:
|
||||||
@@ -177,6 +181,10 @@ class ContextMenu(object):
|
|||||||
def getBitmap(self, context, selection):
|
def getBitmap(self, context, selection):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def checked(self):
|
||||||
|
'''If menu item is toggleable, this should return bool value'''
|
||||||
|
return None
|
||||||
|
|
||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
from gui.builtinContextMenus import ( # noqa: E402,F401
|
from gui.builtinContextMenus import ( # noqa: E402,F401
|
||||||
|
|||||||
Reference in New Issue
Block a user