Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow action to show on "warning" #354

Open
BigRoy opened this issue Oct 8, 2019 · 2 comments
Open

Allow action to show on "warning" #354

BigRoy opened this issue Oct 8, 2019 · 2 comments

Comments

@BigRoy
Copy link
Member

BigRoy commented Oct 8, 2019

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 BigRoy transferred this issue from pyblish/pyblish-qml Oct 8, 2019
@tokejepsen
Copy link
Member

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.

@mottosso
Copy link
Member

mottosso commented Oct 8, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants