Merge pull request #1916 from pyfa-org/issue1887

Stats menu indicators
This commit is contained in:
Anton Vorobyov
2019-04-09 12:13:43 +03:00
committed by GitHub
7 changed files with 53 additions and 19 deletions

View File

@@ -33,6 +33,16 @@ class ContextMenu(object):
def register(cls):
ContextMenu.menus.append(cls)
@classmethod
def hasMenu(cls, selection, *fullContexts):
for i, fullContext in enumerate(fullContexts):
srcContext = fullContext[0]
for menuHandler in cls.menus:
m = menuHandler()
if m.display(srcContext, selection):
return True
return False
@classmethod
def getMenu(cls, selection, *fullContexts):
"""
@@ -117,6 +127,7 @@ class ContextMenu(object):
if check is not None:
rootItem.Check(check)
rootItem.Enable(m.enabled)
empty = False
@@ -186,6 +197,11 @@ class ContextMenu(object):
'''If menu item is toggleable, this should return bool value'''
return None
@property
def enabled(self):
'''If menu item is enabled. Allows an item to display, but not be selected'''
return True
# noinspection PyUnresolvedReferences
from gui.builtinContextMenus import ( # noqa: E402,F401
openFit,