def channelbox_menu_states(box, item_key, *args):
# -----------------------------------------------------------------------------------#
# MENU STATES : For enabling or disabling menu items based on conditions
# This will determine if our menuItem is enabled or not, if you want to add a
# custom menu item with different conditions for being enabled you can do it
# here by returning prior to the 'return result' on the final line
#
# For this to function the "_hasEnableConditions" must be set to true/1
# -----------------------------------------------------------------------------------#
# ---------------- MANUALLY ADDED CONDITIONS ----------------#
# Put your enabled/disabled state overrides here, example:
# if item_key == "keyForManualOverride":
# return 0 to disable or return 1 to enable
# -----------------------------------------------------------#
if item_key == "invertShown":
return 1 if len(box.filter_attrs) >= 1 or len(box.filter_items) >= 1 else 0
if item_key == "createFilterSet":
if len(box.filter_attrs) >= 1 or len(box.filter_items) >= 1:
return 1
else:
return 0
if item_key == "selectFilterSet":
if "savedFilters" in box.saved_states and len(box.saved_states["savedFilters"][0]) >= 1:
return 1
else:
return 0
return channelbox_menu_selected_channels(box)
# ----------------------------------------------------------------------------------- #
# ----------------------------------------------------------------------------------- #
# CUSTOM MENU TYPES : Anything set as a "custom" type in the menu can have it's
# behaviour set here by checking for it's unique key
# ----------------------------------------------------------------------------------- #
评论列表
文章目录