当前位置: 首页>>代码示例>>Python>>正文


Python logutils.logMsg函数代码示例

本文整理汇总了Python中pytd.util.logutils.logMsg函数的典型用法代码示例。如果您正苦于以下问题:Python logMsg函数的具体用法?Python logMsg怎么用?Python logMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了logMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _search

    def _search(self, query, authOnFail=True, **kwargs):
        logMsg(query, log='all')

        dbconn = self._dbconn

        if isinstance(query, basestring):
            ids = dbconn.search(query)
        elif isinstance(query, dict):
            ids = dbconn.search_mongo(query, **kwargs)
        else:
            raise TypeError("Invalid query: '{}'".format(query))

        if ids is None:

            if not authOnFail:
                raise DbSearchError('Failed to search: "{}"'.format(query))

            bAuthOk = dbconn.verify()
            if not bAuthOk:
                try:
                    bAuthOk = self.project.authenticate()
                except Exception, e:
                    logMsg(toStr(e), warning=True)

            return self._search(query, authOnFail=False, **kwargs)
开发者ID:2Minutes,项目名称:davos-dev,代码行数:25,代码来源:dbtypes.py

示例2: getResource

    def getResource(self, sSpace, sRcName="entity_dir", **kwargs):

        bFail = kwargs.pop("fail", False)
        bFile = kwargs.pop("isFile", False)

        try:
            sRcPath = self.getPath(sSpace, pathVar=sRcName)
        except AttributeError:
            sMsg = "{} has no such resource: '{}' !".format(self, sRcName)
            if bFail:
                raise EnvironmentError(sMsg)
            logMsg(sMsg, warning=True)
            return None

        proj = self.project
        library = self.getLibrary(sSpace)

        drcEntry = proj.entryFromPath(sRcPath, library=library, **kwargs)
        if bFile and drcEntry and (not isinstance(drcEntry, DrcFile)):
            drcEntry = None

        if bFail and (not drcEntry):
            sMsg = "No such {}: '{}'".format("file" if bFile else "resource", sRcPath)
            raise EnvironmentError(sMsg)

        return drcEntry
开发者ID:2Minutes,项目名称:davos-dev,代码行数:26,代码来源:damtypes.py

示例3: __initDamas

    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
开发者ID:2Minutes,项目名称:davos-dev,代码行数:26,代码来源:damproject.py

示例4: dataRepr

    def dataRepr(self, *fields):

        bFilter = True if fields else False

        dataItems = [("id_", self.id_)]
        dataItems.extend(sorted(self._data.iteritems(), key=lambda x:x[0]))

        s = '{'
        for k, v in dataItems:

            if bFilter and (k not in fields):
                continue

            sTypeName = type(v).__name__

            if k in ("time", "ino_write") or k.startswith("synced_"):
                try:
                    v = datetime.fromtimestamp(int(v) / 1000).strftime("%Y-%m-%d %H:%M:%S")
                except Exception as e:
                    logMsg(toStr(e))
            elif isinstance(v, unicode):
                v = str_(v)

            s += "\n<{}> {}: {}".format(sTypeName, k, v)
        return (s + '\n}')
开发者ID:2Minutes,项目名称:davos-dev,代码行数:25,代码来源:dbtypes.py

示例5: matchPos

def matchPos(obj, target, **kwargs):
    logMsg(log="all")

    bPreserveChild = kwargs.get("preserveChild", kwargs.get("pc", False))
    bObjSpace = kwargs.get("objectSpace", kwargs.get("os", False))

    (oObj, oTarget) = argsToPyNode(obj, target)

    sSpace = "world"
    if bObjSpace == True:
        sSpace = "object"

    fPosVec = mc.xform(oTarget.name(), q=True, ws=not bObjSpace, os=bObjSpace, t=True)

    oChildren = None
    if bPreserveChild:
        oChildren = oObj.getChildren(typ="transform")
        oParent = oObj.getParent()
        if oChildren:
            if oParent:
                pm.parent(oChildren, oParent)
            else:
                pm.parent(oChildren, world=True)

    mc.xform(oObj.name(), ws=not bObjSpace, os=bObjSpace, t=fPosVec)
    logMsg("'%s' translate %s to %s" % (sSpace, oObj, oTarget), log="all")

    if oChildren:
        pm.parent(oChildren, oObj)
开发者ID:sebcourtois,项目名称:pypeline-tool-devkit,代码行数:29,代码来源:transform.py

示例6: breakFilesLock

    def breakFilesLock(self, *itemList):
        drcFiles = tuple(item._metaobj for item in itemList)

        for drcFile in drcFiles:
            drcFile.refresh()
            if drcFile.setLocked(False, force=True):
                logMsg('{0} {1}.'.format("Lock broken:", drcFile))
开发者ID:remyla,项目名称:davos-dev,代码行数:7,代码来源:browsercontextmenu.py

示例7: deleteDbNode

    def deleteDbNode(self, *itemList):

        entryList = []
        msg = ""
        for item in itemList:
            entry = item._metaobj
            dbNode = entry._dbnode
            if dbNode:
                r = dbNode.dataRepr("file")
                r = re.sub(r"[\s{}]", "", r)
                msg += (r + "\n")
                entryList.append(entry)

        sMsg = u'Are you sure you want to DELETE these db nodes:\n\n' + msg

        sConfirm = confirmDialog(title='WARNING !',
                                 message=sMsg,
                                 button=['OK', 'Cancel'],
                                 defaultButton='Cancel',
                                 cancelButton='Cancel',
                                 dismissString='Cancel',
                                 icon="warning")

        if sConfirm == 'Cancel':
            logMsg("Cancelled !", warning=True)
            return

        for entry in entryList:
            entry.deleteDbNode()
开发者ID:remyla,项目名称:davos-dev,代码行数:29,代码来源:browsercontextmenu.py

示例8: scan

def scan(proj, sDbPath):

    sDbPath = pathNorm(sDbPath)

    library = proj.libraryFromDbPath(sDbPath)

    sCurSite = proj.getCurrentSite()

    dbNodeDct = proj._db.findNodes({"file":{"$regex":"^{}".format(addEndSlash(sDbPath))},
                                    "source_size":{"$exists":True}}, asDict=True)

    sortKey = lambda n: n._data["#parent"] + "_" + n.name
    dbVersIter = (n for n in dbNodeDct.itervalues() if ("#parent" in n._data))
    dbVersList = sorted(dbVersIter, key=sortKey, reverse=True)
    grpIter = groupby(dbVersList, key=lambda n: n._data["#parent"])
    #for k, g in grpIter:
    #    vn = next(g)
    #    hn = dbNodeDct.get(vn.getField("#parent"))
    #    if int(vn.version) != int(hn.version):
    #        print vn.version, hn.version, hn.file
    dbNodeList = tuple(next(g) for _, g in grpIter)

    numNodes = len(dbNodeList)
    foundList = numNodes * [None]
    errorList = []
    for i, n in enumerate(dbNodeList):

        print "checking {}/{}: {}".format(i + 1, numNodes, n.file)

        rcEntry = library.entryFromDbPath(n.file, dbNode=False, assertLibrary=False)
        if not rcEntry:
            continue

        rcEntry._cacheDbNode(n)

        if rcEntry.fileSize != rcEntry.sourceSize:
            foundList[i] = rcEntry
            continue

        try:
            n = dbNodeDct[n.getField("#parent")]
        except KeyError as e:
            logMsg(e.message, warning=True)
            errorList.append((rcEntry, e))
            continue

        rcEntry = library.entryFromDbPath(n.file, dbNode=False, assertLibrary=False)
        if not rcEntry:
            sOrigin = n.origin
            if sOrigin and (sOrigin in n._data):
                if ("synced_" + sOrigin in n._data):
                    rcEntry = library.entryFromDbPath(n.file, weak=True, dbNode=False, assertLibrary=False)
                    errorList.append((rcEntry, EnvironmentError("missing")))
                continue

        rcEntry._cacheDbNode(n)
        if rcEntry.fileSize != rcEntry.sourceSize:
            foundList[i] = rcEntry

    return foundList, errorList, sDbPath
开发者ID:2Minutes,项目名称:davos-dev,代码行数:60,代码来源:find_corrupted_files.py

示例9: _writeTokenData

 def _writeTokenData(self, tokenData):
     try:
         self.__writeTokenData(tokenData)
     except Exception, e:
         msg = (u"Could not write cookie file: '{}'!\n    {}"
                .format(self.cookieFilePath, toStr(e)))
         logMsg(msg, warning=True)
开发者ID:2Minutes,项目名称:davos-dev,代码行数:7,代码来源:authtypes.py

示例10: shadingGroupsForObject

def shadingGroupsForObject(oObj, warn=True):

    oShdGrpList = []
    oShape = None
    if isinstance(oObj, pm.general.MeshFace):
        indiceList = oObj.indices()
        for oShdEng in oObj.listHistory(type="shadingEngine"):
            if set(indiceList).intersection(set(oShdEng.members()[0].indices())):
                oShdGrpList.append(oShdEng)

    elif isinstance(oObj, pm.general.NurbsSurfaceFace):
        oShape = oObj.node()

    elif isinstance(oObj, pm.nt.Transform):
        oShape = oObj.getShape()

    elif isinstance(oObj, (pm.nt.Mesh, pm.nt.NurbsSurface)):
        oShape = oObj

    elif warn:
        logMsg("Can't get shading groups from {}".format(repr(oObj)) , warning=True)

    if not oShdGrpList:
        if oShape:
            oShdGrpList = oShape.shadingGroups()
            if not oShdGrpList:
                oShdGrpList = oShape.connections(type="shadingEngine")

    return oShdGrpList
开发者ID:sebcourtois,项目名称:pypeline-tool-devkit,代码行数:29,代码来源:rendering.py

示例11: createNewDirectory

    def createNewDirectory(self, *itemList):

        item = itemList[-1]
        pubDir = item._metaobj
        #proj = self.model()._metamodel

        if not pubDir.allowFreePublish():
            confirmDialog(title='SORRY !',
                          message="You can't add new directories here.",
                          button=["OK"],
                          icon="information")
            return

        result = promptDialog(title='Please...',
                            message='Directory Name: ',
                            button=['OK', 'Cancel'],
                            defaultButton='OK',
                            cancelButton='Cancel',
                            dismissString='Cancel',
                            scrollableField=True,
                            )

        if result == 'Cancel':
            logMsg("Cancelled !" , warning=True)
            return

        sDirName = promptDialog(query=True, text=True)
        if not sDirName:
            return

        os.mkdir(pathJoin(pubDir.absPath(), sDirName.strip().replace(" ", "_")))
        pubDir.refresh(children=True)
开发者ID:remyla,项目名称:davos-dev,代码行数:32,代码来源:browsercontextmenu.py

示例12: matchRot

def matchRot(obj, target, **kwargs):
    logMsg(log="all")

    bPreserveChild = kwargs.pop("preserveChild", kwargs.pop("pc", False))
    bObjSpace = kwargs.get("objectSpace", kwargs.get("os", False))

    (oObj, oTarget) = argsToPyNode(obj, target)

    sSpace = "world"
    if bObjSpace == True:
        sSpace = "object"

    objWorldPos = mc.xform(oObj.name(), q=True, ws=True, t=True)
    objScale = mc.xform(oObj.name(), q=True, r=True, s=True)

    oChildren = None
    if bPreserveChild:
        oChildren = oObj.getChildren(typ="transform")
        oParent = oObj.getParent()
        if oChildren:
            if oParent:
                pm.parent(oChildren, oParent)
            else:
                pm.parent(oChildren, world=True)

    matchTRS(oObj, oTarget, logMsg=False, **kwargs)
    logMsg("'%s' rotate %s to %s" % (sSpace, oObj, oTarget), log="all")

    if oChildren:
        pm.parent(oChildren, oObj)

    mc.xform(oObj.name(), ws=True, t=objWorldPos)
    mc.xform(oObj.name(), s=objScale)
