From 664e62ec29a0c1edc3507cd9fce9e6ced22122ed Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 12 Mar 2021 18:48:37 +0100 Subject: [PATCH 1/4] removed addition ftrack paths from project settings --- .../defaults/project_settings/ftrack.json | 2 -- .../schema_project_ftrack.json | 22 ------------------- 2 files changed, 24 deletions(-) diff --git a/pype/settings/defaults/project_settings/ftrack.json b/pype/settings/defaults/project_settings/ftrack.json index 17607b6bc1..03ac8f309f 100644 --- a/pype/settings/defaults/project_settings/ftrack.json +++ b/pype/settings/defaults/project_settings/ftrack.json @@ -1,6 +1,4 @@ { - "ftrack_actions_path": [], - "ftrack_events_path": [], "events": { "sync_to_avalon": { "enabled": true, diff --git a/pype/settings/entities/schemas/projects_schema/schema_project_ftrack.json b/pype/settings/entities/schemas/projects_schema/schema_project_ftrack.json index 39cd79e851..eefc0e12b7 100644 --- a/pype/settings/entities/schemas/projects_schema/schema_project_ftrack.json +++ b/pype/settings/entities/schemas/projects_schema/schema_project_ftrack.json @@ -5,28 +5,6 @@ "collapsible": true, "is_file": true, "children": [ - { - "type": "splitter" - }, - { - "type": "label", - "label": "Additional Ftrack paths" - }, - { - "type": "list", - "key": "ftrack_actions_path", - "label": "Action paths", - "object_type": "text" - }, - { - "type": "list", - "key": "ftrack_events_path", - "label": "Event paths", - "object_type": "text" - }, - { - "type": "splitter" - }, { "type": "dict", "key": "events", From a6ed0d65c36c7e15d2492ebc0079217f1c60ade8 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 12 Mar 2021 18:51:18 +0100 Subject: [PATCH 2/4] renamed type "path-widget" to "path" --- pype/settings/entities/item_entities.py | 2 +- pype/settings/entities/schemas/README.md | 4 ++-- .../entities/schemas/projects_schema/schema_main.json | 2 +- .../projects_schema/schemas/schema_anatomy_imageio.json | 4 ++-- .../projects_schema/schemas/schema_maya_publish.json | 2 +- .../entities/schemas/system_schema/example_schema.json | 8 ++++---- .../entities/schemas/system_schema/example_template.json | 2 +- .../host_settings/template_host_variant.json | 2 +- .../entities/schemas/system_schema/schema_general.json | 4 ++-- .../entities/schemas/system_schema/schema_modules.json | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pype/settings/entities/item_entities.py b/pype/settings/entities/item_entities.py index 5986d685d6..2f2573721b 100644 --- a/pype/settings/entities/item_entities.py +++ b/pype/settings/entities/item_entities.py @@ -10,7 +10,7 @@ from .base_entity import ItemEntity class PathEntity(ItemEntity): - schema_types = ["path-widget", "path-item"] + schema_types = ["path"] platforms = ("windows", "darwin", "linux") platform_labels_mapping = { "windows": "Windows", diff --git a/pype/settings/entities/schemas/README.md b/pype/settings/entities/schemas/README.md index 65d73a0728..80125d4b1b 100644 --- a/pype/settings/entities/schemas/README.md +++ b/pype/settings/entities/schemas/README.md @@ -47,7 +47,7 @@ "key": "{host_name}_environments", "env_group_key": "{host_name}" }, { - "type": "path-widget", + "type": "path", "key": "{host_name}_executables", "label": "{host_label} - Full paths to executables", "multiplatform": "{multipath_executables}", @@ -361,7 +361,7 @@ ``` { - "type": "path-widget", + "type": "path", "key": "ffmpeg_path", "label": "FFmpeg path", "multiplatform": true, diff --git a/pype/settings/entities/schemas/projects_schema/schema_main.json b/pype/settings/entities/schemas/projects_schema/schema_main.json index 31d7373873..828739e046 100644 --- a/pype/settings/entities/schemas/projects_schema/schema_main.json +++ b/pype/settings/entities/schemas/projects_schema/schema_main.json @@ -15,7 +15,7 @@ "is_group": true, "expandable": false, "object_type": { - "type": "path-widget", + "type": "path", "multiplatform": true } }, diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_imageio.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_imageio.json index 7070e4b54f..b48f90bd91 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_imageio.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_anatomy_imageio.json @@ -39,7 +39,7 @@ ] }, { - "type": "path-widget", + "type": "path", "key": "ocioconfigpath", "label": "Custom OCIO path", "multiplatform": true, @@ -175,7 +175,7 @@ ] }, { - "type": "path-widget", + "type": "path", "key": "customOCIOConfigPath", "label": "Custom OCIO config path", "multiplatform": true, diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json index 6ecda224ea..bb0e162c04 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json @@ -93,7 +93,7 @@ "label": "Path to material file defining list of material names to check. This is material name per line simple text file.
It will be checked against named group shader in your Validation regex.

For example:
^.*(?P=<shader>.+)_GEO

" }, { - "type": "path-widget", + "type": "path", "key": "material_file", "label": "Material File", "multiplatform": true, diff --git a/pype/settings/entities/schemas/system_schema/example_schema.json b/pype/settings/entities/schemas/system_schema/example_schema.json index c8920db88a..6e7a47d1bf 100644 --- a/pype/settings/entities/schemas/system_schema/example_schema.json +++ b/pype/settings/entities/schemas/system_schema/example_schema.json @@ -298,28 +298,28 @@ } }, { - "type": "path-widget", + "type": "path", "key": "single_path_input", "label": "Single path input", "multiplatform": false, "multipath": false }, { - "type": "path-widget", + "type": "path", "key": "multi_path_input", "label": "Multi path input", "multiplatform": false, "multipath": true }, { - "type": "path-widget", + "type": "path", "key": "single_os_specific_path_input", "label": "Single OS specific path input", "multiplatform": true, "multipath": false }, { - "type": "path-widget", + "type": "path", "key": "multi_os_specific_path_input", "label": "Multi OS specific path input", "multiplatform": true, diff --git a/pype/settings/entities/schemas/system_schema/example_template.json b/pype/settings/entities/schemas/system_schema/example_template.json index d9e6935407..ff78c78e8f 100644 --- a/pype/settings/entities/schemas/system_schema/example_template.json +++ b/pype/settings/entities/schemas/system_schema/example_template.json @@ -11,7 +11,7 @@ "env_group_key": "{host_name}" }, { - "type": "path-widget", + "type": "path", "key": "{host_name}_executables", "label": "{host_label} - Full paths to executables", "multiplatform": "{multipath_executables}", diff --git a/pype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json b/pype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json index 06f7859117..244b9c1f56 100644 --- a/pype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json +++ b/pype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json @@ -39,7 +39,7 @@ "roles": ["developer"] }, { - "type": "path-widget", + "type": "path", "key": "executables", "label": "Executables", "multiplatform": "{multiplatform}", diff --git a/pype/settings/entities/schemas/system_schema/schema_general.json b/pype/settings/entities/schemas/system_schema/schema_general.json index f75b584c1b..b029081c7c 100644 --- a/pype/settings/entities/schemas/system_schema/schema_general.json +++ b/pype/settings/entities/schemas/system_schema/schema_general.json @@ -20,14 +20,14 @@ }, { "key": "project_plugins", - "type": "path-widget", + "type": "path", "label": "Additional Project Plugins Path", "multiplatform": true, "multipath": false }, { "key": "studio_soft", - "type": "path-widget", + "type": "path", "label": "Studio Software Location", "multiplatform": true, "multipath": false diff --git a/pype/settings/entities/schemas/system_schema/schema_modules.json b/pype/settings/entities/schemas/system_schema/schema_modules.json index 2ee316f29e..8bfb0e90dc 100644 --- a/pype/settings/entities/schemas/system_schema/schema_modules.json +++ b/pype/settings/entities/schemas/system_schema/schema_modules.json @@ -18,7 +18,7 @@ "label": "Avalon Mongo Timeout (ms)" }, { - "type": "path-widget", + "type": "path", "label": "Thumbnail Storage Location", "key": "AVALON_THUMBNAIL_ROOT", "multiplatform": true, From abb3223a1ed0c3ee40f09c81585912b9bd66d26e Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 12 Mar 2021 20:19:51 +0100 Subject: [PATCH 3/4] path widget can handle `use_label_wrap` --- .../settings/settings/widgets/item_widgets.py | 104 ++++++++++++++---- 1 file changed, 84 insertions(+), 20 deletions(-) diff --git a/pype/tools/settings/settings/widgets/item_widgets.py b/pype/tools/settings/settings/widgets/item_widgets.py index bdc96840f2..7cfcd84488 100644 --- a/pype/tools/settings/settings/widgets/item_widgets.py +++ b/pype/tools/settings/settings/widgets/item_widgets.py @@ -489,16 +489,54 @@ class EnumeratorWidget(InputWidget): class PathWidget(BaseWidget): def create_ui(self): - self.content_widget = self - self.content_layout = QtWidgets.QGridLayout(self) - self.content_layout.setContentsMargins(0, 0, 0, 0) - self.content_layout.setSpacing(5) + self._child_style_state = "" + + if self.entity.use_label_wrap: + entity_label = None + self._create_label_wrapper() + else: + entity_label = self.entity.label + self.content_widget = self + self.content_layout = QtWidgets.QGridLayout(self) + self.content_layout.setContentsMargins(0, 0, 0, 0) + self.content_layout.setSpacing(5) + self.body_widget = None + + self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.input_field = self.create_ui_for_entity( self.category_widget, self.entity.child_obj, self ) + self.entity_widget.add_widget_to_layout(self, entity_label) - self.entity_widget.add_widget_to_layout(self, self.entity.label) + def _create_label_wrapper(self): + main_layout = QtWidgets.QHBoxLayout(self) + main_layout.setContentsMargins(0, 0, 0, 0) + main_layout.setSpacing(0) + + body_widget = ExpandingWidget(self.entity.label, self) + main_layout.addWidget(body_widget) + self.label_widget = body_widget.label_widget + + self.body_widget = body_widget + + content_widget = QtWidgets.QWidget(body_widget) + content_widget.setObjectName("ContentWidget") + content_widget.setProperty("content_state", "") + content_layout = QtWidgets.QGridLayout(content_widget) + content_layout.setContentsMargins(CHILD_OFFSET, 5, 0, 5) + + body_widget.set_content_widget(content_widget) + + self.body_widget = body_widget + self.content_widget = content_widget + self.content_layout = content_layout + + if not self.entity.collapsible: + body_widget.hide_toolbox(hide_content=False) + + elif self.entity.collapsed: + body_widget.toggle_content() def add_widget_to_layout(self, widget, label=None): row = self.content_layout.rowCount() @@ -523,26 +561,52 @@ class PathWidget(BaseWidget): pass def update_style(self): - if not self.label_widget: + if not self.body_widget and not self.label_widget: return - has_unsaved_changes = self.entity.has_unsaved_changes - if not has_unsaved_changes and self.entity.group_item: - has_unsaved_changes = self.entity.group_item.has_unsaved_changes + if self.entity.group_item: + group_item = self.entity.group_item + has_unsaved_changes = group_item.has_unsaved_changes + has_project_override = group_item.has_project_override + has_studio_override = group_item.has_studio_override + else: + has_unsaved_changes = self.entity.has_unsaved_changes + has_project_override = self.entity.has_project_override + has_studio_override = self.entity.has_studio_override - state = self.get_style_state( - self.is_invalid, - has_unsaved_changes, - self.entity.has_project_override, - self.entity.has_studio_override - ) - if self._style_state == state: - return + child_invalid = self.is_invalid - self._style_state = state + if self.body_widget: + child_style_state = self.get_style_state( + child_invalid, + has_unsaved_changes, + has_project_override, + has_studio_override + ) + if child_style_state: + child_style_state = "child-{}".format(child_style_state) - self.label_widget.setProperty("state", state) - self.label_widget.style().polish(self.label_widget) + if child_style_state != self._child_style_state: + self.body_widget.side_line_widget.setProperty( + "state", child_style_state + ) + self.body_widget.side_line_widget.style().polish( + self.body_widget.side_line_widget + ) + self._child_style_state = child_style_state + + if self.label_widget: + style_state = self.get_style_state( + child_invalid, + has_unsaved_changes, + has_project_override, + has_studio_override + ) + if self._style_state != style_state: + self.label_widget.setProperty("state", style_state) + self.label_widget.style().polish(self.label_widget) + + self._style_state = style_state @property def is_invalid(self): From 351df91ce1cc02ba8414e7ae120ab38ac921e167 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 16 Mar 2021 16:11:36 +0100 Subject: [PATCH 4/4] Duplicated keys in dictionary are not handled during initialization but schema validations --- pype/settings/entities/dict_immutable_keys_entity.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pype/settings/entities/dict_immutable_keys_entity.py b/pype/settings/entities/dict_immutable_keys_entity.py index af0ddcb758..208f976314 100644 --- a/pype/settings/entities/dict_immutable_keys_entity.py +++ b/pype/settings/entities/dict_immutable_keys_entity.py @@ -10,6 +10,7 @@ from pype.settings.constants import ( M_OVERRIDEN_KEY ) from . import ( + BaseItemEntity, ItemEntity, BoolEntity, GUIEntity @@ -75,6 +76,15 @@ class DictImmutableKeysEntity(ItemEntity): def schema_validations(self): """Validation of schema data.""" + children_keys = set() + for child_entity in self.children: + if not isinstance(child_entity, BaseItemEntity): + continue + elif child_entity.key not in children_keys: + children_keys.add(child_entity.key) + else: + raise SchemaDuplicatedKeys(self.path, child_entity.key) + if self.checkbox_key: checkbox_child = self.non_gui_children.get(self.checkbox_key) if not checkbox_child: @@ -134,8 +144,6 @@ class DictImmutableKeysEntity(ItemEntity): if isinstance(child_obj, GUIEntity): continue - if child_obj.key in self.non_gui_children: - raise SchemaDuplicatedKeys("", child_obj.key) self.non_gui_children[child_obj.key] = child_obj if not first: