line length to 79

This commit is contained in:
Félix David 2022-03-02 09:52:26 +01:00
parent a15c4d2895
commit 44100b0da7
5 changed files with 63 additions and 24 deletions

View file

@ -42,7 +42,9 @@ class KitsuModule(OpenPypeModule, IPluginPaths, ITrayAction):
# Check for "/api" url validity # Check for "/api" url validity
if not kitsu_url.endswith("api"): if not kitsu_url.endswith("api"):
kitsu_url = f"{kitsu_url}{'' if kitsu_url.endswith('/') else '/'}api" kitsu_url = (
f"{kitsu_url}{'' if kitsu_url.endswith('/') else '/'}api"
)
self.server_url = kitsu_url self.server_url = kitsu_url
@ -161,7 +163,9 @@ def sync_zou():
"resolution": f"{op_project['data']['resolutionWidth']}x{op_project['data']['resolutionHeight']}", "resolution": f"{op_project['data']['resolutionWidth']}x{op_project['data']['resolutionHeight']}",
} }
) )
gazu.project.update_project_data(zou_project, data=op_project["data"]) gazu.project.update_project_data(
zou_project, data=op_project["data"]
)
gazu.project.update_project(zou_project) gazu.project.update_project(zou_project)
asset_types = gazu.asset.all_asset_types() asset_types = gazu.asset.all_asset_types()
@ -227,7 +231,9 @@ def sync_zou():
# Create new sequence and set it as substitute # Create new sequence and set it as substitute
created_sequence = gazu.shot.new_sequence( created_sequence = gazu.shot.new_sequence(
zou_project, substitute_sequence_name, episode=zou_parent_id zou_project,
substitute_sequence_name,
episode=zou_parent_id,
) )
gazu.shot.update_sequence_data( gazu.shot.update_sequence_data(
created_sequence, {"is_substitute": True} created_sequence, {"is_substitute": True}
@ -244,13 +250,16 @@ def sync_zou():
doc["name"], doc["name"],
frame_in=doc["data"]["frameStart"], frame_in=doc["data"]["frameStart"],
frame_out=doc["data"]["frameEnd"], frame_out=doc["data"]["frameEnd"],
nb_frames=doc["data"]["frameEnd"] - doc["data"]["frameStart"], nb_frames=doc["data"]["frameEnd"]
- doc["data"]["frameStart"],
) )
elif match.group(2): # Sequence elif match.group(2): # Sequence
parent_doc = asset_docs[visual_parent_id] parent_doc = asset_docs[visual_parent_id]
new_entity = gazu.shot.new_sequence( new_entity = gazu.shot.new_sequence(
zou_project, doc["name"], episode=parent_doc["data"]["zou"]["id"] zou_project,
doc["name"],
episode=parent_doc["data"]["zou"]["id"],
) )
elif match.group(3): # Episode elif match.group(3): # Episode
@ -293,7 +302,10 @@ def sync_zou():
if frame_in or frame_out: if frame_in or frame_out:
entity_data.update( entity_data.update(
{ {
"data": {"frame_in": frame_in, "frame_out": frame_out}, "data": {
"frame_in": frame_in,
"frame_out": frame_out,
},
"nb_frames": frame_out - frame_in, "nb_frames": frame_out - frame_in,
} }
) )
@ -334,7 +346,10 @@ def sync_zou():
@cli_main.command() @cli_main.command()
@click.option( @click.option(
"-l", "--listen", is_flag=True, help="Listen Kitsu server after synchronization." "-l",
"--listen",
is_flag=True,
help="Listen Kitsu server after synchronization.",
) )
def sync_openpype(listen: bool): def sync_openpype(listen: bool):
"""Synchronize openpype database from Zou sever database.""" """Synchronize openpype database from Zou sever database."""
@ -410,7 +425,9 @@ def sync_openpype(listen: bool):
bulk_writes.extend( bulk_writes.extend(
[ [
UpdateOne({"_id": id}, update) UpdateOne({"_id": id}, update)
for id, update in update_op_assets(all_entities, zou_ids_and_asset_docs) for id, update in update_op_assets(
all_entities, zou_ids_and_asset_docs
)
] ]
) )

