当前位置: 首页>>代码示例>>Python>>正文


Python DOM.eventGetCurrentEvent方法代码示例

本文整理汇总了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)
开发者ID:emk,项目名称:pyjamas,代码行数:13,代码来源:Controls.py

示例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))
开发者ID:jaredly,项目名称:pyjamas,代码行数:17,代码来源:Controls.py

示例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()
开发者ID:Afey,项目名称:pyjs,代码行数:9,代码来源:GChartExample25.py

示例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'))
开发者ID:fluidinfo,项目名称:Tickery,代码行数:10,代码来源:login.py

示例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())
开发者ID:emk,项目名称:pyjamas,代码行数:10,代码来源:Controls.py

示例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
开发者ID:certik,项目名称:sympy_gamma,代码行数:11,代码来源:nb.py

示例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())
开发者ID:emk,项目名称:pyjamas,代码行数:11,代码来源:Controls.py

示例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()
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:11,代码来源:GChartExample24.py

示例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
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:11,代码来源:GChartExample24.py

示例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()
开发者ID:kurifu,项目名称:Old-CMUSV-Voting,代码行数:12,代码来源:pjBallot.py

示例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)
开发者ID:Afey,项目名称:pyjs,代码行数:13,代码来源:Control.py

示例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()
开发者ID:jdunck,项目名称:Tickery,代码行数:22,代码来源:simple.py

示例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
开发者ID:minghuascode,项目名称:pyj,代码行数:14,代码来源:Space.py

示例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)
开发者ID:davidmi,项目名称:cryptogram,代码行数:14,代码来源:Menus.py

示例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)
开发者ID:emk,项目名称:pyjamas,代码行数:14,代码来源:Controls.py


注:本文中的pyjamas.DOM.eventGetCurrentEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。