Plugins which using multiple Category or Separator to organize Action may produce an action menu that left some Category or Separator uncleaned in GUI.
As you can see, in those two action menus, there are an empty CategoryC and a Separator with no actions to separate.
Fix
I like to use Category, and with this PR, redundant Category and Separator would be taken care of.
🍺 🍺
Reproducible Code
```python
import pyblish.api
class CollectInstances(pyblish.api.ContextPlugin):
order = pyblish.api.CollectorOrder
def process(self, context):
context.create_instance(name="Dummy")
class ActionToAll(pyblish.api.Action):
on = "all"
label = "Action to All"
class ActionOnFailed(pyblish.api.Action):
on = "failed"
label = "Action On Failed"
class ValidateFailed(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder
label = "Many Categories"
actions = [
pyblish.api.Category("A"),
ActionToAll,
pyblish.api.Category("B"),
ActionOnFailed,
pyblish.api.Category("C"),
ActionOnFailed,
]
def process(self, instance):
assert True is False
class ValidatePass(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder
label = "With Separator"
actions = [
pyblish.api.Category("A"),
ActionToAll,
pyblish.api.Separator,
ActionOnFailed,
]
def process(self, instance):
assert True
pyblish.api.register_plugin(CollectInstances)
pyblish.api.register_plugin(ValidateFailed)
pyblish.api.register_plugin(ValidatePass)
```
Problem
Plugins which using multiple
Category
orSeparator
to organizeAction
may produce an action menu that left someCategory
orSeparator
uncleaned in GUI.As you can see, in those two action menus, there are an empty
Category
C and aSeparator
with no actions to separate.Fix
I like to use
Category
, and with this PR, redundantCategory
andSeparator
would be taken care of.🍺 🍺
Reproducible Code
```python import pyblish.api class CollectInstances(pyblish.api.ContextPlugin): order = pyblish.api.CollectorOrder def process(self, context): context.create_instance(name="Dummy") class ActionToAll(pyblish.api.Action): on = "all" label = "Action to All" class ActionOnFailed(pyblish.api.Action): on = "failed" label = "Action On Failed" class ValidateFailed(pyblish.api.InstancePlugin): order = pyblish.api.ValidatorOrder label = "Many Categories" actions = [ pyblish.api.Category("A"), ActionToAll, pyblish.api.Category("B"), ActionOnFailed, pyblish.api.Category("C"), ActionOnFailed, ] def process(self, instance): assert True is False class ValidatePass(pyblish.api.InstancePlugin): order = pyblish.api.ValidatorOrder label = "With Separator" actions = [ pyblish.api.Category("A"), ActionToAll, pyblish.api.Separator, ActionOnFailed, ] def process(self, instance): assert True pyblish.api.register_plugin(CollectInstances) pyblish.api.register_plugin(ValidateFailed) pyblish.api.register_plugin(ValidatePass) ```