mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge pull request #29 from pypeclub/feature/pype_key_in_settings
Pype usage in settings
This commit is contained in:
commit
1eeaa3ef17
13 changed files with 43 additions and 43 deletions
|
|
@ -24,7 +24,7 @@ from .lib import (
|
||||||
get_latest_version,
|
get_latest_version,
|
||||||
get_global_environments,
|
get_global_environments,
|
||||||
get_local_site_id,
|
get_local_site_id,
|
||||||
change_pype_mongo_url
|
change_openpype_mongo_url
|
||||||
)
|
)
|
||||||
|
|
||||||
from .lib.mongo import (
|
from .lib.mongo import (
|
||||||
|
|
@ -120,5 +120,5 @@ __all__ = [
|
||||||
"get_global_environments",
|
"get_global_environments",
|
||||||
|
|
||||||
"get_local_site_id",
|
"get_local_site_id",
|
||||||
"change_pype_mongo_url"
|
"change_openpype_mongo_url"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ from .local_settings import (
|
||||||
JSONSettingRegistry,
|
JSONSettingRegistry,
|
||||||
PypeSettingsRegistry,
|
PypeSettingsRegistry,
|
||||||
get_local_site_id,
|
get_local_site_id,
|
||||||
change_pype_mongo_url
|
change_openpype_mongo_url
|
||||||
)
|
)
|
||||||
|
|
||||||
from .path_tools import (
|
from .path_tools import (
|
||||||
|
|
@ -219,7 +219,7 @@ __all__ = [
|
||||||
"JSONSettingRegistry",
|
"JSONSettingRegistry",
|
||||||
"PypeSettingsRegistry",
|
"PypeSettingsRegistry",
|
||||||
"get_local_site_id",
|
"get_local_site_id",
|
||||||
"change_pype_mongo_url",
|
"change_openpype_mongo_url",
|
||||||
|
|
||||||
"timeit",
|
"timeit",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -496,10 +496,10 @@ def get_local_site_id():
|
||||||
return _create_local_site_id()
|
return _create_local_site_id()
|
||||||
|
|
||||||
|
|
||||||
def change_pype_mongo_url(new_mongo_url):
|
def change_openpype_mongo_url(new_mongo_url):
|
||||||
"""Change mongo url in pype registry.
|
"""Change mongo url in pype registry.
|
||||||
|
|
||||||
Change of Pype mongo URL require restart of running pype processes or
|
Change of OpenPype mongo URL require restart of running pype processes or
|
||||||
processes using pype.
|
processes using pype.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pype_path": {
|
"openpype_path": {
|
||||||
"windows": [],
|
"windows": [],
|
||||||
"darwin": [],
|
"darwin": [],
|
||||||
"linux": []
|
"linux": []
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
"""Pype Settings
|
"""OpenPype Settings
|
||||||
|
|
||||||
Settings define how pype and it's modules behave. They became main component of
|
Settings define how openpype and it's modules behave. They became main
|
||||||
dynamism.
|
component of dynamism.
|
||||||
|
|
||||||
Pype settings (ATM) have 3 layers:
|
OpenPype settings (ATM) have 3 layers:
|
||||||
1.) Defaults - defined in code
|
1.) Defaults - defined in code
|
||||||
2.) Studio overrides - values that are applied on default that may modify only
|
2.) Studio overrides - values that are applied on default that may modify only
|
||||||
some values or None, result can be called "studio settings"
|
some values or None, result can be called "studio settings"
|
||||||
|
|
@ -24,7 +24,7 @@ visuallise how values are applied.
|
||||||
|
|
||||||
With help of setting entities it is possible to modify settings from code.
|
With help of setting entities it is possible to modify settings from code.
|
||||||
|
|
||||||
Pype has (ATM) 2 types of settings:
|
OpenPype has (ATM) 2 types of settings:
|
||||||
1.) System settings - global system settings, don't have project overrides
|
1.) System settings - global system settings, don't have project overrides
|
||||||
2.) Project settings - project specific settings
|
2.) Project settings - project specific settings
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -611,8 +611,8 @@ class BaseItemEntity(BaseEntity):
|
||||||
def remove_from_studio_default(self, on_change_trigger=None):
|
def remove_from_studio_default(self, on_change_trigger=None):
|
||||||
"""Remove studio overrides from entity and it's children.
|
"""Remove studio overrides from entity and it's children.
|
||||||
|
|
||||||
Reset values to pype's default and mark entity to not store values as
|
Reset values to openpype's default and mark entity to not store values
|
||||||
studio overrides if entity is not under group.
|
as studio overrides if entity is not under group.
|
||||||
|
|
||||||
This is wrapper method that handles on_change callbacks only when all
|
This is wrapper method that handles on_change callbacks only when all
|
||||||
`_remove_from_studio_default` on all children happened. That is
|
`_remove_from_studio_default` on all children happened. That is
|
||||||
|
|
@ -672,8 +672,8 @@ class BaseItemEntity(BaseEntity):
|
||||||
def remove_from_project_override(self, on_change_trigger=None):
|
def remove_from_project_override(self, on_change_trigger=None):
|
||||||
"""Remove project overrides from entity and it's children.
|
"""Remove project overrides from entity and it's children.
|
||||||
|
|
||||||
Reset values to studio overrides or pype's default and mark entity to
|
Reset values to studio overrides or openpype's default and mark entity
|
||||||
not store values as project overrides if entity is not under group.
|
to not store values as project overrides if entity is not under group.
|
||||||
|
|
||||||
This is wrapper method that handles on_change callbacks only when all
|
This is wrapper method that handles on_change callbacks only when all
|
||||||
`_remove_from_project_override` on all children happened. That is
|
`_remove_from_project_override` on all children happened. That is
|
||||||
|
|
@ -837,9 +837,9 @@ class ItemEntity(BaseItemEntity):
|
||||||
def update_default_value(self, parent_values):
|
def update_default_value(self, parent_values):
|
||||||
"""Fill default values on startup or on refresh.
|
"""Fill default values on startup or on refresh.
|
||||||
|
|
||||||
Default values stored in `pype` repository should update all items in
|
Default values stored in `openpype` repository should update all items
|
||||||
schema. Each item should take values for his key and set it's value or
|
in schema. Each item should take values for his key and set it's value
|
||||||
pass values down to children items.
|
or pass values down to children items.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
parent_values (dict): Values of parent's item. But in case item is
|
parent_values (dict): Values of parent's item. But in case item is
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@
|
||||||
- each input may have "input modifiers" (keys in dictionary) that are required or optional
|
- each input may have "input modifiers" (keys in dictionary) that are required or optional
|
||||||
- only required modifier for all input items is key `"type"` which says what type of item it is
|
- only required modifier for all input items is key `"type"` which says what type of item it is
|
||||||
- there are special keys across all inputs
|
- there are special keys across all inputs
|
||||||
- `"is_file"` - this key is for storing pype defaults in `pype` repo
|
- `"is_file"` - this key is for storing openpype defaults in `openpype` repo
|
||||||
- reasons of existence: developing new schemas does not require to create defaults manually
|
- reasons of existence: developing new schemas does not require to create defaults manually
|
||||||
- key is validated, must be once in hierarchy else it won't be possible to store pype defaults
|
- key is validated, must be once in hierarchy else it won't be possible to store openpype defaults
|
||||||
- `"is_group"` - define that all values under key in hierarchy will be overriden if any value is modified, this information is also stored to overrides
|
- `"is_group"` - define that all values under key in hierarchy will be overriden if any value is modified, this information is also stored to overrides
|
||||||
- this keys is not allowed for all inputs as they may have not reason for that
|
- this keys is not allowed for all inputs as they may have not reason for that
|
||||||
- key is validated, can be only once in hierarchy but is not required
|
- key is validated, can be only once in hierarchy but is not required
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"key": "pype_path",
|
"key": "openpype_path",
|
||||||
"label": "Pype Path",
|
"label": "Versions Repository",
|
||||||
"multiplatform": true,
|
"multiplatform": true,
|
||||||
"multipath": true
|
"multipath": true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -227,9 +227,9 @@ class MongoSettingsHandler(SettingsHandler):
|
||||||
|
|
||||||
def _prepare_global_settings(self, data):
|
def _prepare_global_settings(self, data):
|
||||||
output = {}
|
output = {}
|
||||||
# Add "pype_path" key to global settings if is set
|
# Add "openpype_path" key to global settings if is set
|
||||||
if "general" in data and "pype_path" in data["general"]:
|
if "general" in data and "openpype_path" in data["general"]:
|
||||||
output["pype_path"] = data["general"]["pype_path"]
|
output["openpype_path"] = data["general"]["openpype_path"]
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def save_studio_settings(self, data):
|
def save_studio_settings(self, data):
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,16 @@ import traceback
|
||||||
from Qt import QtWidgets
|
from Qt import QtWidgets
|
||||||
from pymongo.errors import ServerSelectionTimeoutError
|
from pymongo.errors import ServerSelectionTimeoutError
|
||||||
|
|
||||||
from pype.api import change_pype_mongo_url
|
from pype.api import change_openpype_mongo_url
|
||||||
|
|
||||||
|
|
||||||
class PypeMongoWidget(QtWidgets.QWidget):
|
class OpenPypeMongoWidget(QtWidgets.QWidget):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super(PypeMongoWidget, self).__init__(parent)
|
super(OpenPypeMongoWidget, self).__init__(parent)
|
||||||
|
|
||||||
# Warning label
|
# Warning label
|
||||||
warning_label = QtWidgets.QLabel((
|
warning_label = QtWidgets.QLabel((
|
||||||
"WARNING: Requires restart. Change of Pype Mongo requires to"
|
"WARNING: Requires restart. Change of OpenPype Mongo requires to"
|
||||||
" restart of all running Pype processes and process using Pype"
|
" restart of all running Pype processes and process using Pype"
|
||||||
" (Including this)."
|
" (Including this)."
|
||||||
"\n- all changes in different categories won't be saved."
|
"\n- all changes in different categories won't be saved."
|
||||||
|
|
@ -22,11 +22,11 @@ class PypeMongoWidget(QtWidgets.QWidget):
|
||||||
warning_label.setStyleSheet("font-weight: bold;")
|
warning_label.setStyleSheet("font-weight: bold;")
|
||||||
|
|
||||||
# Label
|
# Label
|
||||||
mongo_url_label = QtWidgets.QLabel("Pype Mongo URL", self)
|
mongo_url_label = QtWidgets.QLabel("OpenPype Mongo URL", self)
|
||||||
|
|
||||||
# Input
|
# Input
|
||||||
mongo_url_input = QtWidgets.QLineEdit(self)
|
mongo_url_input = QtWidgets.QLineEdit(self)
|
||||||
mongo_url_input.setPlaceholderText("< Pype Mongo URL >")
|
mongo_url_input.setPlaceholderText("< OpenPype Mongo URL >")
|
||||||
mongo_url_input.setText(os.environ["OPENPYPE_MONGO"])
|
mongo_url_input.setText(os.environ["OPENPYPE_MONGO"])
|
||||||
|
|
||||||
# Confirm button
|
# Confirm button
|
||||||
|
|
@ -48,14 +48,14 @@ class PypeMongoWidget(QtWidgets.QWidget):
|
||||||
|
|
||||||
dialog = QtWidgets.QMessageBox(self)
|
dialog = QtWidgets.QMessageBox(self)
|
||||||
|
|
||||||
title = "Pype mongo changed"
|
title = "OpenPype mongo changed"
|
||||||
message = (
|
message = (
|
||||||
"Pype mongo url was successfully changed. Restart Pype please."
|
"OpenPype mongo url was successfully changed. Restart Pype please."
|
||||||
)
|
)
|
||||||
details = None
|
details = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
change_pype_mongo_url(value)
|
change_openpype_mongo_url(value)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
if isinstance(exc, ServerSelectionTimeoutError):
|
if isinstance(exc, ServerSelectionTimeoutError):
|
||||||
error_message = (
|
error_message = (
|
||||||
|
|
@ -65,10 +65,10 @@ class PypeMongoWidget(QtWidgets.QWidget):
|
||||||
else:
|
else:
|
||||||
error_message = str(exc)
|
error_message = str(exc)
|
||||||
|
|
||||||
title = "Pype mongo change failed"
|
title = "OpenPype mongo change failed"
|
||||||
# TODO catch exception message more gracefully
|
# TODO catch exception message more gracefully
|
||||||
message = (
|
message = (
|
||||||
"Pype mongo change was not successful."
|
"OpenPype mongo change was not successful."
|
||||||
" Full traceback can be found in details section.\n\n"
|
" Full traceback can be found in details section.\n\n"
|
||||||
"Error message:\n{}"
|
"Error message:\n{}"
|
||||||
).format(error_message)
|
).format(error_message)
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ from .widgets import (
|
||||||
SpacerWidget,
|
SpacerWidget,
|
||||||
ExpandingWidget
|
ExpandingWidget
|
||||||
)
|
)
|
||||||
from .mongo_widget import PypeMongoWidget
|
from .mongo_widget import OpenPypeMongoWidget
|
||||||
from .general_widget import LocalGeneralWidgets
|
from .general_widget import LocalGeneralWidgets
|
||||||
from .apps_widget import LocalApplicationsWidgets
|
from .apps_widget import LocalApplicationsWidgets
|
||||||
from .projects_widget import ProjectSettingsWidget
|
from .projects_widget import ProjectSettingsWidget
|
||||||
|
|
@ -62,7 +62,7 @@ class LocalSettingsWidget(QtWidgets.QWidget):
|
||||||
pype_mongo_layout.setContentsMargins(CHILD_OFFSET, 5, 0, 0)
|
pype_mongo_layout.setContentsMargins(CHILD_OFFSET, 5, 0, 0)
|
||||||
pype_mongo_expand_widget.set_content_widget(pype_mongo_content)
|
pype_mongo_expand_widget.set_content_widget(pype_mongo_content)
|
||||||
|
|
||||||
pype_mongo_widget = PypeMongoWidget(self)
|
pype_mongo_widget = OpenPypeMongoWidget(self)
|
||||||
pype_mongo_layout.addWidget(pype_mongo_widget)
|
pype_mongo_layout.addWidget(pype_mongo_widget)
|
||||||
|
|
||||||
self.main_layout.addWidget(pype_mongo_expand_widget)
|
self.main_layout.addWidget(pype_mongo_expand_widget)
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@
|
||||||
- each input may have "input modifiers" (keys in dictionary) that are required or optional
|
- each input may have "input modifiers" (keys in dictionary) that are required or optional
|
||||||
- only required modifier for all input items is key `"type"` which says what type of item it is
|
- only required modifier for all input items is key `"type"` which says what type of item it is
|
||||||
- there are special keys across all inputs
|
- there are special keys across all inputs
|
||||||
- `"is_file"` - this key is for storing pype defaults in `pype` repo
|
- `"is_file"` - this key is for storing openpype defaults in `openpype` repo
|
||||||
- reasons of existence: developing new schemas does not require to create defaults manually
|
- reasons of existence: developing new schemas does not require to create defaults manually
|
||||||
- key is validated, must be once in hierarchy else it won't be possible to store pype defaults
|
- key is validated, must be once in hierarchy else it won't be possible to store openpype defaults
|
||||||
- `"is_group"` - define that all values under key in hierarchy will be overriden if any value is modified, this information is also stored to overrides
|
- `"is_group"` - define that all values under key in hierarchy will be overriden if any value is modified, this information is also stored to overrides
|
||||||
- this keys is not allowed for all inputs as they may have not reason for that
|
- this keys is not allowed for all inputs as they may have not reason for that
|
||||||
- key is validated, can be only once in hierarchy but is not required
|
- key is validated, can be only once in hierarchy but is not required
|
||||||
|
|
@ -191,7 +191,7 @@
|
||||||
{
|
{
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"key": "my_boolean_key",
|
"key": "my_boolean_key",
|
||||||
"label": "Do you want to use Pype?"
|
"label": "Do you want to use OpenPype?"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class MainWidget(QtWidgets.QWidget):
|
||||||
def __init__(self, user_role, parent=None):
|
def __init__(self, user_role, parent=None):
|
||||||
super(MainWidget, self).__init__(parent)
|
super(MainWidget, self).__init__(parent)
|
||||||
self.setObjectName("MainWidget")
|
self.setObjectName("MainWidget")
|
||||||
self.setWindowTitle("Pype Settings")
|
self.setWindowTitle("OpenPype Settings")
|
||||||
|
|
||||||
self.resize(self.widget_width, self.widget_height)
|
self.resize(self.widget_width, self.widget_height)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue