Пример #1
0
        super(FileWidget, self).setNode(node)

    @staticmethod
    def canHandle(module, moduleInfo):
        return (moduleInfo["handler"].startswith("tree.simple.file"))

    def onDragOver(self, event):
        event.preventDefault()
        event.stopPropagation()

    # print("%s %s" % (event.offsetX, event.offsetY))

    def onDrop(self, event):
        event.preventDefault()
        event.stopPropagation()
        files = event.dataTransfer.files
        for x in range(0, files.length):
            Uploader(files.item(x), self.node)

    @staticmethod
    def render(moduleName, adminInfo, context):
        rootNode = context.get(conf["vi.context.prefix"] +
                               "rootNode") if context else None
        return FileWidget(module=moduleName,
                          rootNode=rootNode,
                          context=context)


displayDelegateSelector.insert(3, FileWidget.canHandle, FileWidget)
moduleHandlerSelector.insert(3, FileWidget.canHandle, FileWidget.render)
Пример #2
0
        self.actionBar.resetLoadingState()

    def getChildKey(self, widget):
        """
			Derives a string used to sort the entries in our entryframe
		"""
        name = (widget.data.get("name") or "").lower()

        if isinstance(widget, self.nodeWidget):
            return "0-%s" % name
        elif isinstance(widget, self.leafWidget):
            return "1-%s" % name
        else:
            return "2-"

    @staticmethod
    def canHandle(moduleName, moduleInfo):
        return moduleInfo["handler"].startswith("tree.")

    @staticmethod
    def render(moduleName, adminInfo, context):
        rootNode = context.get(conf["vi.context.prefix"] +
                               "rootNode") if context else None
        return TreeWidget(module=moduleName,
                          rootNode=rootNode,
                          context=context)


displayDelegateSelector.insert(1, TreeWidget.canHandle, TreeWidget)
moduleHandlerSelector.insert(1, TreeWidget.canHandle, TreeWidget.render)