Fixes and adjustments based on reviews

This commit is contained in:
Sharkitty 2023-03-22 14:37:59 +01:00
parent 109435fee2
commit 583fecd400
5 changed files with 69 additions and 56 deletions

View file

@ -14,8 +14,10 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin):
# status settings
set_status_note = False
note_status_shortname = "wfa"
status_conditions = list()
family_requirements = list()
status_change_conditions = {
"status_conditions": [],
"family_requirements": [],
}
# comment settings
custom_comment_template = {
@ -63,7 +65,7 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin):
# Check if any status condition is not met
allow_status_change = True
for status_cond in self.status_conditions:
for status_cond in self.status_change_conditions["status_conditions"]:
condition = status_cond["condition"] == "equal"
match = status_cond["short_name"].upper() == shortname
if match and not condition or condition and not match:
@ -73,20 +75,22 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin):
if allow_status_change:
# Get families
families = {
instance.data.get("kitsu_task")
instance.data.get("family")
for instance in context
if instance.data.get("publish")
}
allow_status_change = False
# Check if any family requirement is met
for family_requirement in self.family_requirements:
for family_requirement in self.status_change_conditions["family_requirements"]:
condition = family_requirement["condition"] == "equal"
for family in families:
match = (
family_requirement["short_name"].lower() == family
family_requirement["family"].lower() == family
)
if match and not condition or condition and not match:
if match and condition or not condition and not match:
allow_status_change = True
break

View file

@ -8,8 +8,10 @@
"IntegrateKitsuNote": {
"set_status_note": false,
"note_status_shortname": "wfa",
"status_conditions": [],
"family_requirements": [],
"status_change_conditions": {
"status_conditions": [],
"family_requirements": []
},
"custom_comment_template": {
"enabled": false,
"comment_template": "{comment}\n\n| | |\n|--|--|\n| version| `{version}` |\n| family | `{family}` |\n| name | `{name}` |"

View file

@ -54,55 +54,62 @@
"label": "Note shortname"
},
{
"type": "list",
"key": "status_conditions",
"label": "Status conditions",
"object_type": {
"type": "dict",
"key": "conditions_dict",
"children": [
{
"type": "enum",
"key": "condition",
"label": "Condition",
"enum_items": [
{"equal": "Equal"},
{"not_equal": "Not equal"}
"type": "dict",
"collapsible": true,
"key": "status_change_conditions",
"label": "Status change conditions",
"children": [
{
"type": "list",
"key": "status_conditions",
"label": "Status conditions",
"object_type": {
"type": "dict",
"key": "condition_dict",
"children": [
{
"type": "enum",
"key": "condition",
"label": "Condition",
"enum_items": [
{"equal": "Equal"},
{"not_equal": "Not equal"}
]
},
{
"type": "text",
"key": "short_name",
"label": "Short name"
}
]
},
{
"type": "text",
"key": "short_name",
"label": "Short name"
}
]
},
"label": "Status shortname"
},
{
"type": "list",
"key": "family_requirements",
"label": "Family requirements",
"object_type": {
"type": "dict",
"key": "requirement_dict",
"children": [
{
"type": "enum",
"key": "condition",
"label": "Condition",
"enum_items": [
{"equal": "Equal"},
{"not_equal": "Not equal"}
},
{
"type": "list",
"key": "family_requirements",
"label": "Family requirements",
"object_type": {
"type": "dict",
"key": "requirement_dict",
"children": [
{
"type": "enum",
"key": "condition",
"label": "Condition",
"enum_items": [
{"equal": "Equal"},
{"not_equal": "Not equal"}
]
},
{
"type": "text",
"key": "family",
"label": "Family"
}
]
},
{
"type": "text",
"key": "family",
"label": "Family"
}
]
}
}
]
},
{
"type": "dict",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Before After
Before After

View file

@ -46,8 +46,8 @@ Task status can be automatically set during publish thanks to `Integrate Kitsu N
There are four settings available:
- `Set status on note` -> Turns on and off this integrator.
- `Note shortname` -> Which status shortname should be set automatically (Case sensitive).
- `Status conditions` -> Conditions that need to be met for kitsu status to be changed. You can add as many conditions as you like. There are two fields to each conditions: `Condition` (Whether current status should be equal or not equal to the condition status) and `Short name` (Kitsu Shortname of the condition status).
- `Family requirements` -> With this option you can add requirements to which families must be pushed or not in order to have the task status set by this integrator. There are two fields for each requirements: `Condition` (Same as the above) and `Family` (name of the family concerned by this requirement). For instance, adding one item set to `Not equal` and `workfile`, would mean the task status would change if a subset from another family than workfile is published (workfile can still be included), but not if you publish the workfile subset only.
- `Status change conditions - Status conditions` -> Conditions that need to be met for kitsu status to be changed. You can add as many conditions as you like. There are two fields to each conditions: `Condition` (Whether current status should be equal or not equal to the condition status) and `Short name` (Kitsu Shortname of the condition status).
- `Status change conditions - Family requirements` -> With this option you can add requirements to which families must be pushed or not in order to have the task status set by this integrator. There are two fields for each requirements: `Condition` (Same as the above) and `Family` (name of the family concerned by this requirement). For instance, adding one item set to `Not equal` and `workfile`, would mean the task status would change if a subset from another family than workfile is published (workfile can still be included), but not if you publish the workfile subset only.
![Integrate Kitsu Note project settings](assets/integrate_kitsu_note_settings.png)