mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Merge branch 'develop' into enhancement/1142-attach-reviewables-to-other-instances-using-enumdef-on-attachable-integrator
This commit is contained in:
commit
1e651ece9c
8 changed files with 69 additions and 12 deletions
|
|
@ -9,6 +9,7 @@ from .local_settings import (
|
||||||
AYONSettingsRegistry,
|
AYONSettingsRegistry,
|
||||||
get_launcher_local_dir,
|
get_launcher_local_dir,
|
||||||
get_launcher_storage_dir,
|
get_launcher_storage_dir,
|
||||||
|
get_addons_resources_dir,
|
||||||
get_local_site_id,
|
get_local_site_id,
|
||||||
get_ayon_username,
|
get_ayon_username,
|
||||||
)
|
)
|
||||||
|
|
@ -142,6 +143,7 @@ __all__ = [
|
||||||
"AYONSettingsRegistry",
|
"AYONSettingsRegistry",
|
||||||
"get_launcher_local_dir",
|
"get_launcher_local_dir",
|
||||||
"get_launcher_storage_dir",
|
"get_launcher_storage_dir",
|
||||||
|
"get_addons_resources_dir",
|
||||||
"get_local_site_id",
|
"get_local_site_id",
|
||||||
"get_ayon_username",
|
"get_ayon_username",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,30 @@ def get_launcher_local_dir(*subdirs: str) -> str:
|
||||||
return os.path.join(storage_dir, *subdirs)
|
return os.path.join(storage_dir, *subdirs)
|
||||||
|
|
||||||
|
|
||||||
|
def get_addons_resources_dir(addon_name: str, *args) -> str:
|
||||||
|
"""Get directory for storing resources for addons.
|
||||||
|
|
||||||
|
Some addons might need to store ad-hoc resources that are not part of
|
||||||
|
addon client package (e.g. because of size). Studio might define
|
||||||
|
dedicated directory to store them with 'AYON_ADDONS_RESOURCES_DIR'
|
||||||
|
environment variable. By default, is used 'addons_resources' in
|
||||||
|
launcher storage (might be shared across platforms).
|
||||||
|
|
||||||
|
Args:
|
||||||
|
addon_name (str): Addon name.
|
||||||
|
*args (str): Subfolders in resources directory.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: Path to resources directory.
|
||||||
|
|
||||||
|
"""
|
||||||
|
addons_resources_dir = os.getenv("AYON_ADDONS_RESOURCES_DIR")
|
||||||
|
if not addons_resources_dir:
|
||||||
|
addons_resources_dir = get_launcher_storage_dir("addons_resources")
|
||||||
|
|
||||||
|
return os.path.join(addons_resources_dir, addon_name, *args)
|
||||||
|
|
||||||
|
|
||||||
class AYONSecureRegistry:
|
class AYONSecureRegistry:
|
||||||
"""Store information using keyring.
|
"""Store information using keyring.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,6 +286,7 @@ class ProjectSortFilterProxy(QtCore.QSortFilterProxyModel):
|
||||||
self._sort_by_type = True
|
self._sort_by_type = True
|
||||||
# Disable case sensitivity
|
# Disable case sensitivity
|
||||||
self.setSortCaseSensitivity(QtCore.Qt.CaseInsensitive)
|
self.setSortCaseSensitivity(QtCore.Qt.CaseInsensitive)
|
||||||
|
self.setFilterCaseSensitivity(QtCore.Qt.CaseInsensitive)
|
||||||
|
|
||||||
def _type_sort(self, l_index, r_index):
|
def _type_sort(self, l_index, r_index):
|
||||||
if not self._sort_by_type:
|
if not self._sort_by_type:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
from typing import Optional, List, Set, Any
|
from typing import Optional, List, Set, Any
|
||||||
|
|
||||||
from qtpy import QtWidgets, QtCore, QtGui
|
from qtpy import QtWidgets, QtCore, QtGui
|
||||||
|
|
@ -410,10 +411,12 @@ class ExpandingTextEdit(QtWidgets.QTextEdit):
|
||||||
document = self.document().clone()
|
document = self.document().clone()
|
||||||
document.setTextWidth(document_width)
|
document.setTextWidth(document_width)
|
||||||
|
|
||||||
return margins.top() + document.size().height() + margins.bottom()
|
return math.ceil(
|
||||||
|
margins.top() + document.size().height() + margins.bottom()
|
||||||
|
)
|
||||||
|
|
||||||
def sizeHint(self):
|
def sizeHint(self):
|
||||||
width = super(ExpandingTextEdit, self).sizeHint().width()
|
width = super().sizeHint().width()
|
||||||
return QtCore.QSize(width, self.heightForWidth(width))
|
return QtCore.QSize(width, self.heightForWidth(width))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1016,6 +1016,7 @@ class AbstractWorkfilesFrontend(AbstractWorkfilesCommon):
|
||||||
workdir,
|
workdir,
|
||||||
filename,
|
filename,
|
||||||
template_key,
|
template_key,
|
||||||
|
artist_note,
|
||||||
):
|
):
|
||||||
"""Save current state of workfile to workarea.
|
"""Save current state of workfile to workarea.
|
||||||
|
|
||||||
|
|
@ -1040,6 +1041,7 @@ class AbstractWorkfilesFrontend(AbstractWorkfilesCommon):
|
||||||
workdir,
|
workdir,
|
||||||
filename,
|
filename,
|
||||||
template_key,
|
template_key,
|
||||||
|
artist_note,
|
||||||
):
|
):
|
||||||
"""Action to copy published workfile representation to workarea.
|
"""Action to copy published workfile representation to workarea.
|
||||||
|
|
||||||
|
|
@ -1054,12 +1056,13 @@ class AbstractWorkfilesFrontend(AbstractWorkfilesCommon):
|
||||||
workdir (str): Workarea directory.
|
workdir (str): Workarea directory.
|
||||||
filename (str): Workarea filename.
|
filename (str): Workarea filename.
|
||||||
template_key (str): Template key.
|
template_key (str): Template key.
|
||||||
|
artist_note (str): Artist note.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def duplicate_workfile(self, src_filepath, workdir, filename):
|
def duplicate_workfile(self, src_filepath, workdir, filename, artist_note):
|
||||||
"""Duplicate workfile.
|
"""Duplicate workfile.
|
||||||
|
|
||||||
Workfiles is not opened when done.
|
Workfiles is not opened when done.
|
||||||
|
|
@ -1068,6 +1071,7 @@ class AbstractWorkfilesFrontend(AbstractWorkfilesCommon):
|
||||||
src_filepath (str): Source workfile path.
|
src_filepath (str): Source workfile path.
|
||||||
workdir (str): Destination workdir.
|
workdir (str): Destination workdir.
|
||||||
filename (str): Destination filename.
|
filename (str): Destination filename.
|
||||||
|
artist_note (str): Artist note.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -554,6 +554,7 @@ class BaseWorkfileController(
|
||||||
workdir,
|
workdir,
|
||||||
filename,
|
filename,
|
||||||
template_key,
|
template_key,
|
||||||
|
artist_note,
|
||||||
):
|
):
|
||||||
self._emit_event("save_as.started")
|
self._emit_event("save_as.started")
|
||||||
|
|
||||||
|
|
@ -565,6 +566,7 @@ class BaseWorkfileController(
|
||||||
workdir,
|
workdir,
|
||||||
filename,
|
filename,
|
||||||
template_key,
|
template_key,
|
||||||
|
artist_note=artist_note,
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
failed = True
|
failed = True
|
||||||
|
|
@ -584,6 +586,7 @@ class BaseWorkfileController(
|
||||||
workdir,
|
workdir,
|
||||||
filename,
|
filename,
|
||||||
template_key,
|
template_key,
|
||||||
|
artist_note,
|
||||||
):
|
):
|
||||||
self._emit_event("copy_representation.started")
|
self._emit_event("copy_representation.started")
|
||||||
|
|
||||||
|
|
@ -595,6 +598,7 @@ class BaseWorkfileController(
|
||||||
workdir,
|
workdir,
|
||||||
filename,
|
filename,
|
||||||
template_key,
|
template_key,
|
||||||
|
artist_note,
|
||||||
src_filepath=representation_filepath
|
src_filepath=representation_filepath
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
@ -608,7 +612,7 @@ class BaseWorkfileController(
|
||||||
{"failed": failed},
|
{"failed": failed},
|
||||||
)
|
)
|
||||||
|
|
||||||
def duplicate_workfile(self, src_filepath, workdir, filename):
|
def duplicate_workfile(self, src_filepath, workdir, filename, artist_note):
|
||||||
self._emit_event("workfile_duplicate.started")
|
self._emit_event("workfile_duplicate.started")
|
||||||
|
|
||||||
failed = False
|
failed = False
|
||||||
|
|
@ -701,11 +705,12 @@ class BaseWorkfileController(
|
||||||
|
|
||||||
def _save_as_workfile(
|
def _save_as_workfile(
|
||||||
self,
|
self,
|
||||||
folder_id,
|
folder_id: str,
|
||||||
task_id,
|
task_id: str,
|
||||||
workdir,
|
workdir: str,
|
||||||
filename,
|
filename: str,
|
||||||
template_key,
|
template_key: str,
|
||||||
|
artist_note: str,
|
||||||
src_filepath=None,
|
src_filepath=None,
|
||||||
):
|
):
|
||||||
# Trigger before save event
|
# Trigger before save event
|
||||||
|
|
@ -748,7 +753,11 @@ class BaseWorkfileController(
|
||||||
self._host_save_workfile(dst_filepath)
|
self._host_save_workfile(dst_filepath)
|
||||||
|
|
||||||
# Make sure workfile info exists
|
# Make sure workfile info exists
|
||||||
self.save_workfile_info(folder_id, task_name, dst_filepath, None)
|
if not artist_note:
|
||||||
|
artist_note = None
|
||||||
|
self.save_workfile_info(
|
||||||
|
folder_id, task_name, dst_filepath, note=artist_note
|
||||||
|
)
|
||||||
|
|
||||||
# Create extra folders
|
# Create extra folders
|
||||||
create_workdir_extra_folders(
|
create_workdir_extra_folders(
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,8 @@ class FilesWidget(QtWidgets.QWidget):
|
||||||
self._controller.duplicate_workfile(
|
self._controller.duplicate_workfile(
|
||||||
filepath,
|
filepath,
|
||||||
result["workdir"],
|
result["workdir"],
|
||||||
result["filename"]
|
result["filename"],
|
||||||
|
artist_note=result["artist_note"]
|
||||||
)
|
)
|
||||||
|
|
||||||
def _on_workarea_browse_clicked(self):
|
def _on_workarea_browse_clicked(self):
|
||||||
|
|
@ -261,6 +262,7 @@ class FilesWidget(QtWidgets.QWidget):
|
||||||
result["workdir"],
|
result["workdir"],
|
||||||
result["filename"],
|
result["filename"],
|
||||||
result["template_key"],
|
result["template_key"],
|
||||||
|
artist_note=result["artist_note"]
|
||||||
)
|
)
|
||||||
|
|
||||||
def _on_workarea_path_changed(self, event):
|
def _on_workarea_path_changed(self, event):
|
||||||
|
|
@ -313,6 +315,7 @@ class FilesWidget(QtWidgets.QWidget):
|
||||||
result["workdir"],
|
result["workdir"],
|
||||||
result["filename"],
|
result["filename"],
|
||||||
result["template_key"],
|
result["template_key"],
|
||||||
|
artist_note=result["artist_note"]
|
||||||
)
|
)
|
||||||
|
|
||||||
def _on_save_as_request(self):
|
def _on_save_as_request(self):
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from qtpy import QtWidgets, QtCore
|
from qtpy import QtWidgets, QtCore
|
||||||
|
|
||||||
from ayon_core.tools.utils import PlaceholderLineEdit
|
from ayon_core.tools.utils import PlaceholderLineEdit, PlaceholderPlainTextEdit
|
||||||
|
|
||||||
|
|
||||||
class SubversionLineEdit(QtWidgets.QWidget):
|
class SubversionLineEdit(QtWidgets.QWidget):
|
||||||
|
|
@ -143,6 +143,11 @@ class SaveAsDialog(QtWidgets.QDialog):
|
||||||
version_layout.addWidget(version_input)
|
version_layout.addWidget(version_input)
|
||||||
version_layout.addWidget(last_version_check)
|
version_layout.addWidget(last_version_check)
|
||||||
|
|
||||||
|
# Artist note widget
|
||||||
|
artist_note_input = PlaceholderPlainTextEdit(inputs_widget)
|
||||||
|
artist_note_input.setPlaceholderText(
|
||||||
|
"Provide a note about this workfile.")
|
||||||
|
|
||||||
# Preview widget
|
# Preview widget
|
||||||
preview_widget = QtWidgets.QLabel("Preview filename", inputs_widget)
|
preview_widget = QtWidgets.QLabel("Preview filename", inputs_widget)
|
||||||
preview_widget.setWordWrap(True)
|
preview_widget.setWordWrap(True)
|
||||||
|
|
@ -161,6 +166,7 @@ class SaveAsDialog(QtWidgets.QDialog):
|
||||||
subversion_label = QtWidgets.QLabel("Subversion:", inputs_widget)
|
subversion_label = QtWidgets.QLabel("Subversion:", inputs_widget)
|
||||||
extension_label = QtWidgets.QLabel("Extension:", inputs_widget)
|
extension_label = QtWidgets.QLabel("Extension:", inputs_widget)
|
||||||
preview_label = QtWidgets.QLabel("Preview:", inputs_widget)
|
preview_label = QtWidgets.QLabel("Preview:", inputs_widget)
|
||||||
|
artist_note_label = QtWidgets.QLabel("Artist Note:", inputs_widget)
|
||||||
|
|
||||||
# Build inputs
|
# Build inputs
|
||||||
inputs_layout = QtWidgets.QGridLayout(inputs_widget)
|
inputs_layout = QtWidgets.QGridLayout(inputs_widget)
|
||||||
|
|
@ -172,6 +178,8 @@ class SaveAsDialog(QtWidgets.QDialog):
|
||||||
inputs_layout.addWidget(extension_combobox, 2, 1)
|
inputs_layout.addWidget(extension_combobox, 2, 1)
|
||||||
inputs_layout.addWidget(preview_label, 3, 0)
|
inputs_layout.addWidget(preview_label, 3, 0)
|
||||||
inputs_layout.addWidget(preview_widget, 3, 1)
|
inputs_layout.addWidget(preview_widget, 3, 1)
|
||||||
|
inputs_layout.addWidget(artist_note_label, 4, 0, 1, 2)
|
||||||
|
inputs_layout.addWidget(artist_note_input, 5, 0, 1, 2)
|
||||||
|
|
||||||
# Build layout
|
# Build layout
|
||||||
main_layout = QtWidgets.QVBoxLayout(self)
|
main_layout = QtWidgets.QVBoxLayout(self)
|
||||||
|
|
@ -206,11 +214,13 @@ class SaveAsDialog(QtWidgets.QDialog):
|
||||||
self._extension_combobox = extension_combobox
|
self._extension_combobox = extension_combobox
|
||||||
self._subversion_input = subversion_input
|
self._subversion_input = subversion_input
|
||||||
self._preview_widget = preview_widget
|
self._preview_widget = preview_widget
|
||||||
|
self._artist_note_input = artist_note_input
|
||||||
|
|
||||||
self._version_label = version_label
|
self._version_label = version_label
|
||||||
self._subversion_label = subversion_label
|
self._subversion_label = subversion_label
|
||||||
self._extension_label = extension_label
|
self._extension_label = extension_label
|
||||||
self._preview_label = preview_label
|
self._preview_label = preview_label
|
||||||
|
self._artist_note_label = artist_note_label
|
||||||
|
|
||||||
# Post init setup
|
# Post init setup
|
||||||
|
|
||||||
|
|
@ -322,6 +332,7 @@ class SaveAsDialog(QtWidgets.QDialog):
|
||||||
"folder_id": self._folder_id,
|
"folder_id": self._folder_id,
|
||||||
"task_id": self._task_id,
|
"task_id": self._task_id,
|
||||||
"template_key": self._template_key,
|
"template_key": self._template_key,
|
||||||
|
"artist_note": self._artist_note_input.toPlainText(),
|
||||||
}
|
}
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue