コード例 #1
0
    def setProject(self, *args, **kwargs):

        try:
            return self.browserWidget.setProject(*args, **kwargs)
        except Exception, err:
            confirmDialog(title='SORRY !'
                        , message=toStr(err)
                        , button=["OK"]
                        , defaultButton="OK"
                        , cancelButton="OK"
                        , dismissString="OK"
                        , icon="critical")

            if not hostApp():
                os.environ["PYTHONINSPECT"] = "1"

            self.close()

            raise

#    def __del__(self):
#        print "__del__", self.objectName()

#    def closeEvent(self, event):
#        print self, "closeEvent"
#        return QtGui.QMainWindow.closeEvent(self, event)
コード例 #2
0
    def doPublish(self, *itemList):

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

        if isinstance(pubEntry, DrcFile):

            try:
                pubEntry.assertFreeToPublish()
            except EnvironmentError as e:
                confirmDialog(title='SORRY !',
                              message="Publishing not allowed:\n\n" + toStr(e),
                              button=["OK"],
                              icon="critical")
                return

            sAbsPath = pubEntry.absPath()
            if proj.isEditableResource(sAbsPath):

                if hostApp() == "maya":
                    sExt = osp.splitext(sAbsPath)[-1]
                    if sExt in (".ma", ".mb"):
                        raise EnvironmentError("Please, publish from integrated 'Davos' menu.")

                self.__publishEditedVersion(pubEntry)
            else:
                self.__publishRegularVersion(pubEntry)
        else:
            self.__publishFiles(pubEntry)
コード例 #3
0
    def importFiles(self, *itemList):

        proj = self.model()._metamodel

        try:
            if not hostApp():
                raise AssertionError("You can only import from inside another application.")

            drcFileList = tuple(item._metaobj for item in itemList)

            if len(drcFileList) > 1:
                for drcFile in drcFileList:
                    try:
                        drcFile.importIt()
                    except Exception as e:
                        sResult = confirmDialog(title='SORRY !',
                                                message=toStr(e),
                                                button=["Continue", "Abort"],
                                                defaultButton="Continue",
                                                cancelButton="Abort",
                                                dismissString="Abort",
                                                icon="critical")
                        if sResult == "Abort":
                            break
                        else:
                            continue
            else:
                drcFileList[0].importIt()
        finally:
            proj.mayaLoadReferences = True
コード例 #4
0
def pathRename(sSrcPath, sDstPath):
    try:
        os.rename(sSrcPath, sDstPath)
    except WindowsError as e:
        if hostApp() == "maya":
            raise WindowsError(toUnicode("code {} - {}: {}".format(e.args[0], e.strerror , sSrcPath)))
        else:
            raise WindowsError(e.args[0], "{}: {}".format(e.strerror , sSrcPath))
コード例 #5
0
def pathRename(sSrcPath, sDstPath):
    try:
        os.rename(sSrcPath, sDstPath)
    except WindowsError as e:
        if hostApp() == "maya":
            raise WindowsError(toUnicode("code {} - {}: {}".format(e.args[0], e.strerror , sSrcPath)))
        else:
            raise WindowsError(e.args[0], "{}: {}".format(e.strerror , sSrcPath))
コード例 #6
0
    def buildMenu(self):

        if not self.beforeBuildingMenu():
            return

        if hostApp() == "maya":

            self.beginMenu()
            self.populateMenu()
            self.endMenu()

        self.afterBuildingMenu()
コード例 #7
0
    def setProject(self, *args, **kwargs):

        try:
            return self.browserWidget.setProject(*args, **kwargs)
        except Exception, err:
            confirmDialog(title='SORRY !'
                        , message=toStr(err)
                        , button=["OK"]
                        , defaultButton="OK"
                        , cancelButton="OK"
                        , dismissString="OK"
                        , icon="critical")

            if not hostApp():
                os.environ["PYTHONINSPECT"] = "1"

            self.close()

            raise
コード例 #8
0
    def doPublish(self, *itemList):

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

        if isinstance(pubEntry, DrcFile):
            sAbsPath = pubEntry.absPath()
            if proj.isEditableResource(sAbsPath):

                if hostApp() == "maya":
                    sExt = osp.splitext(sAbsPath)[-1]
                    if sExt in (".ma", ".mb"):
                        raise AssertionError("Please, publish from integrated 'Davos' menu.")

                self.__publishEdited(pubEntry)
            else:
                self.__publishRegular(pubEntry)
        else:
            self.__publishFiles(pubEntry)
コード例 #9
0
ファイル: damproject.py プロジェクト: 2Minutes/davos-dev
    def __new__(cls, sProjName, **kwargs):
        logMsg(cls.__name__ , log='all')

        sProjName = sProjName.lower()

        bExists = True
        proj = cls._instancesDct.get(sProjName)
        if not proj:
            bExists = False

            proj = object.__new__(cls)
            proj.name = sProjName

            libClass = DrcLibrary
            if "maya" in hostApp():
                try:
                    from davos_maya.core.mrclibrary import MrcLibrary
                except ImportError:
                    pass
                else:
                    libClass = MrcLibrary

            proj.__libClass = libClass#kwargs.pop("libraryType", DrcLibrary)

            proj.reset()

        if not kwargs.pop("empty", False):

            if not proj.init(**kwargs):
                return None

            proj.loadLibraries()

        if not bExists:
            cls._instancesDct[sProjName] = proj

        #print id(proj), proj

        return proj
コード例 #10
0
    def iterAllowedActions(self, prptyItem):

        sTypeName = type(prptyItem._metaobj).__name__
        sCurApp = hostApp()

        for actionDct in self.createdActionConfigs:

            qAction = actionDct["action"]
            if qAction is None:
                continue

            sAppList = actionDct.get("apps")
            if sAppList and (sCurApp not in sAppList):
                continue

            fnc = actionDct["fnc"]
            sTargetTypeList = getattr(fnc, "act_on_types", None)
            if not sTargetTypeList:
                yield qAction
            else:
                for sPatrn in sTargetTypeList:
                    if fnmatch(sTypeName, sPatrn):
                        yield qAction
                        break
コード例 #11
0
    def importFiles(self, *itemList):

        if not hostApp():
            raise AssertionError("You can only import from inside another application.")

        drcFileList = tuple(item._metaobj for item in itemList)

        if len(drcFileList) > 1:
            for drcFile in drcFileList:

                try:
                    drcFile.importIt()
                except Exception, e:
                    sResult = confirmDialog(title='SORRY !',
                                            message=toStr(e),
                                            button=["Continue", "Abort"],
                                            defaultButton="Continue",
                                            cancelButton="Abort",
                                            dismissString="Abort",
                                            icon="critical")
                    if sResult == "Abort":
                        return
                    else:
                        continue
コード例 #12
0
    def iterAllowedActions(self, prptyItem):

        sTypeName = type(prptyItem._metaobj).__name__
        sCurApp = hostApp()

        for actionDct in self.createdActionConfigs:

            qAction = actionDct["action"]
            if qAction is None:
                continue

            sAppList = actionDct.get("apps")
            if sAppList and (sCurApp not in sAppList):
                continue

            fnc = actionDct["fnc"]
            sTargetTypeList = getattr(fnc, "act_on_types", None)
            if not sTargetTypeList:
                yield qAction
            else:
                for sPatrn in sTargetTypeList:
                    if fnmatch(sTypeName, sPatrn):
                        yield qAction
                        break