示例#1
0
    def chooseRegularVersion(self, rcEntry):

        proj = rcEntry.library.project
        curPrivDir = rcEntry.getPrivateDir(weak=True)
        sStartDirPath = topmostFoundDir(curPrivDir.absPath())

        sPrevSrcPath = osp.dirname(rcEntry.sourceFile)
        if sPrevSrcPath:
            sFoundDirPath = ""
            prevSrcLib = proj.libraryFromPath(sPrevSrcPath, anyUser=True)
            if not prevSrcLib:
                sFoundDirPath = topmostFoundDir(sPrevSrcPath)
            else:
                curSrcLib = curPrivDir.library
                if curSrcLib.owner == prevSrcLib.owner:
                    sFoundDirPath = topmostFoundDir(sPrevSrcPath)
            if sFoundDirPath:
                sStartDirPath = sFoundDirPath

        if isinstance(rcEntry, DrcPack):
            sNewVersPath = choosePackages(self.view, "Select a package to publish...",
                                           sStartDirPath, selectMode="single")
        elif isinstance(rcEntry, DrcFile):
            sExt = osp.splitext(rcEntry.name)[1]
            sNewVersPath = QFileDialog.getOpenFileName(self.view,
                                                       "Select a file to publish...",
                                                       sStartDirPath,
                                                       "File (*{})".format(sExt))[0]
        else:
            raise TypeError("Sorry, cannot publish a {}.".format(type(rcEntry)))

        return sNewVersPath
示例#2
0
    def choosePacks(self, pubDir):

        sStartDirPath = topmostFoundDir(pubDir.getHomonym("private", weak=True).absPath())
        sPackPathList = choosePackages(self.view, "Select packages to publish...",
                                       sStartDirPath, selectMode="multi")
        return sPackPathList