开发者ID:sebcourtois,项目名称:pypeline-tool-devkit,代码行数:33,代码来源:transform.py

示例13: getPref

def getPref(in_sKey, default=None):

    global DAVOS_PREFS

    if "|" not in in_sKey:
        return DAVOS_PREFS.get(in_sKey, default)

    sKeyList = in_sKey.split("|")
    iLastKey = len(sKeyList) - 1
    currPrefs = DAVOS_PREFS
    for i, sKey in enumerate(sKeyList):

        if not isinstance(currPrefs, dict):
            k = "|".join(sKeyList[:(i + 1)])
            logMsg("Not a pref dictionary: '{}'.".format(k), warning=True)
            return default

        if i == iLastKey:
            return currPrefs.get(sKey, default)

        if sKey in currPrefs:
            currPrefs = currPrefs[sKey]
        else:
            logMsg("No such pref: '{}'.".format(in_sKey), warning=True)
            return default
开发者ID:2Minutes,项目名称:davos-dev,代码行数:25,代码来源:utils.py

示例14: __publishFiles

    def __publishFiles(self, pubDir):

        if not pubDir.freeToPublish():
            confirmDialog(title='SORRY !',
                          message="You can't add new files here.",
                          button=["OK"],
                          icon="information")
            return

        sRes = confirmDialog(title="DO YOU WANT TO...",
                                 message="publish ?",
                                 button=["Files", "Packages", "Cancel"],
                                 defaultButton="Cancel",
                                 cancelButton="Cancel",
                                 dismissString="Cancel",
                                 icon="question")
        if sRes == "Cancel":
            logMsg("Canceled !", warning=True)
            return
        elif sRes == "Files":
            sSrcPathList = self.chooseFiles(pubDir)
        elif sRes == "Packages":
            sSrcPathList = self.choosePacks(pubDir)

        if not sSrcPathList:
            logMsg("No {} selected: Canceled.".format(sRes.lower()), warning=True)
            return

        pubDir._publishFiles(sSrcPathList, autoLock=True, autoUnlock=True)
开发者ID:2Minutes,项目名称:davos-dev,代码行数:29,代码来源:browsercontextmenu.py

示例15: getLibrary

    def getLibrary(self, sSpace, sLibSection, owner="", dbNode=True, weak=False,
                   remember=True, tokens=None):
        logMsg(log='all')

        self._assertSpaceAndSection(sSpace, sLibSection)

        sFullLibName = DrcLibrary.makeFullName(owner, sSpace, sLibSection)
        drcLib = self.loadedLibraries.get(sFullLibName, None)

        if not drcLib:
            if tokens:
                sLibPath = self.getPath(sSpace, sLibSection, resVars=False, tokens=tokens)
            else:
                sLibPath = self.getPath(sSpace, sLibSection)

            drcLib = self.__libClass(sLibSection, sLibPath, sSpace, owner=owner,
                                     project=self, dbNode=dbNode, remember=remember)
            if weak:
                return drcLib

            if osp.isdir(sLibPath):
                return drcLib
            else:
                logMsg("No such '{}': '{}'.".format(sFullLibName, sLibPath),
                       warning=True)
                return None

        return drcLib
开发者ID:2Minutes,项目名称:davos-dev,代码行数:28,代码来源:damproject.py


注:本文中的pytd.util.logutils.logMsg函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。