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


Python DOM.eventGetType方法代码示例

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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