mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
all variables for setting not contain setting instead of configuration
This commit is contained in:
parent
d0859f4b60
commit
5b50b8ede4
5 changed files with 43 additions and 43 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
from .settings import (
|
from .settings import (
|
||||||
system_configurations,
|
system_settings,
|
||||||
project_configurations
|
project_settings
|
||||||
)
|
)
|
||||||
from pypeapp import (
|
from pypeapp import (
|
||||||
Logger,
|
Logger,
|
||||||
|
|
@ -53,8 +53,8 @@ from .lib import (
|
||||||
from .lib import _subprocess as subprocess
|
from .lib import _subprocess as subprocess
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"system_configurations",
|
"system_settings",
|
||||||
"project_configurations",
|
"project_settings",
|
||||||
|
|
||||||
"Logger",
|
"Logger",
|
||||||
"Anatomy",
|
"Anatomy",
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
from .lib import (
|
from .lib import (
|
||||||
system_configurations,
|
system_settings,
|
||||||
project_configurations
|
project_settings
|
||||||
)
|
)
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
"system_configurations",
|
"system_settings",
|
||||||
"project_configurations"
|
"project_settings"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,13 @@ POP_KEY = "__pop_key__"
|
||||||
STUDIO_OVERRIDES_PATH = os.environ["PYPE_PROJECT_CONFIGS"]
|
STUDIO_OVERRIDES_PATH = os.environ["PYPE_PROJECT_CONFIGS"]
|
||||||
|
|
||||||
# File where studio's system overrides are stored
|
# File where studio's system overrides are stored
|
||||||
SYSTEM_SETTINGS_KEY = "system_configurations"
|
SYSTEM_SETTINGS_KEY = "system_settings"
|
||||||
SYSTEM_SETTINGS_PATH = os.path.join(
|
SYSTEM_SETTINGS_PATH = os.path.join(
|
||||||
STUDIO_OVERRIDES_PATH, SYSTEM_SETTINGS_KEY + ".json"
|
STUDIO_OVERRIDES_PATH, SYSTEM_SETTINGS_KEY + ".json"
|
||||||
)
|
)
|
||||||
|
|
||||||
# File where studio's default project overrides are stored
|
# File where studio's default project overrides are stored
|
||||||
PROJECT_SETTINGS_KEY = "project_configurations"
|
PROJECT_SETTINGS_KEY = "project_settings"
|
||||||
PROJECT_SETTINGS_FILENAME = PROJECT_SETTINGS_KEY + ".json"
|
PROJECT_SETTINGS_FILENAME = PROJECT_SETTINGS_KEY + ".json"
|
||||||
PROJECT_SETTINGS_PATH = os.path.join(
|
PROJECT_SETTINGS_PATH = os.path.join(
|
||||||
STUDIO_OVERRIDES_PATH, PROJECT_SETTINGS_FILENAME
|
STUDIO_OVERRIDES_PATH, PROJECT_SETTINGS_FILENAME
|
||||||
|
|
@ -32,19 +32,19 @@ PROJECT_ANATOMY_PATH = os.path.join(
|
||||||
STUDIO_OVERRIDES_PATH, PROJECT_ANATOMY_FILENAME
|
STUDIO_OVERRIDES_PATH, PROJECT_ANATOMY_FILENAME
|
||||||
)
|
)
|
||||||
|
|
||||||
# Path to default configurations
|
# Path to default settings
|
||||||
DEFAULTS_DIR = os.path.join(os.path.dirname(__file__), "defaults")
|
DEFAULTS_DIR = os.path.join(os.path.dirname(__file__), "defaults")
|
||||||
|
|
||||||
# Variable where cache of default configurations are stored
|
# Variable where cache of default settings are stored
|
||||||
_DEFAULT_SETTINGS = None
|
_DEFAULT_SETTINGS = None
|
||||||
|
|
||||||
|
|
||||||
def reset_default_configurations():
|
def reset_default_settings():
|
||||||
global _DEFAULT_SETTINGS
|
global _DEFAULT_SETTINGS
|
||||||
_DEFAULT_SETTINGS = None
|
_DEFAULT_SETTINGS = None
|
||||||
|
|
||||||
|
|
||||||
def default_configuration():
|
def default_settings():
|
||||||
global _DEFAULT_SETTINGS
|
global _DEFAULT_SETTINGS
|
||||||
if _DEFAULT_SETTINGS is None:
|
if _DEFAULT_SETTINGS is None:
|
||||||
_DEFAULT_SETTINGS = load_jsons_from_dir(DEFAULTS_DIR)
|
_DEFAULT_SETTINGS = load_jsons_from_dir(DEFAULTS_DIR)
|
||||||
|
|
@ -156,13 +156,13 @@ def load_jsons_from_dir(path, *args, **kwargs):
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
def studio_system_configurations():
|
def studio_system_settings():
|
||||||
if os.path.exists(SYSTEM_SETTINGS_PATH):
|
if os.path.exists(SYSTEM_SETTINGS_PATH):
|
||||||
return load_json(SYSTEM_SETTINGS_PATH)
|
return load_json(SYSTEM_SETTINGS_PATH)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
def studio_project_configurations():
|
def studio_project_settings():
|
||||||
if os.path.exists(PROJECT_SETTINGS_PATH):
|
if os.path.exists(PROJECT_SETTINGS_PATH):
|
||||||
return load_json(PROJECT_SETTINGS_PATH)
|
return load_json(PROJECT_SETTINGS_PATH)
|
||||||
return {}
|
return {}
|
||||||
|
|
@ -190,7 +190,7 @@ def path_to_project_anatomy(project_name):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def project_configurations_overrides(project_name):
|
def project_settings_overrides(project_name):
|
||||||
if not project_name:
|
if not project_name:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
@ -234,25 +234,25 @@ def merge_overrides(global_dict, override_dict):
|
||||||
return global_dict
|
return global_dict
|
||||||
|
|
||||||
|
|
||||||
def apply_overrides(global_presets, project_overrides):
|
def apply_overrides(source_data, override_data):
|
||||||
global_presets = copy.deepcopy(global_presets)
|
if not override_data:
|
||||||
if not project_overrides:
|
return source_data
|
||||||
return global_presets
|
_source_data = copy.deepcopy(source_data)
|
||||||
return merge_overrides(global_presets, project_overrides)
|
return merge_overrides(_source_data, override_data)
|
||||||
|
|
||||||
|
|
||||||
def system_configurations():
|
def system_settings():
|
||||||
default_values = default_configuration()["system_configurations"]
|
default_values = default_settings()[SYSTEM_SETTINGS_KEY]
|
||||||
studio_values = studio_system_configurations()
|
studio_values = studio_system_settings()
|
||||||
return apply_overrides(default_values, studio_values)
|
return apply_overrides(default_values, studio_values)
|
||||||
|
|
||||||
|
|
||||||
def project_configurations(project_name):
|
def project_settings(project_name):
|
||||||
default_values = default_configuration()["project_configurations"]
|
default_values = default_settings()[PROJECT_SETTINGS_KEY]
|
||||||
studio_values = studio_project_configurations()
|
studio_values = studio_project_settings()
|
||||||
|
|
||||||
studio_overrides = apply_overrides(default_values, studio_values)
|
studio_overrides = apply_overrides(default_values, studio_values)
|
||||||
|
|
||||||
project_overrides = project_configurations_overrides(project_name)
|
project_overrides = project_settings_overrides(project_name)
|
||||||
|
|
||||||
return apply_overrides(studio_overrides, project_overrides)
|
return apply_overrides(studio_overrides, project_overrides)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
"type": "dict-invisible",
|
"type": "dict-invisible",
|
||||||
"key": "project_configurations",
|
"key": "project_settings",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"type": "schema",
|
"type": "schema",
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,14 @@ from pype.settings.lib import (
|
||||||
|
|
||||||
DEFAULTS_DIR,
|
DEFAULTS_DIR,
|
||||||
|
|
||||||
reset_default_configurations,
|
reset_default_settings,
|
||||||
default_configuration,
|
default_settings,
|
||||||
|
|
||||||
studio_system_configurations,
|
studio_system_settings,
|
||||||
studio_project_configurations,
|
studio_project_settings,
|
||||||
studio_project_anatomy,
|
studio_project_anatomy,
|
||||||
|
|
||||||
project_configurations_overrides,
|
project_settings_overrides,
|
||||||
project_anatomy_overrides,
|
project_anatomy_overrides,
|
||||||
|
|
||||||
path_to_project_overrides,
|
path_to_project_overrides,
|
||||||
|
|
@ -179,7 +179,7 @@ class SystemWidget(QtWidgets.QWidget):
|
||||||
all_values = all_values["system"]
|
all_values = all_values["system"]
|
||||||
|
|
||||||
prject_defaults_dir = os.path.join(
|
prject_defaults_dir = os.path.join(
|
||||||
DEFAULTS_DIR, SYSTEM_CONFIGURATIONS_KEY
|
DEFAULTS_DIR, SYSTEM_SETTINGS_KEY
|
||||||
)
|
)
|
||||||
keys_to_file = lib.file_keys_from_schema(self.schema)
|
keys_to_file = lib.file_keys_from_schema(self.schema)
|
||||||
for key_sequence in keys_to_file:
|
for key_sequence in keys_to_file:
|
||||||
|
|
@ -200,7 +200,7 @@ class SystemWidget(QtWidgets.QWidget):
|
||||||
with open(output_path, "w") as file_stream:
|
with open(output_path, "w") as file_stream:
|
||||||
json.dump(new_values, file_stream, indent=4)
|
json.dump(new_values, file_stream, indent=4)
|
||||||
|
|
||||||
reset_default_configurations()
|
reset_default_settings()
|
||||||
|
|
||||||
self._update_values()
|
self._update_values()
|
||||||
|
|
||||||
|
|
@ -208,12 +208,12 @@ class SystemWidget(QtWidgets.QWidget):
|
||||||
self.ignore_value_changes = True
|
self.ignore_value_changes = True
|
||||||
|
|
||||||
default_values = {
|
default_values = {
|
||||||
"system": default_configuration()["system_configurations"]
|
"system": default_settings()[SYSTEM_SETTINGS_KEY]
|
||||||
}
|
}
|
||||||
for input_field in self.input_fields:
|
for input_field in self.input_fields:
|
||||||
input_field.update_default_values(default_values)
|
input_field.update_default_values(default_values)
|
||||||
|
|
||||||
system_values = {"system": studio_system_configurations()}
|
system_values = {"system": studio_system_settings()}
|
||||||
for input_field in self.input_fields:
|
for input_field in self.input_fields:
|
||||||
input_field.update_studio_values(system_values)
|
input_field.update_studio_values(system_values)
|
||||||
|
|
||||||
|
|
@ -462,7 +462,7 @@ class ProjectWidget(QtWidgets.QWidget):
|
||||||
_project_anatomy = lib.NOT_SET
|
_project_anatomy = lib.NOT_SET
|
||||||
self.is_overidable = False
|
self.is_overidable = False
|
||||||
else:
|
else:
|
||||||
_project_overrides = project_configurations_overrides(project_name)
|
_project_overrides = project_settings_overrides(project_name)
|
||||||
_project_anatomy = project_anatomy_overrides(project_name)
|
_project_anatomy = project_anatomy_overrides(project_name)
|
||||||
self.is_overidable = True
|
self.is_overidable = True
|
||||||
|
|
||||||
|
|
@ -519,7 +519,7 @@ class ProjectWidget(QtWidgets.QWidget):
|
||||||
with open(output_path, "w") as file_stream:
|
with open(output_path, "w") as file_stream:
|
||||||
json.dump(new_values, file_stream, indent=4)
|
json.dump(new_values, file_stream, indent=4)
|
||||||
|
|
||||||
reset_default_configurations()
|
reset_default_settings()
|
||||||
|
|
||||||
self._update_values()
|
self._update_values()
|
||||||
|
|
||||||
|
|
@ -638,12 +638,12 @@ class ProjectWidget(QtWidgets.QWidget):
|
||||||
def _update_values(self):
|
def _update_values(self):
|
||||||
self.ignore_value_changes = True
|
self.ignore_value_changes = True
|
||||||
|
|
||||||
default_values = {"project": default_configuration()}
|
default_values = {"project": default_settings()}
|
||||||
for input_field in self.input_fields:
|
for input_field in self.input_fields:
|
||||||
input_field.update_default_values(default_values)
|
input_field.update_default_values(default_values)
|
||||||
|
|
||||||
studio_values = {"project": {
|
studio_values = {"project": {
|
||||||
PROJECT_SETTINGS_KEY: studio_project_configurations(),
|
PROJECT_SETTINGS_KEY: studio_project_settings(),
|
||||||
PROJECT_ANATOMY_KEY: studio_project_anatomy()
|
PROJECT_ANATOMY_KEY: studio_project_anatomy()
|
||||||
}}
|
}}
|
||||||
for input_field in self.input_fields:
|
for input_field in self.input_fields:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue