pyblish-base icon indicating copy to clipboard operation
pyblish-base copied to clipboard

Allow action to show on "warning"

Open BigRoy opened this issue 5 years ago • 2 comments

Issue

The Action defines a couple of specific on states of when it can be triggered, like failed and processed. However it lacks the ability to be shown only when (at least) warnings have occurred.

This would be relevant visually for Pyblish-QML and Pyblish-Lite so for now I added this to pyblish-base as it also relates to the pyblish documentation itself.

Discussion

The question of course would be whether on = "warning" would also be valid whenever no warning was logged but an error did occur. As if the 'warning' level is the minimum level of verbosity for it to be shown, or whether it should be an exact match. In the case of only an exact match it should then still be skipped and only show whenever at least one warning was logged. That's up for discussion here.

Note that there's currently no state that combines to different states, e.g. warning+failed. The problem at hand might also be solved differently, e.g. having a state like on="custom" that defines a method on the action like:

# pseudocode
class WarningAction(pyblish.api.Action)
    on = "custom"

    def process(self, context, plugin):
        pass

    def show(self, context, plugin):
        # Return True or False whether it should be 
        # shown based on some custom conditions.
        return custom_action_test(context)

BigRoy avatar Oct 08 '19 14:10 BigRoy

For easier backwards compatibility I would say on = "warning" would be best. Users can always subclass to define the same action for failed and warning.

tokejepsen avatar Oct 08 '19 14:10 tokejepsen

Yeah, agreed with Toke, and otherwise this looks good. On warning means on warning, not error.

mottosso avatar Oct 08 '19 17:10 mottosso