mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
settings function names are with verbs now
This commit is contained in:
parent
80a614261f
commit
a97cc086ed
6 changed files with 49 additions and 49 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from .settings import (
|
||||
system_settings,
|
||||
project_settings,
|
||||
get_system_settings,
|
||||
get_project_settings,
|
||||
environments
|
||||
)
|
||||
from pypeapp import (
|
||||
|
|
@ -50,8 +50,8 @@ from .lib import (
|
|||
from .lib import _subprocess as subprocess
|
||||
|
||||
__all__ = [
|
||||
"system_settings",
|
||||
"project_settings",
|
||||
"get_system_settings",
|
||||
"get_project_settings",
|
||||
"environments",
|
||||
|
||||
"Logger",
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ from ..api import (
|
|||
Anatomy,
|
||||
Logger,
|
||||
config,
|
||||
system_settings,
|
||||
environments
|
||||
get_system_settings,
|
||||
get_environments
|
||||
)
|
||||
from .python_module_tools import (
|
||||
modules_from_path,
|
||||
|
|
@ -526,7 +526,7 @@ class ApplicationManager:
|
|||
|
||||
def refresh(self):
|
||||
"""Refresh applications from settings."""
|
||||
settings = system_settings()
|
||||
settings = get_system_settings()
|
||||
|
||||
hosts_definitions = settings["applications"]
|
||||
for app_group, variant_definitions in hosts_definitions.items():
|
||||
|
|
@ -905,7 +905,7 @@ class ApplicationLaunchContext:
|
|||
# Load settings if were not passed in data
|
||||
settings_env = self.data.get("settings_env")
|
||||
if settings_env is None:
|
||||
settings_env = environments()
|
||||
settings_env = get_environments()
|
||||
self.data["settings_env"] = settings_env
|
||||
|
||||
# subprocess.Popen launch arguments (first argument in constructor)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import inspect
|
|||
|
||||
import pype.modules
|
||||
from pype.modules import PypeModule
|
||||
from pype.settings import system_settings
|
||||
from pype.settings import get_system_settings
|
||||
from pype.api import Logger
|
||||
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ class PypeModuleManager:
|
|||
return environments
|
||||
|
||||
def find_pype_modules(self):
|
||||
settings = system_settings()
|
||||
settings = get_system_settings()
|
||||
modules = []
|
||||
dirpath = os.path.dirname(pype.modules.__file__)
|
||||
for module_name in os.listdir(dirpath):
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
from .lib import (
|
||||
system_settings,
|
||||
project_settings,
|
||||
environments
|
||||
get_system_settings,
|
||||
get_project_settings,
|
||||
get_environments
|
||||
)
|
||||
|
||||
__all__ = (
|
||||
"system_settings",
|
||||
"project_settings",
|
||||
"environments"
|
||||
"get_system_settings",
|
||||
"get_project_settings",
|
||||
"get_environments"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ def reset_default_settings():
|
|||
_DEFAULT_SETTINGS = None
|
||||
|
||||
|
||||
def default_settings():
|
||||
def get_default_settings():
|
||||
global _DEFAULT_SETTINGS
|
||||
if _DEFAULT_SETTINGS is None:
|
||||
_DEFAULT_SETTINGS = load_jsons_from_dir(DEFAULTS_DIR)
|
||||
|
|
@ -236,21 +236,21 @@ def subkey_merge(_dict, value, keys):
|
|||
return _dict
|
||||
|
||||
|
||||
def studio_system_settings():
|
||||
def get_studio_system_settings():
|
||||
"""Studio overrides of system settings."""
|
||||
if os.path.exists(SYSTEM_SETTINGS_PATH):
|
||||
return load_json_file(SYSTEM_SETTINGS_PATH)
|
||||
return {}
|
||||
|
||||
|
||||
def studio_project_settings():
|
||||
def get_studio_project_settings():
|
||||
"""Studio overrides of default project settings."""
|
||||
if os.path.exists(PROJECT_SETTINGS_PATH):
|
||||
return load_json_file(PROJECT_SETTINGS_PATH)
|
||||
return {}
|
||||
|
||||
|
||||
def studio_project_anatomy():
|
||||
def get_studio_project_anatomy():
|
||||
"""Studio overrides of default project anatomy data."""
|
||||
if os.path.exists(PROJECT_ANATOMY_PATH):
|
||||
return load_json_file(PROJECT_ANATOMY_PATH)
|
||||
|
|
@ -305,8 +305,8 @@ def save_project_settings(project_name, overrides):
|
|||
|
||||
Do not use to store whole project settings data with defaults but only it's
|
||||
overrides with metadata defining how overrides should be applied in load
|
||||
function. For loading should be used functions `studio_project_settings`
|
||||
for global project settings and `project_settings_overrides` for
|
||||
function. For loading should be used function `get_studio_project_settings`
|
||||
for global project settings and `get_project_settings_overrides` for
|
||||
project specific settings.
|
||||
|
||||
Args:
|
||||
|
|
@ -346,7 +346,7 @@ def save_project_anatomy(project_name, anatomy_data):
|
|||
json.dump(anatomy_data, file_stream, indent=4)
|
||||
|
||||
|
||||
def project_settings_overrides(project_name):
|
||||
def get_project_settings_overrides(project_name):
|
||||
"""Studio overrides of project settings for specific project.
|
||||
|
||||
Args:
|
||||
|
|
@ -412,26 +412,26 @@ def apply_overrides(source_data, override_data):
|
|||
return merge_overrides(_source_data, override_data)
|
||||
|
||||
|
||||
def system_settings():
|
||||
def get_system_settings():
|
||||
"""System settings with applied studio overrides."""
|
||||
default_values = default_settings()[SYSTEM_SETTINGS_KEY]
|
||||
studio_values = studio_system_settings()
|
||||
default_values = get_default_settings()[SYSTEM_SETTINGS_KEY]
|
||||
studio_values = get_studio_system_settings()
|
||||
return apply_overrides(default_values, studio_values)
|
||||
|
||||
|
||||
def project_settings(project_name):
|
||||
def get_project_settings(project_name):
|
||||
"""Project settings with applied studio and project overrides."""
|
||||
default_values = default_settings()[PROJECT_SETTINGS_KEY]
|
||||
studio_values = studio_project_settings()
|
||||
default_values = get_default_settings()[PROJECT_SETTINGS_KEY]
|
||||
studio_values = get_studio_project_settings()
|
||||
|
||||
studio_overrides = apply_overrides(default_values, studio_values)
|
||||
|
||||
project_overrides = project_settings_overrides(project_name)
|
||||
project_overrides = get_project_settings_overrides(project_name)
|
||||
|
||||
return apply_overrides(studio_overrides, project_overrides)
|
||||
|
||||
|
||||
def environments():
|
||||
def get_environments():
|
||||
"""Calculated environment based on defaults and system settings.
|
||||
|
||||
Any default environment also found in the system settings will be fully
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ from pype.settings.lib import (
|
|||
DEFAULTS_DIR,
|
||||
|
||||
reset_default_settings,
|
||||
default_settings,
|
||||
get_default_settings,
|
||||
|
||||
studio_system_settings,
|
||||
studio_project_settings,
|
||||
studio_project_anatomy,
|
||||
get_studio_system_settings,
|
||||
get_studio_project_settings,
|
||||
get_studio_project_anatomy,
|
||||
|
||||
project_settings_overrides,
|
||||
project_anatomy_overrides,
|
||||
get_project_settings_overrides,
|
||||
get_project_anatomy_overrides,
|
||||
|
||||
save_studio_settings,
|
||||
save_project_settings,
|
||||
|
|
@ -322,7 +322,7 @@ class SystemWidget(SettingsCategoryWidget):
|
|||
def duplicated_env_group_validation(self, values=None, overrides=None):
|
||||
try:
|
||||
if overrides is not None:
|
||||
default_values = default_settings()[SYSTEM_SETTINGS_KEY]
|
||||
default_values = get_default_settings()[SYSTEM_SETTINGS_KEY]
|
||||
values = apply_overrides(default_values, overrides)
|
||||
else:
|
||||
values = copy.deepcopy(values)
|
||||
|
|
@ -375,7 +375,7 @@ class SystemWidget(SettingsCategoryWidget):
|
|||
|
||||
def update_values(self):
|
||||
default_values = lib.convert_data_to_gui_data({
|
||||
self.main_schema_key: default_settings()[SYSTEM_SETTINGS_KEY]
|
||||
self.main_schema_key: get_default_settings()[SYSTEM_SETTINGS_KEY]
|
||||
})
|
||||
for input_field in self.input_fields:
|
||||
input_field.update_default_values(default_values)
|
||||
|
|
@ -384,7 +384,7 @@ class SystemWidget(SettingsCategoryWidget):
|
|||
system_values = lib.NOT_SET
|
||||
else:
|
||||
system_values = lib.convert_overrides_to_gui_data(
|
||||
{self.main_schema_key: studio_system_settings()}
|
||||
{self.main_schema_key: get_studio_system_settings()}
|
||||
)
|
||||
|
||||
for input_field in self.input_fields:
|
||||
|
|
@ -549,8 +549,8 @@ class ProjectWidget(SettingsCategoryWidget):
|
|||
_project_anatomy = lib.NOT_SET
|
||||
self.is_overidable = False
|
||||
else:
|
||||
_project_overrides = project_settings_overrides(project_name)
|
||||
_project_anatomy = project_anatomy_overrides(project_name)
|
||||
_project_overrides = get_project_settings_overrides(project_name)
|
||||
_project_anatomy = get_project_anatomy_overrides(project_name)
|
||||
self.is_overidable = True
|
||||
|
||||
overrides = {self.main_schema_key: {
|
||||
|
|
@ -590,16 +590,16 @@ class ProjectWidget(SettingsCategoryWidget):
|
|||
project_anatomy_data = output_data.get(PROJECT_ANATOMY_KEY, {})
|
||||
save_project_anatomy(self.project_name, project_anatomy_data)
|
||||
|
||||
if self.project_name:
|
||||
# Refill values with overrides
|
||||
self._on_project_change()
|
||||
else:
|
||||
if studio_overrides:
|
||||
# Update saved values
|
||||
self._update_values()
|
||||
else:
|
||||
# Refill values with overrides
|
||||
self._on_project_change()
|
||||
|
||||
def update_values(self):
|
||||
default_values = lib.convert_data_to_gui_data(
|
||||
{self.main_schema_key: default_settings()}
|
||||
{self.main_schema_key: get_default_settings()}
|
||||
)
|
||||
for input_field in self.input_fields:
|
||||
input_field.update_default_values(default_values)
|
||||
|
|
@ -609,8 +609,8 @@ class ProjectWidget(SettingsCategoryWidget):
|
|||
else:
|
||||
studio_values = lib.convert_overrides_to_gui_data({
|
||||
self.main_schema_key: {
|
||||
PROJECT_SETTINGS_KEY: studio_project_settings(),
|
||||
PROJECT_ANATOMY_KEY: studio_project_anatomy()
|
||||
PROJECT_SETTINGS_KEY: get_studio_project_settings(),
|
||||
PROJECT_ANATOMY_KEY: get_studio_project_anatomy()
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue