Skip to content

Commit

Permalink
Merge pull request #300 from davidlatwe/fix-action-menu
Browse files Browse the repository at this point in the history
Fix to remove all empty categories in action menu
  • Loading branch information
davidlatwe authored Sep 27, 2018
2 parents d89a2f4 + 003d20c commit 89a09a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions pyblish_qml/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ def getPluginActions(self, index):
if action["on"] == "notProcessed" and item.processed:
actions.remove(action)

# Discard empty groups
# Discard empty categories, separators
remaining_actions = list()
index = 0
try:
action = actions[index]
Expand All @@ -394,20 +395,20 @@ def getPluginActions(self, index):

isempty = False

if action["__type__"] == "category":
if action["__type__"] in ("category", "separator"):
try:
next_ = actions[index + 1]
if next_["__type__"] != "action":
isempty = True
except IndexError:
isempty = True

if isempty:
actions.pop(index)
if not isempty:
remaining_actions.append(action)

index += 1

return actions
return remaining_actions

@QtCore.pyqtSlot(str)
def runPluginAction(self, action):
Expand Down
2 changes: 1 addition & 1 deletion pyblish_qml/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

VERSION_MAJOR = 1
VERSION_MINOR = 8
VERSION_PATCH = 4
VERSION_PATCH = 5

version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
version = '%i.%i.%i' % version_info
Expand Down

0 comments on commit 89a09a5

Please sign in to comment.