mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Merge pull request #1522 from ynput/enhancement/YN-0155_version_up_existing
Library: Version up existing product
This commit is contained in:
commit
b1422b7fb4
3 changed files with 57 additions and 34 deletions
|
|
@ -41,6 +41,7 @@ class PushToContextController:
|
||||||
self._process_item_id = None
|
self._process_item_id = None
|
||||||
|
|
||||||
self._use_original_name = False
|
self._use_original_name = False
|
||||||
|
self._version_up = False
|
||||||
|
|
||||||
self.set_source(project_name, version_ids)
|
self.set_source(project_name, version_ids)
|
||||||
|
|
||||||
|
|
@ -212,7 +213,7 @@ class PushToContextController:
|
||||||
self._user_values.variant,
|
self._user_values.variant,
|
||||||
comment=self._user_values.comment,
|
comment=self._user_values.comment,
|
||||||
new_folder_name=self._user_values.new_folder_name,
|
new_folder_name=self._user_values.new_folder_name,
|
||||||
dst_version=1,
|
version_up=self._version_up,
|
||||||
use_original_name=self._use_original_name,
|
use_original_name=self._use_original_name,
|
||||||
)
|
)
|
||||||
item_ids.append(item_id)
|
item_ids.append(item_id)
|
||||||
|
|
@ -229,6 +230,9 @@ class PushToContextController:
|
||||||
thread.start()
|
thread.start()
|
||||||
return item_ids
|
return item_ids
|
||||||
|
|
||||||
|
def set_version_up(self, state):
|
||||||
|
self._version_up = state
|
||||||
|
|
||||||
def wait_for_process_thread(self):
|
def wait_for_process_thread(self):
|
||||||
if self._process_thread is None:
|
if self._process_thread is None:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ class ProjectPushItem:
|
||||||
variant,
|
variant,
|
||||||
comment,
|
comment,
|
||||||
new_folder_name,
|
new_folder_name,
|
||||||
dst_version,
|
version_up,
|
||||||
item_id=None,
|
item_id=None,
|
||||||
use_original_name=False
|
use_original_name=False
|
||||||
):
|
):
|
||||||
|
|
@ -100,7 +100,7 @@ class ProjectPushItem:
|
||||||
self.dst_project_name = dst_project_name
|
self.dst_project_name = dst_project_name
|
||||||
self.dst_folder_id = dst_folder_id
|
self.dst_folder_id = dst_folder_id
|
||||||
self.dst_task_name = dst_task_name
|
self.dst_task_name = dst_task_name
|
||||||
self.dst_version = dst_version
|
self.version_up = version_up
|
||||||
self.variant = variant
|
self.variant = variant
|
||||||
self.new_folder_name = new_folder_name
|
self.new_folder_name = new_folder_name
|
||||||
self.comment = comment or ""
|
self.comment = comment or ""
|
||||||
|
|
@ -118,7 +118,7 @@ class ProjectPushItem:
|
||||||
str(self.dst_folder_id),
|
str(self.dst_folder_id),
|
||||||
str(self.new_folder_name),
|
str(self.new_folder_name),
|
||||||
str(self.dst_task_name),
|
str(self.dst_task_name),
|
||||||
str(self.dst_version),
|
str(self.version_up),
|
||||||
self.use_original_name
|
self.use_original_name
|
||||||
])
|
])
|
||||||
return self._repr_value
|
return self._repr_value
|
||||||
|
|
@ -133,7 +133,7 @@ class ProjectPushItem:
|
||||||
"dst_project_name": self.dst_project_name,
|
"dst_project_name": self.dst_project_name,
|
||||||
"dst_folder_id": self.dst_folder_id,
|
"dst_folder_id": self.dst_folder_id,
|
||||||
"dst_task_name": self.dst_task_name,
|
"dst_task_name": self.dst_task_name,
|
||||||
"dst_version": self.dst_version,
|
"version_up": self.version_up,
|
||||||
"variant": self.variant,
|
"variant": self.variant,
|
||||||
"comment": self.comment,
|
"comment": self.comment,
|
||||||
"new_folder_name": self.new_folder_name,
|
"new_folder_name": self.new_folder_name,
|
||||||
|
|
@ -974,7 +974,7 @@ class ProjectPushItemProcess:
|
||||||
"""Make sure version document exits in database."""
|
"""Make sure version document exits in database."""
|
||||||
|
|
||||||
project_name = self._item.dst_project_name
|
project_name = self._item.dst_project_name
|
||||||
version = self._item.dst_version
|
version_up = self._item.version_up
|
||||||
src_version_entity = self._src_version_entity
|
src_version_entity = self._src_version_entity
|
||||||
product_entity = self._product_entity
|
product_entity = self._product_entity
|
||||||
product_id = product_entity["id"]
|
product_id = product_entity["id"]
|
||||||
|
|
@ -1006,24 +1006,25 @@ class ProjectPushItemProcess:
|
||||||
if value:
|
if value:
|
||||||
dst_attrib[key] = value
|
dst_attrib[key] = value
|
||||||
|
|
||||||
if version is None:
|
last_version_entity = ayon_api.get_last_version_by_product_id(
|
||||||
last_version_entity = ayon_api.get_last_version_by_product_id(
|
project_name, product_id
|
||||||
project_name, product_id
|
)
|
||||||
|
if last_version_entity is None:
|
||||||
|
dst_version = get_versioning_start(
|
||||||
|
project_name,
|
||||||
|
self.host_name,
|
||||||
|
task_name=self._task_info.get("name"),
|
||||||
|
task_type=self._task_info.get("taskType"),
|
||||||
|
product_type=product_type,
|
||||||
|
product_name=product_entity["name"],
|
||||||
)
|
)
|
||||||
if last_version_entity:
|
else:
|
||||||
version = int(last_version_entity["version"]) + 1
|
dst_version = int(last_version_entity["version"])
|
||||||
else:
|
if version_up:
|
||||||
version = get_versioning_start(
|
dst_version += 1
|
||||||
project_name,
|
|
||||||
self.host_name,
|
|
||||||
task_name=self._task_info.get("name"),
|
|
||||||
task_type=self._task_info.get("taskType"),
|
|
||||||
product_type=product_type,
|
|
||||||
product_name=product_entity["name"],
|
|
||||||
)
|
|
||||||
|
|
||||||
existing_version_entity = ayon_api.get_version_by_name(
|
existing_version_entity = ayon_api.get_version_by_name(
|
||||||
project_name, version, product_id
|
project_name, dst_version, product_id
|
||||||
)
|
)
|
||||||
thumbnail_id = self._copy_version_thumbnail()
|
thumbnail_id = self._copy_version_thumbnail()
|
||||||
|
|
||||||
|
|
@ -1045,7 +1046,7 @@ class ProjectPushItemProcess:
|
||||||
copied_status = self._get_transferable_status(src_version_entity)
|
copied_status = self._get_transferable_status(src_version_entity)
|
||||||
|
|
||||||
version_entity = new_version_entity(
|
version_entity = new_version_entity(
|
||||||
version,
|
dst_version,
|
||||||
product_id,
|
product_id,
|
||||||
author=src_version_entity["author"],
|
author=src_version_entity["author"],
|
||||||
status=copied_status,
|
status=copied_status,
|
||||||
|
|
@ -1393,7 +1394,7 @@ class IntegrateModel:
|
||||||
variant,
|
variant,
|
||||||
comment,
|
comment,
|
||||||
new_folder_name,
|
new_folder_name,
|
||||||
dst_version,
|
version_up,
|
||||||
use_original_name
|
use_original_name
|
||||||
):
|
):
|
||||||
"""Create new item for integration.
|
"""Create new item for integration.
|
||||||
|
|
@ -1407,7 +1408,7 @@ class IntegrateModel:
|
||||||
variant (str): Variant name.
|
variant (str): Variant name.
|
||||||
comment (Union[str, None]): Comment.
|
comment (Union[str, None]): Comment.
|
||||||
new_folder_name (Union[str, None]): New folder name.
|
new_folder_name (Union[str, None]): New folder name.
|
||||||
dst_version (int): Destination version number.
|
version_up (bool): Should destination product be versioned up
|
||||||
use_original_name (bool): If original product names should be used
|
use_original_name (bool): If original product names should be used
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
@ -1424,7 +1425,7 @@ class IntegrateModel:
|
||||||
variant,
|
variant,
|
||||||
comment=comment,
|
comment=comment,
|
||||||
new_folder_name=new_folder_name,
|
new_folder_name=new_folder_name,
|
||||||
dst_version=dst_version,
|
version_up=version_up,
|
||||||
use_original_name=use_original_name
|
use_original_name=use_original_name
|
||||||
)
|
)
|
||||||
process_item = ProjectPushItemProcess(self, item)
|
process_item = ProjectPushItemProcess(self, item)
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,8 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
|
||||||
variant_input.setPlaceholderText("< Variant >")
|
variant_input.setPlaceholderText("< Variant >")
|
||||||
variant_input.setObjectName("ValidatedLineEdit")
|
variant_input.setObjectName("ValidatedLineEdit")
|
||||||
|
|
||||||
|
version_up_checkbox = NiceCheckbox(True, parent=inputs_widget)
|
||||||
|
|
||||||
comment_input = PlaceholderLineEdit(inputs_widget)
|
comment_input = PlaceholderLineEdit(inputs_widget)
|
||||||
comment_input.setPlaceholderText("< Publish comment >")
|
comment_input.setPlaceholderText("< Publish comment >")
|
||||||
|
|
||||||
|
|
@ -153,7 +155,11 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
|
||||||
inputs_layout.addRow("New folder name", folder_name_input)
|
inputs_layout.addRow("New folder name", folder_name_input)
|
||||||
inputs_layout.addRow("Variant", variant_input)
|
inputs_layout.addRow("Variant", variant_input)
|
||||||
inputs_layout.addRow(
|
inputs_layout.addRow(
|
||||||
"Use original product names", original_names_checkbox)
|
"Use original product names", original_names_checkbox
|
||||||
|
)
|
||||||
|
inputs_layout.addRow(
|
||||||
|
"Version up existing Product", version_up_checkbox
|
||||||
|
)
|
||||||
inputs_layout.addRow("Comment", comment_input)
|
inputs_layout.addRow("Comment", comment_input)
|
||||||
|
|
||||||
main_splitter.addWidget(context_widget)
|
main_splitter.addWidget(context_widget)
|
||||||
|
|
@ -209,8 +215,11 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
|
||||||
"Show error detail dialog to copy full error."
|
"Show error detail dialog to copy full error."
|
||||||
)
|
)
|
||||||
original_names_checkbox.setToolTip(
|
original_names_checkbox.setToolTip(
|
||||||
"Required for multi copy, doesn't allow changes "
|
"Required for multi copy, doesn't allow changes variant values."
|
||||||
"variant values."
|
)
|
||||||
|
version_up_checkbox.setToolTip(
|
||||||
|
"Version up existing product. If not selected version will be "
|
||||||
|
"updated."
|
||||||
)
|
)
|
||||||
|
|
||||||
overlay_close_btn = QtWidgets.QPushButton(
|
overlay_close_btn = QtWidgets.QPushButton(
|
||||||
|
|
@ -259,6 +268,8 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
|
||||||
library_only_checkbox.stateChanged.connect(self._on_library_only_change)
|
library_only_checkbox.stateChanged.connect(self._on_library_only_change)
|
||||||
original_names_checkbox.stateChanged.connect(
|
original_names_checkbox.stateChanged.connect(
|
||||||
self._on_original_names_change)
|
self._on_original_names_change)
|
||||||
|
version_up_checkbox.stateChanged.connect(
|
||||||
|
self._on_version_up_checkbox_change)
|
||||||
|
|
||||||
publish_btn.clicked.connect(self._on_select_click)
|
publish_btn.clicked.connect(self._on_select_click)
|
||||||
cancel_btn.clicked.connect(self._on_close_click)
|
cancel_btn.clicked.connect(self._on_close_click)
|
||||||
|
|
@ -308,6 +319,7 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
|
||||||
self._folder_name_input = folder_name_input
|
self._folder_name_input = folder_name_input
|
||||||
self._comment_input = comment_input
|
self._comment_input = comment_input
|
||||||
self._use_original_names_checkbox = original_names_checkbox
|
self._use_original_names_checkbox = original_names_checkbox
|
||||||
|
self._library_only_checkbox = library_only_checkbox
|
||||||
|
|
||||||
self._publish_btn = publish_btn
|
self._publish_btn = publish_btn
|
||||||
|
|
||||||
|
|
@ -328,6 +340,7 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
|
||||||
self._new_folder_name_input_text = None
|
self._new_folder_name_input_text = None
|
||||||
self._variant_input_text = None
|
self._variant_input_text = None
|
||||||
self._comment_input_text = None
|
self._comment_input_text = None
|
||||||
|
self._version_up_checkbox = version_up_checkbox
|
||||||
|
|
||||||
self._first_show = True
|
self._first_show = True
|
||||||
self._show_timer = show_timer
|
self._show_timer = show_timer
|
||||||
|
|
@ -344,6 +357,7 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
|
||||||
show_detail_btn.setVisible(False)
|
show_detail_btn.setVisible(False)
|
||||||
overlay_close_btn.setVisible(False)
|
overlay_close_btn.setVisible(False)
|
||||||
overlay_try_btn.setVisible(False)
|
overlay_try_btn.setVisible(False)
|
||||||
|
version_up_checkbox.setChecked(False)
|
||||||
|
|
||||||
# Support of public api function of controller
|
# Support of public api function of controller
|
||||||
def set_source(self, project_name, version_ids):
|
def set_source(self, project_name, version_ids):
|
||||||
|
|
@ -414,14 +428,18 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
|
||||||
self._comment_input_text = text
|
self._comment_input_text = text
|
||||||
self._user_input_changed_timer.start()
|
self._user_input_changed_timer.start()
|
||||||
|
|
||||||
def _on_library_only_change(self, state: int) -> None:
|
def _on_library_only_change(self) -> None:
|
||||||
"""Change toggle state, reset filter, recalculate dropdown"""
|
"""Change toggle state, reset filter, recalculate dropdown"""
|
||||||
state = bool(state)
|
is_checked = self._library_only_checkbox.isChecked()
|
||||||
self._projects_combobox.set_standard_filter_enabled(state)
|
self._projects_combobox.set_standard_filter_enabled(is_checked)
|
||||||
|
|
||||||
def _on_original_names_change(self, state: int) -> None:
|
def _on_original_names_change(self) -> None:
|
||||||
use_original_name = bool(state)
|
is_checked = self._use_original_names_checkbox.isChecked()
|
||||||
self._invalidate_use_original_names(use_original_name)
|
self._invalidate_use_original_names(is_checked)
|
||||||
|
|
||||||
|
def _on_version_up_checkbox_change(self) -> None:
|
||||||
|
is_checked = self._version_up_checkbox.isChecked()
|
||||||
|
self._controller.set_version_up(is_checked)
|
||||||
|
|
||||||
def _on_user_input_timer(self):
|
def _on_user_input_timer(self):
|
||||||
folder_name_enabled = self._new_folder_name_enabled
|
folder_name_enabled = self._new_folder_name_enabled
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue