def createActions(self):

        self.createdActions = []
        self.createdActionConfigs = []

        for actionDct in self.getActionsConfig():
            sAction = actionDct["label"]
            sMenu = actionDct.get("menu", "Main")

            if actionDct.get("dev", False):
                if not inDevMode():
                    continue

            if sAction == "separator":
                qAction = None
            else:
                bCheckable = actionDct.get("checkable", False)
                actionSlot = functools.partial(self.launchAction, actionDct)
                qAction = createAction(sAction, self, slot=actionSlot,
                                       checkable=bCheckable)

                self.createdActions.append(qAction)

            actionDct["action"] = qAction
            actionDct["menu"] = sMenu

            self.createdActionConfigs.append(actionDct)
예제 #2
0
    def __initDamas(self):

        sDamasServerAddr = self.getVar("project", "damas_server_addr", "")

        from .dbtypes import DummyDbCon
        dummydb = DummyDbCon(sDamasServerAddr)

        if not sDamasServerAddr:
            self._damasdb = dummydb
            return

        if inDevMode():
            print "connecting to damas server:", sDamasServerAddr
        else:
            print "connecting to damas..."

        import damas
        damasdb = damas.http_connection(sDamasServerAddr)

        try:
            damasdb.verify()
        except IOError as e:
            logMsg(toStr(e), warning=True)
            self._damasdb = dummydb
        else:
            self._damasdb = damasdb
예제 #3
0
    def createActions(self):

        self.createdActions = []
        self.createdActionConfigs = []

        for actionDct in self.getActionsConfig():
            sAction = actionDct["label"]
            sMenu = actionDct.get("menu", "Main")

            if actionDct.get("dev", False):
                if not inDevMode():
                    continue

            if sAction == "separator":
                qAction = None
            else:
                bCheckable = actionDct.get("checkable", False)
                actionSlot = functools.partial(self.launchAction, actionDct)
                qAction = createAction(sAction,
                                       self,
                                       slot=actionSlot,
                                       checkable=bCheckable)

                self.createdActions.append(qAction)

            actionDct["action"] = qAction
            actionDct["menu"] = sMenu

            self.createdActionConfigs.append(actionDct)
예제 #4
0
    def loadEnviron(self, force=False):

        sMsg = "\nLoading '{}' environment:".format(self.name)

        envFunc = hostSetEnvFunc()
        if envFunc:
            print sMsg, "(using {}.{})".format(envFunc.__module__, envFunc.__name__)
        else:
            print sMsg

        if self.__loggedUser:
            sUsrLogin = self.__loggedUser.loginName
            updEnv("DAVOS_USER", sUsrLogin, conflict="replace", usingFunc=envFunc)
            if inDevMode() and sUsrLogin == "sebastienc":
                updEnv("ZOMB_TOOL_PATH", r"\\ZOMBIWALK\Z2K_RnD\tool_testing",
                       conflict="replace")
                updEnv("IN_SEB_MODE", "1", conflict="replace")
            else:
                updEnv("IN_SEB_MODE", "", conflict="replace")

        sConflict = "replace" if force else "keep"
        for sSpace, sLibSection in self._iterLibrariesSpaceAndSection():

            sEnvVars = self.getVar(sLibSection, sSpace + "_" + "path_envars", default=())

            for sVar in sEnvVars:
                updEnv(sVar, self.getPath(sSpace, sLibSection, resEnvs=False),
                       conflict=sConflict, usingFunc=envFunc)

        self.loadConfigModule()
예제 #5
0
    def _inSebMode(self):

        if not self._loggedUser:
            return False

        sUsrLogin = self.__loggedUser.loginName
        return (inDevMode() and sUsrLogin == "sebastienc")
예제 #6
0
    def displayViewItems(self):

        bDevMode = sysutils.inDevMode()
        if (not bDevMode) and (self.space == "private"):
            return False

        return True
예제 #7
0
    def endMenu(self):

        with self.menu:

            if sysutils.inDevMode():

                pm.menuItem(divider=True)

                with pm.subMenuItem(label="Log Level", to=True):
                    pm.radioMenuItemCollection()

                    pm.menuItem(label='Callback',
                                radioButton=(logutils.logSeverity == -1),
                                c=partial(self.setLogLevel, -1))
                    pm.menuItem(label='Silent',
                                radioButton=(logutils.logSeverity == 0),
                                c=partial(self.setLogLevel, 0))
                    pm.menuItem(label='Info',
                                radioButton=(logutils.logSeverity == 1),
                                c=partial(self.setLogLevel, 1))
                    pm.menuItem(label='Debug',
                                radioButton=(logutils.logSeverity == 2),
                                c=partial(self.setLogLevel, 2))
                    pm.menuItem(label='All',
                                radioButton=(logutils.logSeverity == 3),
                                c=partial(self.setLogLevel, 3))

                pm.menuItem(label="Urllib3 Logging",
                            c=setUrllib3LoggingEnabled,
                            cb=False)

            pm.menuItem(divider=True)
            pm.menuItem(label="Reload Tools", c=self.reload)
예제 #8
0
    def endMenu(self):

        with self.menu:

            if sysutils.inDevMode():

                pm.menuItem(divider=True)

                with pm.subMenuItem(label="Log Level", to=True):
                    pm.radioMenuItemCollection()

                    pm.menuItem(label='Callback',
                                radioButton=(logutils.logSeverity == -1),
                                c=partial(self.setLogLevel, -1))
                    pm.menuItem(label='Silent',
                                radioButton=(logutils.logSeverity == 0),
                                c=partial(self.setLogLevel, 0))
                    pm.menuItem(label='Info',
                                radioButton=(logutils.logSeverity == 1),
                                c=partial(self.setLogLevel, 1))
                    pm.menuItem(label='Debug',
                                radioButton=(logutils.logSeverity == 2),
                                c=partial(self.setLogLevel, 2))
                    pm.menuItem(label='All',
                                radioButton=(logutils.logSeverity == 3),
                                c=partial(self.setLogLevel, 3))


                pm.menuItem(label="Urllib3 Logging", c=setUrllib3LoggingEnabled, cb=False)

            pm.menuItem(divider=True)
            pm.menuItem(label="Reload Tools", c=self.reload)
예제 #9
0
    def __init__(self, parent=None):
        super(AssetBrowserWidget , self).__init__(parent)

        self.setupUi(self)
        self.splitter.splitterMoved.connect(self.autoResizeImage)

        self.project = None

        if inDevMode():
            self.setStyleSheet(STYLE)
예제 #10
0
    def setModel(self, model):

        if isinstance(model, QtGui.QSortFilterProxyModel):
            newModel = model.sourceModel()
        else:
            newModel = model

        self.mapper.setModel(newModel)
        self.buildWidgetMapping()

        self.setUiCategory("YY_AllnDev" if inDevMode() else "XX_All")
예제 #11
0
    def __init__(self, windowName="", windowTitle="", parent=None):
        super(AssetBrowserWindow, self).__init__(parent)

        self.setupUi(self)
        if windowName:
            self.setObjectName(windowName)
        if windowTitle:
            self.setWindowTitle(windowTitle)

        self.browserWidget = self.__class__.classBrowserWidget(self)
        self.setCentralWidget(self.browserWidget)

        self.resize(1100, 800)

        if inDevMode():
            self.setStyleSheet(STYLE)
예제 #12
0
def syncProperty(sDbKey, **kwargs):
    params = {
        "type": "db_sync",
        "isMulti": False,
        "default": 0,
        "accessor": "_dbnode",
        "reader": "getField({})".format(sDbKey),
        "writer": "setField({})".format(sDbKey),
        "lazy": True,
        "copyable": True,
        "uiEditable": Eds.Enabled if inDevMode() else Eds.Disabled,
        "uiVisible": True,
        "uiCategory": "060_Sync",
    }
    params.update(**kwargs)
    return params
예제 #13
0
    def init(self, **kwargs):
        logMsg(log='all')

        self.__userid = kwargs.pop("user", "")
        self.__passwd = kwargs.pop("password", "")

        bShotgun = kwargs.pop("shotgun", True)
        bDamas = kwargs.pop("damas", True)

        bExists = self._instanceExists()
        if bExists and self.isAuthenticated():
            return True

        print "<{}> Initializing...".format(self)

        if bShotgun:
            self.__initShotgun()
            if not bDamas:
                self.__authClass = ShotgunAuth

        if bDamas:
            self.__initDamas()
            if not bShotgun:
                self.__authClass = DamasAuth

        if bShotgun and bDamas:
            self.__authClass = DualAuth

        if not self.authenticate(renew=True):
            return False

        if inDevMode() and kwargs.pop("checkTemplates", True):
            sMissingPathList = []
            self._checkTemplatePaths(sMissingPathList)
            if sMissingPathList:
                msg = "Missing template paths:\n    " + '\n    '.join(sMissingPathList)
                logMsg(msg , warning=True)
                #return False

        self._db = DrcDb(self)

        return True
예제 #14
0
    def submitLogin(self):

        sUser, sPwd = (self.getUsername(), self.getPassword())

        res = None
        if self.submitSlot:

            try:
                res = self.submitSlot(sUser, sPwd)
            except Exception, err:
                confirmDialog(title='SORRY !',
                              message=toStr(err),
                              button=["OK"],
                              defaultButton="OK",
                              cancelButton="OK",
                              dismissString="OK",
                              icon="critical")

                if inDevMode():
                    raise

                return
예제 #15
0
    def submitLogin(self):

        sUser, sPwd = (self.getUsername(), self.getPassword())

        res = None
        if self.submitSlot:

            try:
                res = self.submitSlot(sUser, sPwd)
            except Exception, err:
                confirmDialog(title='SORRY !'
                            , message=toStr(err)
                            , button=["OK"]
                            , defaultButton="OK"
                            , cancelButton="OK"
                            , dismissString="OK"
                            , icon="critical")

                if inDevMode():
                    raise

                return
예제 #16
0
def listMissingPathItems(rootDirList, update=False):

    missingPathItems = []

    proj = rootDirList[0].library.project

    assetItems = []
    astTypeItems = []
    shotItems = []
    sequenceItems = []
    for drcDir in rootDirList:

        drcLib = drcDir.library
        bAsset = (drcLib.name == "asset")
        bShot = (drcLib.name == "shot")
        pathData = proj.contextFromPath(drcDir)
#        print pathData

        sEntityName = pathData.get("name")
        if not sEntityName:
            if bAsset:
                sAstType = pathData.get("assetType")
                if sAstType:
                    sSgAstType = proj.getVar(sAstType, "sg_type", default="")
                    if sSgAstType:
                        astTypeItems.append((sSgAstType, drcDir))
            elif bShot:
                    sSeqCode = pathData.get("sequence")
                    if sSeqCode:
                        sequenceItems.append((sSeqCode, drcDir))
        elif update:
            if bAsset:
                assetItems.append((sEntityName, drcDir))
            elif bShot:
                shotItems.append((sEntityName, drcDir))

    astFilters = []
    astTypeDirs = None
    if assetItems:
        astFilters = [["code", "in", tuple(s for s, _ in assetItems)]]
    elif astTypeItems:
        astFilters = [["sg_asset_type", "in", tuple(s for s, _ in astTypeItems)]]
        astTypeDirs = tuple(o for _, o in astTypeItems)

    shotFilters = []
    sequenceDirs = None
    if shotItems:
        shotFilters = [["code", "in", tuple(s for s, _ in shotItems)]]
    elif sequenceItems:
        shotFilters = [["sg_sequence.Sequence.code", "in", tuple(s for s, _ in sequenceItems)]]
        sequenceDirs = tuple(o for _, o in sequenceItems)


    if astFilters:

        sgAstList = proj.listAllSgAssets(includeOmitted=inDevMode(), moreFilters=astFilters)
    #    allSgAstList.append({"code":"chfjhgrjlkhdjtr"})
        print "Assets:", len(sgAstList)

        missingPathItems.extend(iterMissingPathItems(proj, "asset", sgAstList,
                                                     astTypeDirs, update=update))

    if shotFilters:

        sgShotList = proj.listAllSgShots(includeOmitted=inDevMode(), moreFilters=shotFilters)
        print "Shots:", len(sgShotList)

        missingPathItems.extend(iterMissingPathItems(proj, "shot", sgShotList,
                                                     sequenceDirs, update=update))

    return missingPathItems
예제 #17
0
파일: utils.py 프로젝트: 2Minutes/davos-dev
def damasServerPort():
    return os.getenv("DAMAS_DEV_PORT", "8443") if inDevMode() else "8443"
예제 #18
0
    def loadData(self, fileInfo, **kwargs):
        logMsg(log="all")

        super(DrcLibrary, self).loadData(fileInfo, **kwargs)

        self.label = self.fullName if sysutils.inDevMode() else self.name
예제 #19
0
            "uiCategory": "042_Version",
        },
    ),
    (
        "syncRules",
        {
            "type": "db_str",
            "isMulti": True,
            "default": [],
            "accessor": "_dbnode",
            "reader": "getField(sync_rules)",
            "writer": "setField(sync_rules)",
            "setter": "setSyncRules",
            "lazy": True,
            "copyable": True,
            "uiEditable": Eds.Enabled if inDevMode() else Eds.Disabled,
            "uiVisible": True,
            "uiDisplay": "",
            "uiCategory": "060_Sync",
        },
    ),
)

DrcFileProperties = [
    (
        "lockOwner",
        {
            "type": "db_str",
            "isMulti": False,
            "default": "",
            "accessor": "_dbnode",