View file

@ -46,7 +46,8 @@ class PasswordDialog(QtWidgets.QDialog):
login_label = QtWidgets.QLabel("Login:", login_widget) login_label = QtWidgets.QLabel("Login:", login_widget)
login_input = QtWidgets.QLineEdit( login_input = QtWidgets.QLineEdit(
login_widget, text=kitsu_settings.get("login") if remembered else None login_widget,
text=kitsu_settings.get("login") if remembered else None,
) )
login_input.setPlaceholderText("Your Kitsu account login...") login_input.setPlaceholderText("Your Kitsu account login...")
@ -61,7 +62,8 @@ class PasswordDialog(QtWidgets.QDialog):
password_label = QtWidgets.QLabel("Password:", password_widget) password_label = QtWidgets.QLabel("Password:", password_widget)
password_input = QtWidgets.QLineEdit( password_input = QtWidgets.QLineEdit(
password_widget, text=kitsu_settings.get("password") if remembered else None password_widget,
text=kitsu_settings.get("password") if remembered else None,
) )
password_input.setPlaceholderText("Your password...") password_input.setPlaceholderText("Your password...")
password_input.setEchoMode(QtWidgets.QLineEdit.Password) password_input.setEchoMode(QtWidgets.QLineEdit.Password)
@ -87,7 +89,9 @@ class PasswordDialog(QtWidgets.QDialog):
remember_checkbox = QtWidgets.QCheckBox("Remember", buttons_widget) remember_checkbox = QtWidgets.QCheckBox("Remember", buttons_widget)
remember_checkbox.setObjectName("RememberCheckbox") remember_checkbox.setObjectName("RememberCheckbox")
remember_checkbox.setChecked(remembered if remembered is not None else True) remember_checkbox.setChecked(
remembered if remembered is not None else True
)
ok_btn = QtWidgets.QPushButton("Ok", buttons_widget) ok_btn = QtWidgets.QPushButton("Ok", buttons_widget)
cancel_btn = QtWidgets.QPushButton("Cancel", buttons_widget) cancel_btn = QtWidgets.QPushButton("Cancel", buttons_widget)
@ -137,7 +141,9 @@ class PasswordDialog(QtWidgets.QDialog):
def _on_ok_click(self): def _on_ok_click(self):
# Check if is connectable # Check if is connectable
if not self._connectable: if not self._connectable:
self.message_label.setText("Please set server url in Studio Settings!") self.message_label.setText(
"Please set server url in Studio Settings!"
)
return return
# Collect values # Collect values

View file

@ -31,7 +31,9 @@ class IntegrateRig(pyblish.api.InstancePlugin):
# Get task # Get task
task_type = gazu.task.get_task_type_by_name(instance.data["task"]) task_type = gazu.task.get_task_type_by_name(instance.data["task"])
entity_task = gazu.task.get_task_by_entity(asset_data["zou"], task_type) entity_task = gazu.task.get_task_by_entity(
asset_data["zou"], task_type
)
# Comment entity # Comment entity
gazu.task.add_comment( gazu.task.add_comment(

View file

@ -95,9 +95,9 @@ def start_listeners():
zou_ids_and_asset_docs[asset["project_id"]] = project_doc zou_ids_and_asset_docs[asset["project_id"]] = project_doc
# Update # Update
asset_doc_id, asset_update = update_op_assets([asset], zou_ids_and_asset_docs)[ asset_doc_id, asset_update = update_op_assets(
0 [asset], zou_ids_and_asset_docs
] )[0]
project_col.update_one({"_id": asset_doc_id}, asset_update) project_col.update_one({"_id": asset_doc_id}, asset_update)
def delete_asset(data): def delete_asset(data):
@ -105,7 +105,9 @@ def start_listeners():
project_col = set_op_project(dbcon, data["project_id"]) project_col = set_op_project(dbcon, data["project_id"])
# Delete # Delete
project_col.delete_one({"type": "asset", "data.zou.id": data["asset_id"]}) project_col.delete_one(
{"type": "asset", "data.zou.id": data["asset_id"]}
)
gazu.events.add_listener(event_client, "asset:new", new_asset) gazu.events.add_listener(event_client, "asset:new", new_asset)
gazu.events.add_listener(event_client, "asset:update", update_asset) gazu.events.add_listener(event_client, "asset:update", update_asset)
@ -155,7 +157,9 @@ def start_listeners():
print("delete episode") # TODO check bugfix print("delete episode") # TODO check bugfix
# Delete # Delete
project_col.delete_one({"type": "asset", "data.zou.id": data["episode_id"]}) project_col.delete_one(
{"type": "asset", "data.zou.id": data["episode_id"]}
)
gazu.events.add_listener(event_client, "episode:new", new_episode) gazu.events.add_listener(event_client, "episode:new", new_episode)
gazu.events.add_listener(event_client, "episode:update", update_episode) gazu.events.add_listener(event_client, "episode:update", update_episode)
@ -205,7 +209,9 @@ def start_listeners():
print("delete sequence") # TODO check bugfix print("delete sequence") # TODO check bugfix
# Delete # Delete
project_col.delete_one({"type": "asset", "data.zou.id": data["sequence_id"]}) project_col.delete_one(
{"type": "asset", "data.zou.id": data["sequence_id"]}
)
gazu.events.add_listener(event_client, "sequence:new", new_sequence) gazu.events.add_listener(event_client, "sequence:new", new_sequence)
gazu.events.add_listener(event_client, "sequence:update", update_sequence) gazu.events.add_listener(event_client, "sequence:update", update_sequence)
@ -244,7 +250,9 @@ def start_listeners():
zou_ids_and_asset_docs[shot["project_id"]] = project_doc zou_ids_and_asset_docs[shot["project_id"]] = project_doc
# Update # Update
asset_doc_id, asset_update = update_op_assets([shot], zou_ids_and_asset_docs)[0] asset_doc_id, asset_update = update_op_assets(
[shot], zou_ids_and_asset_docs
)[0]
project_col.update_one({"_id": asset_doc_id}, asset_update) project_col.update_one({"_id": asset_doc_id}, asset_update)
def delete_shot(data): def delete_shot(data):
@ -252,7 +260,9 @@ def start_listeners():
project_col = set_op_project(dbcon, data["project_id"]) project_col = set_op_project(dbcon, data["project_id"])
# Delete # Delete
project_col.delete_one({"type": "asset", "data.zou.id": data["shot_id"]}) project_col.delete_one(
{"type": "asset", "data.zou.id": data["shot_id"]}
)
gazu.events.add_listener(event_client, "shot:new", new_shot) gazu.events.add_listener(event_client, "shot:new", new_shot)
gazu.events.add_listener(event_client, "shot:update", update_shot) gazu.events.add_listener(event_client, "shot:update", update_shot)
@ -302,7 +312,8 @@ def start_listeners():
# Delete task in DB # Delete task in DB
project_col.update_one( project_col.update_one(
{"_id": doc["_id"]}, {"$set": {"data.tasks": asset_tasks}} {"_id": doc["_id"]},
{"$set": {"data.tasks": asset_tasks}},
) )
return return

View file

@ -65,7 +65,8 @@ def update_op_assets(
tasks_list = all_tasks_for_shot(item) tasks_list = all_tasks_for_shot(item)
# TODO frame in and out # TODO frame in and out
item_data["tasks"] = { item_data["tasks"] = {
t["task_type_name"]: {"type": t["task_type_name"]} for t in tasks_list t["task_type_name"]: {"type": t["task_type_name"]}
for t in tasks_list
} }
# Get zou parent id for correct hierarchy # Get zou parent id for correct hierarchy
@ -79,7 +80,9 @@ def update_op_assets(
parent_zou_id = substitute_parent_item["parent_id"] parent_zou_id = substitute_parent_item["parent_id"]
else: else:
parent_zou_id = ( parent_zou_id = (
item.get("parent_id") or item.get("episode_id") or item.get("source_id") item.get("parent_id")
or item.get("episode_id")
or item.get("source_id")
) # TODO check consistency ) # TODO check consistency
# Visual parent for hierarchy # Visual parent for hierarchy