Пример #1
0
	def mimeData(self, indexes):
		links = [self.getItemLink(index) for index in indexes
			if index.isValid() and (index.column() == 0)]
		if not links:
			return None

		mimeData = QtCore.QMimeData()
		struct.dumpMimeData(mimeData, links)
		fuseData = []
		for link in links:
			if isinstance(link, struct.DocLink):
				f = fuse.findFuseFile(link)
				if f:
					fuseData.append(f)
		if fuseData:
			mimeData.setUrls([QtCore.QUrl.fromLocalFile(f) for f in fuseData])
		return mimeData
Пример #2
0
    def mimeData(self, indexes):
        links = [
            self.getItemLink(index) for index in indexes
            if index.isValid() and (index.column() == 0)
        ]
        if not links:
            return None

        mimeData = QtCore.QMimeData()
        connector.dumpMimeData(mimeData, links)
        fuseData = []
        for link in links:
            if isinstance(link, connector.DocLink):
                f = fuse.findFuseFile(link)
                if f:
                    fuseData.append(f)
        if fuseData:
            mimeData.setUrls([QtCore.QUrl.fromLocalFile(f) for f in fuseData])
        return mimeData
Пример #3
0
	"    doc:<document>  ...open the latest version of the given document\n"
	"    rev:<revision>  ...display the given revision\n"
	"    <hp-path-spec>  ...open by path spec")
parser = optparse.OptionParser(usage=usage)
parser.add_option("--referrer", dest="referrer", metavar="REF",
	help="Document from which we're coming")
(options, args) = parser.parse_args()
if len(args) != 1:
	parser.error("incorrect number of arguments")
try:
	link = Link(args[0])
except IOError as e:
	parser.error(str(e))

# mounted through user space file system?
path = fuse.findFuseFile(link)
if not path:
	s = Connector().stat(link.rev())
	hash = s.hash('_')

	name = hash.encode('hex')
	ext = ""
	with Connector().peek(link.store(), link.rev()) as r:
		annotation = r.getData("/org.peerdrive.annotation")

	# read title
	if "title" in annotation:
		(name, ext) = os.path.splitext(annotation["title"])

	# try to get extension from Registry if title has none
	if not ext:
Пример #4
0
    "    <hp-path-spec>  ...open by path spec")
parser = optparse.OptionParser(usage=usage)
parser.add_option("--referrer",
                  dest="referrer",
                  metavar="REF",
                  help="Document from which we're coming")
(options, args) = parser.parse_args()
if len(args) != 1:
    parser.error("incorrect number of arguments")
try:
    link = Link(args[0])
except IOError as e:
    parser.error(str(e))

# mounted through user space file system?
path = fuse.findFuseFile(link)
if not path:
    s = Connector().stat(link.rev())
    hash = s.hash('_')

    name = hash.encode('hex')
    ext = ""
    with Connector().peek(link.store(), link.rev()) as r:
        annotation = r.getData("/org.peerdrive.annotation")

    # read title
    if "title" in annotation:
        (name, ext) = os.path.splitext(annotation["title"])

    # try to get extension from Registry if title has none
    if not ext: