def onDragOver(self, event): target = DOM.eventGetTarget(event) t = Widget(Element=target) dt = event.dataTransfer dt.dropEffect = 'copy' class_names = t.getStyleName() if class_names is not None: if 'drophere' in class_names: DOM.eventPreventDefault(event)
def onDragLeave(self, event): target = DOM.eventGetTarget(event) t = Widget(Element=target) try: class_names = t.getStyleName() except: class_names = None if class_names is not None: if 'drophere' in class_names: t.removeStyleName('dragover')
def onDragOver(self, event): target = DOM.eventGetTarget(event) t = Widget(Element=target) class_names = t.getStyleName() if class_names is not None: if 'drophere' in class_names: dt = event.dataTransfer id = Widget(Element=target).getID() drop_effect = self.data[int(id[-1])] dt.dropEffect = drop_effect DOM.eventPreventDefault(event)
def onDragEnter(self, event): target = DOM.eventGetTarget(event) t = Widget(Element=target) try: class_names = t.getStyleName() except: class_names = None if class_names is not None: if 'drophere' in class_names: t.addStyleName('dragover') DOM.eventPreventDefault(event)
def onDrop(self, event): dt = event.dataTransfer text = dt.getData('Text') target = DOM.eventGetTarget(event) t = Widget(Element=target) class_names = t.getStyleName() DOM.eventPreventDefault(event) if class_names is not None: if 'drophere' in class_names: self.addMessage('%s onto %s' % (text, target.id)) return
def onDrop(self, event): dt = event.dataTransfer text = dt.getData('Text') target = DOM.eventGetTarget(event) t = Widget(Element=target) class_names = t.getStyleName() if class_names is not None: if 'drophere' in class_names: self.addMessage('%s onto %s<br>effectAllowed=%s, dropEffect=%s' % (text, target.id, dt.effectAllowed, dt.dropEffect)) DOM.eventPreventDefault(event)