mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge pull request #1129 from pypeclub/bugfix/settings_cleanup
Settings schemas cleanup
This commit is contained in:
commit
0ebe79e199
14 changed files with 110 additions and 62 deletions
|
|
@ -1,6 +1,4 @@
|
||||||
{
|
{
|
||||||
"ftrack_actions_path": [],
|
|
||||||
"ftrack_events_path": [],
|
|
||||||
"events": {
|
"events": {
|
||||||
"sync_to_avalon": {
|
"sync_to_avalon": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ from pype.settings.constants import (
|
||||||
M_OVERRIDEN_KEY
|
M_OVERRIDEN_KEY
|
||||||
)
|
)
|
||||||
from . import (
|
from . import (
|
||||||
|
BaseItemEntity,
|
||||||
ItemEntity,
|
ItemEntity,
|
||||||
BoolEntity,
|
BoolEntity,
|
||||||
GUIEntity
|
GUIEntity
|
||||||
|
|
@ -75,6 +76,15 @@ class DictImmutableKeysEntity(ItemEntity):
|
||||||
|
|
||||||
def schema_validations(self):
|
def schema_validations(self):
|
||||||
"""Validation of schema data."""
|
"""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:
|
if self.checkbox_key:
|
||||||
checkbox_child = self.non_gui_children.get(self.checkbox_key)
|
checkbox_child = self.non_gui_children.get(self.checkbox_key)
|
||||||
if not checkbox_child:
|
if not checkbox_child:
|
||||||
|
|
@ -134,8 +144,6 @@ class DictImmutableKeysEntity(ItemEntity):
|
||||||
if isinstance(child_obj, GUIEntity):
|
if isinstance(child_obj, GUIEntity):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if child_obj.key in self.non_gui_children:
|
|
||||||
raise SchemaDuplicatedKeys("", child_obj.key)
|
|
||||||
self.non_gui_children[child_obj.key] = child_obj
|
self.non_gui_children[child_obj.key] = child_obj
|
||||||
|
|
||||||
if not first:
|
if not first:
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from .base_entity import ItemEntity
|
||||||
|
|
||||||
|
|
||||||
class PathEntity(ItemEntity):
|
class PathEntity(ItemEntity):
|
||||||
schema_types = ["path-widget", "path-item"]
|
schema_types = ["path"]
|
||||||
platforms = ("windows", "darwin", "linux")
|
platforms = ("windows", "darwin", "linux")
|
||||||
platform_labels_mapping = {
|
platform_labels_mapping = {
|
||||||
"windows": "Windows",
|
"windows": "Windows",
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
"key": "{host_name}_environments",
|
"key": "{host_name}_environments",
|
||||||
"env_group_key": "{host_name}"
|
"env_group_key": "{host_name}"
|
||||||
}, {
|
}, {
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"key": "{host_name}_executables",
|
"key": "{host_name}_executables",
|
||||||
"label": "{host_label} - Full paths to executables",
|
"label": "{host_label} - Full paths to executables",
|
||||||
"multiplatform": "{multipath_executables}",
|
"multiplatform": "{multipath_executables}",
|
||||||
|
|
@ -361,7 +361,7 @@
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"key": "ffmpeg_path",
|
"key": "ffmpeg_path",
|
||||||
"label": "FFmpeg path",
|
"label": "FFmpeg path",
|
||||||
"multiplatform": true,
|
"multiplatform": true,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
"is_group": true,
|
"is_group": true,
|
||||||
"expandable": false,
|
"expandable": false,
|
||||||
"object_type": {
|
"object_type": {
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"multiplatform": true
|
"multiplatform": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -5,28 +5,6 @@
|
||||||
"collapsible": true,
|
"collapsible": true,
|
||||||
"is_file": true,
|
"is_file": true,
|
||||||
"children": [
|
"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",
|
"type": "dict",
|
||||||
"key": "events",
|
"key": "events",
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"key": "ocioconfigpath",
|
"key": "ocioconfigpath",
|
||||||
"label": "Custom OCIO path",
|
"label": "Custom OCIO path",
|
||||||
"multiplatform": true,
|
"multiplatform": true,
|
||||||
|
|
@ -175,7 +175,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"key": "customOCIOConfigPath",
|
"key": "customOCIOConfigPath",
|
||||||
"label": "Custom OCIO config path",
|
"label": "Custom OCIO config path",
|
||||||
"multiplatform": true,
|
"multiplatform": true,
|
||||||
|
|
|
||||||
|
|
@ -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.<br/>It will be checked against named group <b>shader</b> in your <em>Validation regex</em>.<p>For example: <br/> <code>^.*(?P=<shader>.+)_GEO</code></p>"
|
"label": "Path to material file defining list of material names to check. This is material name per line simple text file.<br/>It will be checked against named group <b>shader</b> in your <em>Validation regex</em>.<p>For example: <br/> <code>^.*(?P=<shader>.+)_GEO</code></p>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"key": "material_file",
|
"key": "material_file",
|
||||||
"label": "Material File",
|
"label": "Material File",
|
||||||
"multiplatform": true,
|
"multiplatform": true,
|
||||||
|
|
|
||||||
|
|
@ -298,28 +298,28 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"key": "single_path_input",
|
"key": "single_path_input",
|
||||||
"label": "Single path input",
|
"label": "Single path input",
|
||||||
"multiplatform": false,
|
"multiplatform": false,
|
||||||
"multipath": false
|
"multipath": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"key": "multi_path_input",
|
"key": "multi_path_input",
|
||||||
"label": "Multi path input",
|
"label": "Multi path input",
|
||||||
"multiplatform": false,
|
"multiplatform": false,
|
||||||
"multipath": true
|
"multipath": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"key": "single_os_specific_path_input",
|
"key": "single_os_specific_path_input",
|
||||||
"label": "Single OS specific path input",
|
"label": "Single OS specific path input",
|
||||||
"multiplatform": true,
|
"multiplatform": true,
|
||||||
"multipath": false
|
"multipath": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"key": "multi_os_specific_path_input",
|
"key": "multi_os_specific_path_input",
|
||||||
"label": "Multi OS specific path input",
|
"label": "Multi OS specific path input",
|
||||||
"multiplatform": true,
|
"multiplatform": true,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
"env_group_key": "{host_name}"
|
"env_group_key": "{host_name}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"key": "{host_name}_executables",
|
"key": "{host_name}_executables",
|
||||||
"label": "{host_label} - Full paths to executables",
|
"label": "{host_label} - Full paths to executables",
|
||||||
"multiplatform": "{multipath_executables}",
|
"multiplatform": "{multipath_executables}",
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
"roles": ["developer"]
|
"roles": ["developer"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"key": "executables",
|
"key": "executables",
|
||||||
"label": "Executables",
|
"label": "Executables",
|
||||||
"multiplatform": "{multiplatform}",
|
"multiplatform": "{multiplatform}",
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,14 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "project_plugins",
|
"key": "project_plugins",
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"label": "Additional Project Plugins Path",
|
"label": "Additional Project Plugins Path",
|
||||||
"multiplatform": true,
|
"multiplatform": true,
|
||||||
"multipath": false
|
"multipath": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "studio_soft",
|
"key": "studio_soft",
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"label": "Studio Software Location",
|
"label": "Studio Software Location",
|
||||||
"multiplatform": true,
|
"multiplatform": true,
|
||||||
"multipath": false
|
"multipath": false
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
"label": "Avalon Mongo Timeout (ms)"
|
"label": "Avalon Mongo Timeout (ms)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path-widget",
|
"type": "path",
|
||||||
"label": "Thumbnail Storage Location",
|
"label": "Thumbnail Storage Location",
|
||||||
"key": "AVALON_THUMBNAIL_ROOT",
|
"key": "AVALON_THUMBNAIL_ROOT",
|
||||||
"multiplatform": true,
|
"multiplatform": true,
|
||||||
|
|
|
||||||
|
|
@ -489,16 +489,54 @@ class EnumeratorWidget(InputWidget):
|
||||||
|
|
||||||
class PathWidget(BaseWidget):
|
class PathWidget(BaseWidget):
|
||||||
def create_ui(self):
|
def create_ui(self):
|
||||||
self.content_widget = self
|
self._child_style_state = ""
|
||||||
self.content_layout = QtWidgets.QGridLayout(self)
|
|
||||||
self.content_layout.setContentsMargins(0, 0, 0, 0)
|
if self.entity.use_label_wrap:
|
||||||
self.content_layout.setSpacing(5)
|
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.input_field = self.create_ui_for_entity(
|
||||||
self.category_widget, self.entity.child_obj, self
|
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):
|
def add_widget_to_layout(self, widget, label=None):
|
||||||
row = self.content_layout.rowCount()
|
row = self.content_layout.rowCount()
|
||||||
|
|
@ -523,26 +561,52 @@ class PathWidget(BaseWidget):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def update_style(self):
|
def update_style(self):
|
||||||
if not self.label_widget:
|
if not self.body_widget and not self.label_widget:
|
||||||
return
|
return
|
||||||
|
|
||||||
has_unsaved_changes = self.entity.has_unsaved_changes
|
if self.entity.group_item:
|
||||||
if not has_unsaved_changes and self.entity.group_item:
|
group_item = self.entity.group_item
|
||||||
has_unsaved_changes = self.entity.group_item.has_unsaved_changes
|
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(
|
child_invalid = self.is_invalid
|
||||||
self.is_invalid,
|
|
||||||
has_unsaved_changes,
|
|
||||||
self.entity.has_project_override,
|
|
||||||
self.entity.has_studio_override
|
|
||||||
)
|
|
||||||
if self._style_state == state:
|
|
||||||
return
|
|
||||||
|
|
||||||
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)
|
if child_style_state != self._child_style_state:
|
||||||
self.label_widget.style().polish(self.label_widget)
|
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
|
@property
|
||||||
def is_invalid(self):
|
def is_invalid(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue