mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge pull request #1237 from pypeclub/feature/global_settings
Pype global settings
This commit is contained in:
commit
a6dc83aa13
5 changed files with 96 additions and 74 deletions
|
|
@ -15,6 +15,7 @@ METADATA_KEYS = (
|
|||
)
|
||||
|
||||
# File where studio's system overrides are stored
|
||||
GLOBAL_SETTINGS_KEY = "global_settings"
|
||||
SYSTEM_SETTINGS_KEY = "system_settings"
|
||||
PROJECT_SETTINGS_KEY = "project_settings"
|
||||
PROJECT_ANATOMY_KEY = "project_anatomy"
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
{
|
||||
"studio_name": "Studio name",
|
||||
"studio_code": "stu",
|
||||
"studio_soft": {
|
||||
"windows": "convert from \"STUDIO_SOFT\"",
|
||||
"darwin": "",
|
||||
"linux": ""
|
||||
},
|
||||
"environment": {
|
||||
"FFMPEG_PATH": {
|
||||
"windows": "{PYPE_ROOT}/vendor/bin/ffmpeg_exec/windows/bin",
|
||||
|
|
@ -19,5 +14,10 @@
|
|||
"PYPE_OCIO_CONFIG"
|
||||
]
|
||||
}
|
||||
},
|
||||
"pype_path": {
|
||||
"windows": [],
|
||||
"darwin": [],
|
||||
"linux": []
|
||||
}
|
||||
}
|
||||
|
|
@ -19,20 +19,20 @@
|
|||
"type": "splitter"
|
||||
},
|
||||
{
|
||||
"key": "studio_soft",
|
||||
"type": "path",
|
||||
"label": "Studio Software Location",
|
||||
"multiplatform": true,
|
||||
"multipath": false
|
||||
"key": "environment",
|
||||
"label": "Environment",
|
||||
"type": "raw-json",
|
||||
"env_group_key": "global"
|
||||
},
|
||||
{
|
||||
"type": "splitter"
|
||||
},
|
||||
{
|
||||
"key": "environment",
|
||||
"label": "Environment",
|
||||
"type": "raw-json",
|
||||
"env_group_key": "global"
|
||||
"type": "path",
|
||||
"key": "pype_path",
|
||||
"label": "Pype Path",
|
||||
"multiplatform": true,
|
||||
"multipath": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from abc import ABCMeta, abstractmethod
|
|||
import six
|
||||
import pype
|
||||
from .constants import (
|
||||
GLOBAL_SETTINGS_KEY,
|
||||
SYSTEM_SETTINGS_KEY,
|
||||
PROJECT_SETTINGS_KEY,
|
||||
PROJECT_ANATOMY_KEY,
|
||||
|
|
@ -224,6 +225,13 @@ class MongoSettingsHandler(SettingsHandler):
|
|||
self._prepare_project_settings_keys()
|
||||
return self._attribute_keys
|
||||
|
||||
def _prepare_global_settings(self, data):
|
||||
output = {}
|
||||
# Add "pype_path" key to global settings if is set
|
||||
if "general" in data and "pype_path" in data["general"]:
|
||||
output["pype_path"] = data["general"]["pype_path"]
|
||||
return output
|
||||
|
||||
def save_studio_settings(self, data):
|
||||
"""Save studio overrides of system settings.
|
||||
|
||||
|
|
@ -235,8 +243,8 @@ class MongoSettingsHandler(SettingsHandler):
|
|||
Args:
|
||||
data(dict): Data of studio overrides with override metadata.
|
||||
"""
|
||||
# Store system settings
|
||||
self.system_settings_cache.update_data(data)
|
||||
|
||||
self.collection.replace_one(
|
||||
{
|
||||
"type": SYSTEM_SETTINGS_KEY
|
||||
|
|
@ -248,6 +256,22 @@ class MongoSettingsHandler(SettingsHandler):
|
|||
upsert=True
|
||||
)
|
||||
|
||||
# Get global settings from system settings
|
||||
global_settings = self._prepare_global_settings(
|
||||
self.system_settings_cache.data
|
||||
)
|
||||
# Store global settings
|
||||
self.collection.replace_one(
|
||||
{
|
||||
"type": GLOBAL_SETTINGS_KEY
|
||||
},
|
||||
{
|
||||
"type": GLOBAL_SETTINGS_KEY,
|
||||
"data": global_settings
|
||||
},
|
||||
upsert=True
|
||||
)
|
||||
|
||||
def save_project_settings(self, project_name, overrides):
|
||||
"""Save studio overrides of project settings.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue