Exemplo n.º 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
Exemplo n.º 2
0
    def chooseFiles(self, pubDir):

        sStartDirPath = topmostFoundDir(pubDir.getHomonym("private", weak=True).absPath())
        sFilePathList, _ = QFileDialog.getOpenFileNames(self.view,
                                                     "Select files to publish...",
                                                     sStartDirPath,
                                                     "File (*.*)")
        return sFilePathList
Exemplo n.º 3
0
    def chooseRegularVersion(self, pubFile):

        sExt = osp.splitext(pubFile.name)[1]
        if not sExt:
            raise ValueError('File has no extension: {}'.format(pubFile))

        sStartDirPath = osp.dirname(pubFile.sourceFile)
        if not osp.isdir(sStartDirPath):
            sStartDirPath = pubFile.getPrivateDir(weak=True).absPath()
        sStartDirPath = topmostFoundDir(sStartDirPath)

        sSrcFilePath, _ = QFileDialog.getOpenFileName(self.view,
                                                      "Select a file to publish...",
                                                      sStartDirPath,
                                                      "File (*{})".format(sExt))
        return sSrcFilePath
Exemplo n.º 4
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