本文整理汇总了Python中pyjamas.DOM.eventCancelBubble方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.eventCancelBubble方法的具体用法?Python DOM.eventCancelBubble怎么用?Python DOM.eventCancelBubble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.eventCancelBubble方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onElementContextmenu
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventCancelBubble [as 别名]
def onElementContextmenu(self, sender,event):
x = DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(self.canvas.getElement())
y = DOM.eventGetClientY(event) - DOM.getAbsoluteTop(self.canvas.getElement())
s = self.desc[self.elements.index(sender)]
self.set_status('Contextmenue on Element '+s+' at '+str(x)+', '+str(y))
DOM.eventCancelBubble(event,True)
DOM.eventPreventDefault(event)
示例2: action
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventCancelBubble [as 别名]
def action(self,element,event):
x = DOM.eventGetClientX(event) - self.ox
y = DOM.eventGetClientY(event) - self.oy
DOM.eventCancelBubble(event,True)
DOM.eventPreventDefault(event)
#alert('clic %s %s'%(x,y))
self._action(x,y)
示例3: onDrop
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventCancelBubble [as 别名]
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)
示例4: onBrowserEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventCancelBubble [as 别名]
def onBrowserEvent(self, event):
# farm out the event to convenience handlers.
# detect existence by checking for the listener lists of each
# type of handler. there's probably a better way to do this...
if hasattr(self, "_clickListeners"):
ClickHandler.onBrowserEvent(self, event)
if hasattr(self, "_keyboardListeners"):
KeyboardHandler.onBrowserEvent(self, event)
if hasattr(self, "_mouseListeners"):
MouseHandler.onBrowserEvent(self, event)
if hasattr(self, "_mouseWheelListeners"):
MouseWheelHandler.onBrowserEvent(self, event)
if hasattr(self, "_focusListeners"):
FocusHandler.onBrowserEvent(self, event)
if hasattr(self, "_dragListeners"):
DragHandler.onBrowserEvent(self, event)
if hasattr(self, "_dropListeners"):
DropHandler.onBrowserEvent(self, event)
if self.contextMenu is None:
return True
type = DOM.eventGetType(event)
if type == "contextmenu":
DOM.eventCancelBubble(event, True)
DOM.eventPreventDefault(event)
self.contextMenu.onContextMenu(self)
return False
return True
示例5: onElementDblClick
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventCancelBubble [as 别名]
def onElementDblClick(self,sender,event):
x = DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(self.canvas.getElement())
y = DOM.eventGetClientY(event) - DOM.getAbsoluteTop(self.canvas.getElement())
s = self.desc[self.elements.index(sender)]
self.set_status('Doubleclick on Element '+s+' at '+str(x)+', '+str(y))
DOM.eventCancelBubble(event,True)
示例6: onElementMousemove
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventCancelBubble [as 别名]
def onElementMousemove(self, sender, event):
x = DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(self.canvas.getElement())
y = DOM.eventGetClientY(event) - DOM.getAbsoluteTop(self.canvas.getElement())
s = self.desc[self.elements.index(sender)]
self.set_status("Mousemove on Element " + s + " at " + str(x) + ", " + str(y))
DOM.eventCancelBubble(event, True)