mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
replace project_settings with get_project_settings
This commit is contained in:
parent
c5d6a44dc5
commit
92d751d94d
21 changed files with 158 additions and 44 deletions
114
.ropeproject/config.py
Normal file
114
.ropeproject/config.py
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
# The default ``config.py``
|
||||
# flake8: noqa
|
||||
|
||||
|
||||
def set_prefs(prefs):
|
||||
"""This function is called before opening the project"""
|
||||
|
||||
# Specify which files and folders to ignore in the project.
|
||||
# Changes to ignored resources are not added to the history and
|
||||
# VCSs. Also they are not returned in `Project.get_files()`.
|
||||
# Note that ``?`` and ``*`` match all characters but slashes.
|
||||
# '*.pyc': matches 'test.pyc' and 'pkg/test.pyc'
|
||||
# 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc'
|
||||
# '.svn': matches 'pkg/.svn' and all of its children
|
||||
# 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o'
|
||||
# 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o'
|
||||
prefs['ignored_resources'] = ['*.pyc', '*~', '.ropeproject',
|
||||
'.hg', '.svn', '_svn', '.git', '.tox']
|
||||
|
||||
# Specifies which files should be considered python files. It is
|
||||
# useful when you have scripts inside your project. Only files
|
||||
# ending with ``.py`` are considered to be python files by
|
||||
# default.
|
||||
# prefs['python_files'] = ['*.py']
|
||||
|
||||
# Custom source folders: By default rope searches the project
|
||||
# for finding source folders (folders that should be searched
|
||||
# for finding modules). You can add paths to that list. Note
|
||||
# that rope guesses project source folders correctly most of the
|
||||
# time; use this if you have any problems.
|
||||
# The folders should be relative to project root and use '/' for
|
||||
# separating folders regardless of the platform rope is running on.
|
||||
# 'src/my_source_folder' for instance.
|
||||
# prefs.add('source_folders', 'src')
|
||||
|
||||
# You can extend python path for looking up modules
|
||||
# prefs.add('python_path', '~/python/')
|
||||
|
||||
# Should rope save object information or not.
|
||||
prefs['save_objectdb'] = True
|
||||
prefs['compress_objectdb'] = False
|
||||
|
||||
# If `True`, rope analyzes each module when it is being saved.
|
||||
prefs['automatic_soa'] = True
|
||||
# The depth of calls to follow in static object analysis
|
||||
prefs['soa_followed_calls'] = 0
|
||||
|
||||
# If `False` when running modules or unit tests "dynamic object
|
||||
# analysis" is turned off. This makes them much faster.
|
||||
prefs['perform_doa'] = True
|
||||
|
||||
# Rope can check the validity of its object DB when running.
|
||||
prefs['validate_objectdb'] = True
|
||||
|
||||
# How many undos to hold?
|
||||
prefs['max_history_items'] = 32
|
||||
|
||||
# Shows whether to save history across sessions.
|
||||
prefs['save_history'] = True
|
||||
prefs['compress_history'] = False
|
||||
|
||||
# Set the number spaces used for indenting. According to
|
||||
# :PEP:`8`, it is best to use 4 spaces. Since most of rope's
|
||||
# unit-tests use 4 spaces it is more reliable, too.
|
||||
prefs['indent_size'] = 4
|
||||
|
||||
# Builtin and c-extension modules that are allowed to be imported
|
||||
# and inspected by rope.
|
||||
prefs['extension_modules'] = []
|
||||
|
||||
# Add all standard c-extensions to extension_modules list.
|
||||
prefs['import_dynload_stdmods'] = True
|
||||
|
||||
# If `True` modules with syntax errors are considered to be empty.
|
||||
# The default value is `False`; When `False` syntax errors raise
|
||||
# `rope.base.exceptions.ModuleSyntaxError` exception.
|
||||
prefs['ignore_syntax_errors'] = False
|
||||
|
||||
# If `True`, rope ignores unresolvable imports. Otherwise, they
|
||||
# appear in the importing namespace.
|
||||
prefs['ignore_bad_imports'] = False
|
||||
|
||||
# If `True`, rope will insert new module imports as
|
||||
# `from <package> import <module>` by default.
|
||||
prefs['prefer_module_from_imports'] = False
|
||||
|
||||
# If `True`, rope will transform a comma list of imports into
|
||||
# multiple separate import statements when organizing
|
||||
# imports.
|
||||
prefs['split_imports'] = False
|
||||
|
||||
# If `True`, rope will remove all top-level import statements and
|
||||
# reinsert them at the top of the module when making changes.
|
||||
prefs['pull_imports_to_top'] = True
|
||||
|
||||
# If `True`, rope will sort imports alphabetically by module name instead
|
||||
# of alphabetically by import statement, with from imports after normal
|
||||
# imports.
|
||||
prefs['sort_imports_alphabetically'] = False
|
||||
|
||||
# Location of implementation of
|
||||
# rope.base.oi.type_hinting.interfaces.ITypeHintingFactory In general
|
||||
# case, you don't have to change this value, unless you're an rope expert.
|
||||
# Change this value to inject you own implementations of interfaces
|
||||
# listed in module rope.base.oi.type_hinting.providers.interfaces
|
||||
# For example, you can add you own providers for Django Models, or disable
|
||||
# the search type-hinting in a class hierarchy, etc.
|
||||
prefs['type_hinting_factory'] = (
|
||||
'rope.base.oi.type_hinting.factory.default_type_hinting_factory')
|
||||
|
||||
|
||||
def project_opened(project):
|
||||
"""This function is called after opening the project"""
|
||||
# Do whatever you like here!
|
||||
|
|
@ -2,7 +2,7 @@ import os
|
|||
|
||||
from pyblish import api as pyblish
|
||||
from avalon import api as avalon
|
||||
from .api import project_settings, Anatomy
|
||||
from .api import get_project_settings, Anatomy
|
||||
from .lib import filter_pyblish_plugins
|
||||
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ def patched_discover(superclass):
|
|||
|
||||
print(">>> trying to find presets for {}:{} ...".format(host, plugin_type))
|
||||
try:
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])[host][plugin_type]
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])[host][plugin_type]
|
||||
except KeyError:
|
||||
print("*** no presets found.")
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import collections
|
||||
|
||||
from avalon import io, pipeline
|
||||
from ..api import project_settings
|
||||
from ..api import get_project_settings
|
||||
import avalon.api
|
||||
|
||||
log = logging.getLogger("AvalonContext")
|
||||
|
|
@ -410,7 +410,7 @@ class BuildWorkfile:
|
|||
(dict): preset per entered task name
|
||||
"""
|
||||
host_name = avalon.api.registered_host().__name__.rsplit(".", 1)[-1]
|
||||
presets = project_settings(io.Session["AVALON_PROJECT"])
|
||||
presets = get_project_settings(io.Session["AVALON_PROJECT"])
|
||||
# Get presets for host
|
||||
build_presets = (
|
||||
presets.get(host_name, {})
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import os
|
|||
import inspect
|
||||
import logging
|
||||
|
||||
from ..api import config, project_settings
|
||||
from ..api import config, get_project_settings
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -25,7 +25,7 @@ def filter_pyblish_plugins(plugins):
|
|||
|
||||
host = api.current_host()
|
||||
|
||||
presets = project_settings(os.environ['AVALON_PROJECT']) or {}
|
||||
presets = get_project_settings(os.environ['AVALON_PROJECT']) or {}
|
||||
|
||||
# iterate over plugins
|
||||
for plugin in plugins[:]:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import os
|
|||
import re
|
||||
|
||||
from pype.modules.ftrack.lib import BaseAction, statics_icon
|
||||
from pype.api import Anatomy, project_settings as get_project_settings
|
||||
from pype.api import Anatomy, get_project_settings as get_project_settings
|
||||
|
||||
|
||||
class CreateProjectFolders(BaseAction):
|
||||
|
|
@ -73,9 +73,9 @@ class CreateProjectFolders(BaseAction):
|
|||
project_entity = self.get_project_from_entity(entities[0])
|
||||
# Load settings for project
|
||||
project_name = project_entity["full_name"]
|
||||
project_settings = get_project_settings(project_name)
|
||||
get_project_settings = get_project_settings(project_name)
|
||||
project_folder_structure = (
|
||||
project_settings["global"]["project_folder_structure"]
|
||||
get_project_settings["global"]["project_folder_structure"]
|
||||
)
|
||||
if not project_folder_structure:
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from avalon.api import AvalonMongoDB
|
|||
|
||||
from bson.objectid import ObjectId
|
||||
|
||||
from pype.api import Anatomy, project_settings as get_project_settings
|
||||
from pype.api import Anatomy, get_project_settings as get_project_settings
|
||||
|
||||
|
||||
class UserAssigmentEvent(BaseEvent):
|
||||
|
|
@ -200,9 +200,9 @@ class UserAssigmentEvent(BaseEvent):
|
|||
project_name = task_entity["project"]["full_name"]
|
||||
project_data = tmp_by_project_name.get(project_name) or {}
|
||||
if "scripts_by_action" not in project_data:
|
||||
project_settings = get_project_settings(project_name)
|
||||
get_project_settings = get_project_settings(project_name)
|
||||
_settings = (
|
||||
project_settings["ftrack"]["events"]["user_assignment"]
|
||||
get_project_settings["ftrack"]["events"]["user_assignment"]
|
||||
)
|
||||
project_data["scripts_by_action"] = _settings.get("scripts")
|
||||
tmp_by_project_name[project_name] = project_data
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from pype.modules.ftrack import BaseEvent
|
||||
from pype.api import project_settings as get_project_settings
|
||||
from pype.api import get_project_settings as get_project_settings
|
||||
|
||||
|
||||
class VersionToTaskStatus(BaseEvent):
|
||||
|
|
@ -52,11 +52,11 @@ class VersionToTaskStatus(BaseEvent):
|
|||
|
||||
project_entity = self.get_project_from_entity(task)
|
||||
project_name = project_entity["full_name"]
|
||||
project_settings = get_project_settings(project_name)
|
||||
get_project_settings = get_project_settings(project_name)
|
||||
|
||||
# Load status mapping from presets
|
||||
status_mapping = (
|
||||
project_settings["ftrack"]["event"]["status_version_to_task"]
|
||||
get_project_settings["ftrack"]["event"]["status_version_to_task"]
|
||||
)
|
||||
# Skip if mapping is empty
|
||||
if not status_mapping:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import tempfile
|
|||
import os
|
||||
import pyblish.api
|
||||
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
import inspect
|
||||
|
||||
ValidatePipelineOrder = pyblish.api.ValidatorOrder + 0.05
|
||||
|
|
@ -24,7 +24,7 @@ def imprint_attributes(plugin):
|
|||
plugin_host = file.split(os.path.sep)[-3:-2][0]
|
||||
plugin_name = type(plugin).__name__
|
||||
try:
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings_data = settings[plugin_host][plugin_kind][plugin_name] # noqa: E501
|
||||
print(settings_data)
|
||||
except KeyError:
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ class CreateRenderSetup(avalon.maya.Creator):
|
|||
# \__| |
|
||||
# \_____/
|
||||
|
||||
# from pype.api import project_settings
|
||||
# from pype.api import get_project_settings
|
||||
# import maya.app.renderSetup.model.renderSetup as renderSetup
|
||||
# settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
# settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
# layer = settings['maya']['create']['renderSetup']["layer"]
|
||||
|
||||
# rs = renderSetup.instance()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from avalon import api
|
||||
import pype.hosts.maya.plugin
|
||||
import os
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
import clique
|
||||
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ class AssProxyLoader(pype.hosts.maya.plugin.ReferenceLoader):
|
|||
proxyShape.dso.set(path)
|
||||
proxyShape.aiOverrideShaders.set(0)
|
||||
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
colors = settings['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
|
|
@ -196,7 +196,7 @@ class AssStandinLoader(api.Loader):
|
|||
label = "{}:{}".format(namespace, name)
|
||||
root = pm.group(name=label, empty=True)
|
||||
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
colors = settings['maya']['load']['colors']
|
||||
|
||||
c = colors.get('ass')
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from avalon import api
|
||||
import pype.hosts.maya.plugin
|
||||
import os
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
reload(config)
|
||||
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ class GpuCacheLoader(api.Loader):
|
|||
label = "{}:{}".format(namespace, name)
|
||||
root = cmds.group(name=label, empty=True)
|
||||
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
colors = settings['maya']['load']['colors']
|
||||
c = colors.get('model')
|
||||
if c is not None:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import pype.hosts.maya.plugin
|
|||
from avalon import api, maya
|
||||
from maya import cmds
|
||||
import os
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
|
||||
|
||||
class ReferenceLoader(pype.hosts.maya.plugin.ReferenceLoader):
|
||||
|
|
@ -77,7 +77,7 @@ class ReferenceLoader(pype.hosts.maya.plugin.ReferenceLoader):
|
|||
|
||||
cmds.setAttr(groupName + ".displayHandle", 1)
|
||||
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
colors = settings['maya']['load']['colors']
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from avalon import api
|
||||
import os
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
|
||||
class LoadVDBtoRedShift(api.Loader):
|
||||
"""Load OpenVDB in a Redshift Volume Shape"""
|
||||
|
|
@ -55,7 +55,7 @@ class LoadVDBtoRedShift(api.Loader):
|
|||
label = "{}:{}".format(namespace, name)
|
||||
root = cmds.group(name=label, empty=True)
|
||||
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
colors = settings['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from avalon import api
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
import os
|
||||
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ class LoadVDBtoVRay(api.Loader):
|
|||
label = "{}:{}".format(namespace, name)
|
||||
root = cmds.group(name=label, empty=True)
|
||||
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
colors = settings['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from avalon.maya import lib
|
||||
from avalon import api
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
import os
|
||||
import maya.cmds as cmds
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ class VRayProxyLoader(api.Loader):
|
|||
return
|
||||
|
||||
# colour the group node
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
colors = settings['maya']['load']['colors']
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from maya import cmds
|
|||
from avalon import api, io
|
||||
from avalon.maya import lib as avalon_lib, pipeline
|
||||
from pype.hosts.maya import lib
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
from pprint import pprint
|
||||
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ class YetiCacheLoader(api.Loader):
|
|||
group_name = "{}:{}".format(namespace, name)
|
||||
group_node = cmds.group(nodes, name=group_name)
|
||||
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
colors = settings['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
from collections import defaultdict
|
||||
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
import pype.hosts.maya.plugin
|
||||
from pype.hosts.maya import lib
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ class YetiRigLoader(pype.hosts.maya.plugin.ReferenceLoader):
|
|||
|
||||
groupName = "{}:{}".format(namespace, name)
|
||||
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
colors = settings['maya']['load']['colors']
|
||||
|
||||
c = colors.get('yetiRig')
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import contextlib
|
|||
|
||||
from avalon import api, io
|
||||
from pype.hosts.nuke import presets
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
|
@ -73,7 +73,7 @@ def add_review_presets_config():
|
|||
"families": list(),
|
||||
"representations": list()
|
||||
}
|
||||
settings = project_settings(io.Session["AVALON_PROJECT"])
|
||||
settings = get_project_settings(io.Session["AVALON_PROJECT"])
|
||||
review_presets = settings["global"]["publish"].get(
|
||||
"ExtractReview", {})
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import pyblish.version
|
|||
from . import util
|
||||
from .constants import InstanceStates
|
||||
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
|
||||
|
||||
class IterationBreak(Exception):
|
||||
|
|
@ -121,7 +121,7 @@ class Controller(QtCore.QObject):
|
|||
|
||||
def presets_by_hosts(self):
|
||||
# Get global filters as base
|
||||
presets = project_settings(os.environ['AVALON_PROJECT']) or {}
|
||||
presets = get_project_settings(os.environ['AVALON_PROJECT']) or {}
|
||||
if not presets:
|
||||
return {}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from Qt import QtWidgets, QtCore
|
|||
from . import HelpRole, FamilyRole, ExistsRole, PluginRole, PluginKeyRole
|
||||
from . import FamilyDescriptionWidget
|
||||
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
|
||||
|
||||
class FamilyWidget(QtWidgets.QWidget):
|
||||
|
|
@ -310,7 +310,7 @@ class FamilyWidget(QtWidgets.QWidget):
|
|||
|
||||
def refresh(self):
|
||||
has_families = False
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
sp_settings = settings.get('standalonepublisher', {})
|
||||
print(sp_settings)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
from pype.api import project_settings
|
||||
from pype.api import get_project_settings
|
||||
import pype.hosts.maya.lib as mlib
|
||||
from maya import cmds
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ from maya import cmds
|
|||
print("starting PYPE usersetup")
|
||||
|
||||
# build a shelf
|
||||
settings = project_settings(os.environ['AVALON_PROJECT'])
|
||||
settings = get_project_settings(os.environ['AVALON_PROJECT'])
|
||||
shelf_preset = settings['maya'].get('project_shelf')
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue