Пример #1
0
    def onDrop(self, event):
        dt = event.dataTransfer
        types = getTypes(event)
        self.addMessage("drop types received: " + ", ".join(types))
        parent = self.getParent()
        parent.clearContent()
        self.addMessage('dt: ' + str(dt))
        types.sort()
        for ctype in types:
            data = dt.getData(ctype)
            if ctype == 'Files':
                file_names = []
                files = dt.files
                # files is a FileList
                # http://help.dottoro.com/ljuelxgf.php
                for idx in range(files.length):
                    item = files.item(idx)
                    try:
                        name = item.name
                    except:
                        name = item.fileName
                    file_names.append(name)
                data = '<br>'.join(file_names)
            parent.addContent(ctype, data)
        DOM.eventPreventDefault(event)
        # cancel bubble so first file is not opened in browser.

        DOM.eventCancelBubble(event, True)
Пример #2
0
    def onDrop(self, event):
        dt = event.dataTransfer
        types = getTypes(event)
        self.addMessage("drop types received: " + ", ".join(types))
        parent = self.getParent()
        parent.clearContent()
        self.addMessage('dt: ' + str(dt))
        types.sort()
        for ctype in types:
            data = dt.getData(ctype)
            if ctype == 'Files':
                file_names = []
                files = dt.files
                # files is a FileList
                # http://help.dottoro.com/ljuelxgf.php
                for idx in range(files.length):
                    item = files.item(idx)
                    try:
                        name = item.name
                    except:
                        name = item.fileName
                    file_names.append(name)
                data = '<br>'.join(file_names)
            parent.addContent(ctype, data)
        DOM.eventPreventDefault(event)
        # cancel bubble so first file is not opened in browser.

        DOM.eventCancelBubble(event, True)
Пример #3
0
 def onDragEnter(self, event):
     types = getTypes(event)
     if not 'x-star-trek/tribble' in types:
         self.addStyleName('dragover')
         DOM.eventPreventDefault(event)
Пример #4
0
 def onDragEnter(self, event):
     types = getTypes(event)
     if not 'x-star-trek/tribble' in types:
         self.addStyleName('dragover')
         DOM.eventPreventDefault(event)