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


Python DOM.eventCancelBubble方法代码示例

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

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

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

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

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

示例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)
开发者ID:jakebarnwell,项目名称:PythonGenerator,代码行数:8,代码来源:events.py


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