本文整理汇总了Python中pyjamas.DOM.eventGetType方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.eventGetType方法的具体用法?Python DOM.eventGetType怎么用?Python DOM.eventGetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.eventGetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onBrowserEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def onBrowserEvent(self, event):
Widget.onBrowserEvent(self, event)
event_type = DOM.eventGetType(event)
if event_type == "click":
DOM.eventPreventDefault(event)
if self.targetHistoryToken is not None:
History.newItem(self.targetHistoryToken)
示例2: fireMouseEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def fireMouseEvent(listeners, sender, event):
x = DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(sender.getElement())
y = DOM.eventGetClientY(event) - DOM.getAbsoluteTop(sender.getElement())
etype = DOM.eventGetType(event)
if etype == "mousedown":
for listener in listeners:
listener.onMouseDown(sender, x, y)
return True
elif etype == "mouseup":
for listener in listeners:
listener.onMouseUp(sender, x, y)
return True
elif etype == "mousemove":
for listener in listeners:
listener.onMouseMove(sender, x, y)
return True
elif etype == "mouseover":
from_element = DOM.eventGetFromElement(event)
if not DOM.isOrHasChild(sender.getElement(), from_element):
for listener in listeners:
listener.onMouseEnter(sender)
return True
elif etype == "mouseout":
to_element = DOM.eventGetToElement(event)
if not DOM.isOrHasChild(sender.getElement(), to_element):
for listener in listeners:
listener.onMouseLeave(sender)
return True
return False
示例3: onBrowserEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [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
示例4: onBrowserEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def onBrowserEvent(self, event):
etype = DOM.eventGetType(event)
if etype in MOUSE_EVENTS:
if self._mousePreventDefault:
DOM.eventPreventDefault(event)
return fireMouseEvent(self._mouseListeners, self, event)
return False
示例5: onEventPreview
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def onEventPreview(self, event):
etype = DOM.eventGetType(event)
print "control preview", etype, self._event_targets_control(event), \
DOM.getCaptureElement() is not None
if etype == "keydown":
return self._event_targets_control(event)
elif etype == "keyup":
return self._event_targets_control(event)
elif etype == "keypress":
return self._event_targets_control(event)
elif ( etype == "mousedown"
or etype == "blur"
):
if DOM.getCaptureElement() is not None:
return True
if not self._event_targets_control(event):
return True
elif ( etype == "mouseup"
or etype == "click"
or etype == "mousemove"
or etype == "dblclick"
):
if DOM.getCaptureElement() is not None:
return True
elif etype == "mouseout":
if DOM.getCaptureElement() is not None:
return False
return self._event_targets_control(event)
示例6: fireFocusEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def fireFocusEvent(listeners, sender, event):
type = DOM.eventGetType(event)
if type == "focus":
for listener in listeners:
listener.onFocus(sender)
elif type == "blur":
for listener in listeners:
listener.onLostFocus(sender)
示例7: onEventPreview
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def onEventPreview(self, event):
type = DOM.eventGetType(event)
if type == "click":
target = DOM.eventGetTarget(event)
parentMenuElement = self.item.getParentMenu().getElement()
if DOM.isOrHasChild(parentMenuElement, target):
return False
return PopupPanel.onEventPreview(self, event)
示例8: onBrowserEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def onBrowserEvent(self, event):
FocusWidget.onBrowserEvent(self, event)
type = DOM.eventGetType(event)
if type == "change":
for listener in self.changeListeners:
if hasattr(listener, 'onChange'): listener.onChange(self)
else: listener(self)
示例9: onBrowserEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def onBrowserEvent(self, event):
type = DOM.eventGetType(event)
if type == 'mousedown' or type == 'mouseup' or type == 'mousemove' or type == 'mouseover' or type == 'mouseout':
MouseListener.fireMouseEvent(self.mouseListeners, self, event)
# stop event falling through esp. for drag on image
DOM.eventPreventDefault(event)
else:
Hyperlink.onBrowserEvent(self, event)
示例10: onBrowserEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def onBrowserEvent(self, event):
Widget.onBrowserEvent(self, event)
type = DOM.eventGetType(event)
if type == "load":
for listener in self.loadListeners:
listener.onImageLoad(self)
elif type == "error":
for listener in self.loadListeners:
listener.onImageError(self)
示例11: fireInputEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def fireInputEvent(listeners, sender, event):
etype = DOM.eventGetType(event)
if etype != "input":
return
for listener in listeners:
if hasattr(listener, 'onInput'):
listener.onInput(sender)
else:
listener(sender)
示例12: fireChangeEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def fireChangeEvent(listeners, sender, event):
etype = DOM.eventGetType(event)
if etype != "change":
return
for listener in listeners:
if hasattr(listener, 'onChange'):
listener.onChange(sender)
else:
listener(sender)
示例13: onBrowserEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def onBrowserEvent(self, event) :
type = DOM.eventGetType(event)
if type == "click":
self.onClick(self)
elif type == "keydown":
modifiers = KeyboardListener.getKeyboardModifiers(event)
if hasattr(self.keyDelegate, "onKeyDown"):
self.keyDelegate.onKeyDown(self, DOM.eventGetKeyCode(event),
modifiers)
示例14: onEventPreview
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def onEventPreview(self, event):
etype = DOM.eventGetType(event)
if etype == "mousedown" or etype == "blur":
if DOM.getCaptureElement() is not None:
return True
elif etype == "mouseup" or etype == "click" or \
etype == "mousemove" or etype == "dblclick":
if DOM.getCaptureElement() is not None:
return True
return self._event_targets_popup(event)
示例15: onBrowserEvent
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetType [as 别名]
def onBrowserEvent(self, event):
"""Listen to events raised by the browser and call the appropriate
method of the listener (widget, ..) object.
"""
type = DOM.eventGetType(event)
if type == "dblclick":
for listener in self._doubleclickListeners:
if hasattr(listener, "onDblClick"):
listener.onDblClick(self)
else:
listener(self)