コード例 #1
0
    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)
コード例 #2
0
    def createNewAsset(self, *itemList):

        item = itemList[-1]
        drcDir = item._metaobj

        library = drcDir.library
        if library.sectionName != "asset_lib":
            raise RuntimeError("Cannot create new asset under '{}'"
                               .format(library.sectionName))

        proj = library.project

        sSection = drcDir.name
        if not proj._confobj.hasSection(sSection):
            raise RuntimeError("No such asset type configured: '{}'."
                               .format(sSection))

        if not proj._confobj.getVar(sSection, "template_dir", ""):
            raise RuntimeError("No template configured for '{}'".format(sSection))

        result = promptDialog(title='Please...',
                              message='Entity Name: ',
                              button=['OK', 'Cancel'],
                              defaultButton='OK',
                              cancelButton='Cancel',
                              dismissString='Cancel',
                              scrollableField=True,
                              text=sSection + "_"
                              )

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

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

        damAst = DamAsset(proj, name=sEntityName, assetType=sSection)
        if damAst.assetType != sSection:
            raise ValueError("Bad asset type: '{}' ! Expected '{}'."
                             .format(damAst.assetType, sSection))

        damAst.createDirsAndFiles(dryRun=False)
        astDir = damAst.getResource("public", "entity_dir")
        if astDir:
            astDir.parentDir().refresh(children=True)
            astDir.setSyncRules(astDir.syncRules)
コード例 #3
0
ファイル: utils.py プロジェクト: 2Minutes/davos-dev
def promptForComment(**kwargs):

    sComment = ""
    bOk = False

    result = promptDialog(title='Please...',
                          message='Leave a comment: ',
                          button=['OK', 'Cancel'],
                          defaultButton='OK',
                          cancelButton='Cancel',
                          dismissString='Cancel',
                          scrollableField=True,
                          **kwargs)

    if result == 'Cancel':
        logMsg("Cancelled !" , warning=True)
    elif result == 'OK':
        sComment = promptDialog(query=True, text=True)
        bOk = True

    return sComment, bOk
コード例 #4
0
ファイル: utils.py プロジェクト: remyla/davos-dev
def promptForComment(**kwargs):

    sComment = ""
    bOk = False

    result = promptDialog(
        title="Please...",
        message="Leave a comment: ",
        button=["OK", "Cancel"],
        defaultButton="OK",
        cancelButton="Cancel",
        dismissString="Cancel",
        scrollableField=True,
        **kwargs
    )

    if result == "Cancel":
        logMsg("Cancelled !", warning=True)
    elif result == "OK":
        sComment = promptDialog(query=True, text=True)
        bOk = True

    return sComment, bOk