mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
simplify general settings conversion
This commit is contained in:
parent
d8c8f7f0ec
commit
7e2331467d
4 changed files with 14 additions and 47 deletions
|
|
@ -17,12 +17,11 @@ def get_general_template_data(system_settings=None):
|
|||
|
||||
if not system_settings:
|
||||
system_settings = get_system_settings()
|
||||
studio_name = system_settings["general"]["studio_name"]
|
||||
studio_code = system_settings["general"]["studio_code"]
|
||||
core_settings = system_settings["core"]
|
||||
return {
|
||||
"studio": {
|
||||
"name": studio_name,
|
||||
"code": studio_code
|
||||
"name": core_settings["studio_name"],
|
||||
"code": core_settings["studio_code"]
|
||||
},
|
||||
"user": get_ayon_username()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ from .constants import (
|
|||
)
|
||||
from .lib import (
|
||||
get_general_environments,
|
||||
get_global_settings,
|
||||
get_system_settings,
|
||||
get_project_settings,
|
||||
get_current_project_settings,
|
||||
|
|
@ -17,7 +16,6 @@ __all__ = (
|
|||
"PROJECT_SETTINGS_KEY",
|
||||
|
||||
"get_general_environments",
|
||||
"get_global_settings",
|
||||
"get_system_settings",
|
||||
"get_project_settings",
|
||||
"get_current_project_settings",
|
||||
|
|
|
|||
|
|
@ -73,31 +73,13 @@ def _convert_host_imageio(host_settings):
|
|||
|
||||
|
||||
def _convert_general(ayon_settings, output, default_settings):
|
||||
# TODO get studio name/code
|
||||
core_settings = ayon_settings["core"]
|
||||
environments = core_settings["environments"]
|
||||
if isinstance(environments, six.string_types):
|
||||
environments = json.loads(environments)
|
||||
|
||||
general = default_settings["general"]
|
||||
general.update({
|
||||
"log_to_server": False,
|
||||
"studio_name": core_settings["studio_name"],
|
||||
"studio_code": core_settings["studio_code"],
|
||||
"environment": environments
|
||||
})
|
||||
output["general"] = general
|
||||
|
||||
|
||||
def _convert_kitsu_system_settings(
|
||||
ayon_settings, output, addon_versions, default_settings
|
||||
):
|
||||
enabled = addon_versions.get("kitsu") is not None
|
||||
kitsu_settings = default_settings["modules"]["kitsu"]
|
||||
kitsu_settings["enabled"] = enabled
|
||||
if enabled:
|
||||
kitsu_settings["server"] = ayon_settings["kitsu"]["server"]
|
||||
output["modules"]["kitsu"] = kitsu_settings
|
||||
output["core"] = ayon_settings["core"]
|
||||
version_check_interval = (
|
||||
default_settings["general"]["version_check_interval"]
|
||||
)
|
||||
output["general"] = {
|
||||
"version_check_interval": version_check_interval
|
||||
}
|
||||
|
||||
|
||||
def _convert_timers_manager_system_settings(
|
||||
|
|
@ -701,14 +683,6 @@ def _convert_global_project_settings(ayon_settings, output, default_settings):
|
|||
ayon_core = ayon_settings["core"]
|
||||
|
||||
_convert_host_imageio(ayon_core)
|
||||
|
||||
for key in (
|
||||
"environments",
|
||||
"studio_name",
|
||||
"studio_code",
|
||||
):
|
||||
ayon_core.pop(key, None)
|
||||
|
||||
# Publish conversion
|
||||
ayon_publish = ayon_core["publish"]
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ from .constants import (
|
|||
|
||||
from .ayon_settings import (
|
||||
get_ayon_project_settings,
|
||||
get_ayon_system_settings
|
||||
get_ayon_system_settings,
|
||||
get_ayon_settings,
|
||||
)
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -253,14 +254,9 @@ def get_current_project_settings():
|
|||
return get_project_settings(project_name)
|
||||
|
||||
|
||||
def get_global_settings():
|
||||
default_settings = load_openpype_default_settings()
|
||||
return default_settings["system_settings"]["general"]
|
||||
|
||||
|
||||
def get_general_environments():
|
||||
value = get_system_settings()
|
||||
return value["general"]["environment"]
|
||||
settings = get_ayon_settings()
|
||||
return json.loads(settings["core"]["environments"])
|
||||
|
||||
|
||||
def get_system_settings(*args, **kwargs):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue