本文整理汇总了Python中pyjamas.DOM.eventGetCurrentEvent方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.eventGetCurrentEvent方法的具体用法?Python DOM.eventGetCurrentEvent怎么用?Python DOM.eventGetCurrentEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.eventGetCurrentEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onKeyDown
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onKeyDown(self, sender, keycode, modifiers):
if keycode == KeyboardListener.KEY_UP:
DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
new_value = self.processValue(self.value + self.step)
self.setControlPos(new_value)
self.setValue(new_value)
elif keycode == KeyboardListener.KEY_DOWN:
DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
new_value = self.processValue(self.value - self.step)
self.setControlPos(new_value)
self.setValue(new_value)
示例2: onKeyDown
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onKeyDown(self, sender, keycode, modifiers):
if keycode == KeyboardListener.KEY_UP:
DOM.eventPreventDefault(DOM.eventGetCurrentEvent())
new_value_x, new_value_y = \
self.processValue((self.value_x + self.step_x,
self.value_y + self.step_y))
self.setControlPos((new_value_x,new_value_y))
self.setValue((new_value_x, new_value_y))
elif keycode == KeyboardListener.KEY_DOWN:
DOM.eventPreventDefault(DOM.eventGetCurrentEvent())
new_value_x, new_value_y = \
self.processValue((self.value_x - self.step_x,
self.value_y-self.step_y))
self.setControlPos((new_value_x, new_value_y))
self.setValue((new_value_x, new_value_y))
示例3: onMouseMove
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onMouseMove(self, sender, x, y):
event = DOM.eventGetCurrentEvent()
DOM.eventPreventDefault(event)
# mousing auto re-enables mouse-over hover feedback
if not self.theChild.getHoverTouchingEnabled():
self.theChild.setHoverTouchingEnabled(True)
self.theChild.update()
示例4: onMouseUp
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onMouseUp(self, sender, x, y):
event = DOM.eventGetCurrentEvent()
eventButton = DOM.eventGetButton(event)
if eventButton == Event.BUTTON_LEFT:
remote = server.TickeryService()
id = remote.login(LoginRedirector(self))
if id < 0:
self.setWidget(0, 1, Label('oops: LoginPanel'))
示例5: onClick
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onClick(self, sender=None):
self.setFocus(True);
# work out the relative position of cursor
event = DOM.eventGetCurrentEvent()
mouse_x = DOM.eventGetClientX(event) + Window.getScrollLeft()
mouse_y = DOM.eventGetClientY(event) + Window.getScrollTop()
self.moveControl(mouse_x - self.getAbsoluteLeft(),
mouse_y - self.getAbsoluteTop())
示例6: event_preventDefault
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def event_preventDefault():
"""
Prevents the current event's default behavior.
"""
event = DOM.eventGetCurrentEvent()
if event.preventDefault:
event.preventDefault()
else:
event.returnValue = False
示例7: onMouseDown
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onMouseDown(self, sender, x, y):
# regardless of drag_enabled, onMouseDown must prevent
# default, in order to avoid losing focus.
DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
if not self.drag_enabled:
return
self.dragging = True
DOM.setCapture(self.getElement())
self.moveControl(x + Window.getScrollLeft(), y + Window.getScrollTop())
示例8: onMouseWheel
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onMouseWheel(self, sender, x, y):
event = DOM.eventGetCurrentEvent()
DOM.eventPreventDefault(event)
if self.getCurve(self.SELECTION_CURVE).isVisible():
if event.isNorth():
self.zoomIn()
elif event.isSouth():
self.zoomOut()
示例9: onMouseUp
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onMouseUp(self, sender, x, y):
event = DOM.eventGetCurrentEvent()
DOM.eventPreventDefault(event)
if self.selecting or self.moving:
self.p2.x = self.getXAxis().getMouseCoordinate()
self.p2.y = self.getYAxis().getMouseCoordinate()
self.updateCursor()
self.selecting = False
self.moving = False
示例10: onKeyPress
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onKeyPress(self, sender, keycode, modifiers):
DOM.eventPreventDefault(DOM.eventGetCurrentEvent()) #not needed
if keycode == KeyboardListener.KEY_UP:
self.nextContest()
if keycode == KeyboardListener.KEY_DOWN:
self.nextContest()
if keycode == KeyboardListener.KEY_LEFT:
self.nextSelection()
if keycode == KeyboardListener.KEY_RIGHT:
self.nextSelection()
示例11: onMouseDown
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onMouseDown(self, sender, x, y):
# regardless of drag_enabled, onMouseDown must prevent
# default, in order to avoid losing focus.
self.setFocus(True)
DOM.eventPreventDefault(DOM.eventGetCurrentEvent())
if not self.drag_enabled:
return
self.dragging = True
GlassWidget.show(self)
self.moveControl(x + Window.getScrollLeft(), y + Window.getScrollTop(),
True)
示例12: onKeyPress
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onKeyPress(self, sender, keycode, modifiers):
enter = keycode == KeyboardListener.KEY_ENTER
enterOrTab = enter or keycode == KeyboardListener.KEY_TAB
if sender == self.name1:
if enterOrTab:
# Move to name2 & highlight.
DOM.eventPreventDefault(DOM.eventGetCurrentEvent())
self.name2.setFocus(True)
self.name2.highlight()
elif sender == self.name2:
if enter:
if modifiers & KeyboardListener.MODIFIER_SHIFT:
# Move back to name1 & highlight.
self.name1.setFocus(True)
self.name1.highlight()
else:
# Send query.
DOM.eventPreventDefault(DOM.eventGetCurrentEvent())
self.process()
示例13: setKey
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def setKey(self, k, set):
DOM.eventPreventDefault(DOM.eventGetCurrentEvent())
if k == KeyboardListener.KEY_UP:
self.key_up = set
elif k == KeyboardListener.KEY_DOWN:
self.key_down = set
elif k == KeyboardListener.KEY_LEFT:
self.key_left = set
elif k == KeyboardListener.KEY_RIGHT:
self.key_right = set
elif k == 32:
self.key_fire = set
示例14: onContextMenu
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onContextMenu(self, sender):
event = DOM.eventGetCurrentEvent()
subMenu = MenuBar(True)
subMenu.addItem("<code>Code</code>", True, self)
subMenu.addItem("<strike>Strikethrough</strike>", True, self)
subMenu.addItem("<u>Underlined</u>", True, self)
x = DOM.eventGetClientX(event) + 2
y = DOM.eventGetClientY(event) + 2
popup = ContextMenuPopupPanel(subMenu)
popup.showAt(x, y)
示例15: onKeyPress
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetCurrentEvent [as 别名]
def onKeyPress(self, sender, keycode, modifiers):
if keycode == KeyboardListener.KEY_ENTER:
DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
txt = self.input.getText()
if not txt:
return
new_value = float(txt)
new_value = self.processValue(new_value)
self.setControlPos(new_value)
self.setValue(new_value)
else:
Control.onKeyPress(self, sender, keycode, modifiers)