Пример #1
0
    def __init__(self, **arg):
        """
        :param:
            editor (BaseEditor): optional
            toollist (dict): list of tool to be instanciated
            rtd (runtime data)
            cfd (config data)
            tkd (task data)
        """
        super(BaseAppHandler, self).__init__()

        self._toolList = arg.get('toollist', dict()) if arg else None

        self._editor = arg.get('editor', None)
        if self._editor == None:
            self._editor = BaseEditor(**arg)

        self._runtimedata = arg.get('rtd', None) if arg else None
        self._configdata = arg.get('cfd', None) if arg else None
        self._taskdata = arg.get('tkd', None) if arg else None

        if self._runtimedata == None:
            self._runtimedata = TpVariable()

        if self._configdata == None:
            self._configdata = TpVariable()
            self._configdata.debug = False

        if self._taskdata == None:
            self._taskdata = TpVariable()

        logger = None
        if hasattr(self._configdata, 'do_log') and self._configdata.do_splash:
            from dsk.base.lib.log_manager import LogManager
            l = LogManager()
            l.initialize_custom_handler()
            l.global_debug = True
            logger = l.get_logger(__name__)

        if hasattr(self._configdata,
                   'do_splash') and self._configdata.do_splash:
            try:
                from dsk.base.utils import qt_utils
                if self._configdata.do_splash == True:
                    self._configdata.splash = qt_utils.get_splash()
                    self._configdata.splash.hide()
            except Exception as e:
                if logger:
                    logger.warning("%s" % str(e))

        if hasattr(self._configdata, 'do_auth') and self._configdata.do_auth:
            from dsk.base.conn_helper import shotgun_startup as SGS
            if self._configdata.do_auth == True:
                #get_user_credential
                user = SGS.get_user()
                self._runtimedata.connection = SGS.get_user_connection(user)
Пример #2
0
$ config_folder/projects/DSK_PROJECT/site_info.yml

Usage:
import project_config
project_config.get('film:fps') # Note: 'DSK_PROJECT' need to be set.
project_config.show('ashowname').get('film:fps') # else you can specify explicitly
project_config.get('RV:?platform') # for platform specific can use wild card, ?platform,
'''

import os
import copy
import re
import yaml

from dsk.base.lib.log_manager import LogManager
log = LogManager.get_logger(__name__)

from dskenv import dskenv_constants as DK
from dsk.base.resources import dsk_constants as DSK
DSK_PROJECT_CONF_BASE = os.path.join(os.sep,
                                     DK.DSK_MOUNTED_ROOT,
                                     DK.DSK_DEV_AREA,
                                     DK.DSK_CONFIGURATION_FOLDER,
                                     DSK.NAME_PROJECT_CONFIG_DIR)


_cache_show_config = {}

def current_show():
    show = os.environ.get('DSK_PROJECT', DSK.NAME_DEFAULT_PROJECT)
    if not show: