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


Python DOM.isOrHasChild方法代码示例

本文整理汇总了Python中pyjamas.DOM.isOrHasChild方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.isOrHasChild方法的具体用法?Python DOM.isOrHasChild怎么用?Python DOM.isOrHasChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyjamas.DOM的用法示例。


在下文中一共展示了DOM.isOrHasChild方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fireMouseEvent

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [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

示例2: compareTo

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
 def compareTo(self, arg0):
     Candidate other = (Candidate) arg0
     
     Element myElement = getDropTarget().getElement()
     Element otherElement = other.getDropTarget().getElement()
     if DOM.compare(myElement, otherElement):
         return 0
      elif DOM.isOrHasChild(myElement, otherElement):
         return -1
      elif DOM.isOrHasChild(otherElement, myElement):
         return 1
      else:
         return 0
开发者ID:jaredly,项目名称:pyjamas,代码行数:15,代码来源:DropControllerCollection.py

示例3: onEventPreview

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [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

示例4: onEventPreview

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
    def onEventPreview(self, event):
        type = DOM.eventGetType(event)
        if type == "click":
            target = DOM.eventGetTarget(event)
            parentMenuElement = self.item.getElement()
            if DOM.isOrHasChild(parentMenuElement, target):
                if self.item.onBrowserEvent(event):
                    self.hide()
                return True

        return PopupPanel.onEventPreview(self, event)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:13,代码来源:ContextMenuPopupPanel.py

示例5: onEventPreview

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
 def onEventPreview(self, event):
     # preventDefault on mousedown events, outside of the
     # dialog, to stop text-selection on dragging
     type = DOM.eventGetType(event)
     if type == "mousedown":
         target = DOM.eventGetTarget(event)
         elem = self.caption.getElement()
         event_targets_popup = target and DOM.isOrHasChild(elem, target)
         if event_targets_popup:
             DOM.eventPreventDefault(event)
     return PopupPanel.onEventPreview(self, event)
开发者ID:nielsonsantana,项目名称:emath,代码行数:13,代码来源:PopupPagina.py

示例6: onEventPreview

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
 def onEventPreview(self, event):
     # preventDefault on mousedown events, outside of the
     # dialog, to stop text-selection on dragging
     type = DOM.eventGetType(event)
     print "onEventPreview", event, type
     if type == 'mousedown':
         target = DOM.eventGetTarget(event)
         event_targets_control = target and DOM.isOrHasChild(self.getElement(), target)
         print "onEventPreview", target, event_targets_control
         if event_targets_control:
             DOM.eventPreventDefault(event)
     return VerticalSliderDemo.onEventPreview(self, event)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:14,代码来源:Controls.py

示例7: elementClicked

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
    def elementClicked(self, root, hElem):
        chain = []
        self.collectElementChain(chain, self.getElement(), hElem)

        item = self.findItemByChain(chain, 0, root)
        if item is not None:
            if DOM.compare(item.getImageElement(), hElem):
                item.setState(not item.getState(), True)
                return True
            elif DOM.isOrHasChild(item.getElement(), hElem):
                self.onSelection(item, True)
                return True

        return False
开发者ID:anandology,项目名称:pyjamas,代码行数:16,代码来源:Tree.py

示例8: onBrowserEvent

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
    def onBrowserEvent(self, event):
        typ = DOM.eventGetType(event)

        if typ == "mousedown":
            target = DOM.eventGetTarget(event)
            if DOM.isOrHasChild(self.splitElem, target):
                self.startResizingFrom(DOM.eventGetClientX(event) -
                                       self.getAbsoluteLeft(),
                          DOM.eventGetClientY(event) - self.getAbsoluteTop())
                DOM.setCapture(self.getElement())
                DOM.eventPreventDefault(event)

        elif typ == "mouseup":
            DOM.releaseCapture(self.getElement())
            self.stopResizing()

        elif typ == 'mousemove':
            if self.isResizing:
                #assert DOM.getCaptureElement() is not None
                self.onSplitterResize(DOM.eventGetClientX(event) -
                                      self.getAbsoluteLeft(),
                          DOM.eventGetClientY(event) - self.getAbsoluteTop())
                DOM.eventPreventDefault(event)
开发者ID:certik,项目名称:pyjamas,代码行数:25,代码来源:splitpanel.py

示例9: _event_targets_title

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
 def _event_targets_title(self, event):
     target = DOM.eventGetTarget(event)
     return target and DOM.isOrHasChild(self.title.getElement(), target)
开发者ID:brodybits,项目名称:pyjs,代码行数:5,代码来源:Override.py

示例10: onClick

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
 def onClick(self, sender=None):
     for i in range(1, self.panel.getWidgetCount() - 1):
         if DOM.isOrHasChild(self.panel.getWidget(i).getElement(),
                             sender.getElement()):
             return self.selectTab(i - 1)
     return False
开发者ID:anandology,项目名称:pyjamas,代码行数:8,代码来源:TabBar.py

示例11: onBrowserEvent

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
    def onBrowserEvent(self, event):
        # Should not act on button if disabled.
        if not self.isEnabled():
            # This can happen when events are bubbled up from
            # non-disabled children
            return

        event_type = DOM.eventGetType(event)

        if event_type == "click":
            # If clicks are currently disallowed, keep it from bubbling or
            # being passed to the superclass.
            if not self.allowClick:
                DOM.eventStopPropagation(event)
                return

        elif event_type == "mousedown":
            if DOM.eventGetButton(event) == Event.BUTTON_LEFT:
                self.setFocus(True)
                self.onClickStart()
                DOM.setCapture(self.getElement())
                self.isCapturing = True
                # Prevent dragging (on some browsers)
                DOM.eventPreventDefault(event)

        elif event_type == "mouseup":
            if self.isCapturing:
                self.isCapturing = False
                DOM.releaseCapture(self.getElement())
                if self.isHovering()  and  \
                   DOM.eventGetButton(event) == Event.BUTTON_LEFT:
                    self.onClick()

        elif event_type == "mousemove":
            if self.isCapturing:
                # Prevent dragging (on other browsers)
                DOM.eventPreventDefault(event)

        elif event_type == "mouseout":
            to = DOM.eventGetToElement(event)
            if (DOM.isOrHasChild(self.getElement(), DOM.eventGetTarget(event))
               and (to is None or not DOM.isOrHasChild(self.getElement(), to))):
                if self.isCapturing:
                    self.onClickCancel()
                self.setHovering(False)

        elif event_type == "mouseover":
            if DOM.isOrHasChild(self.getElement(), DOM.eventGetTarget(event)):
                self.setHovering(True)
                if self.isCapturing:
                    self.onClickStart()

        elif event_type == "blur":
            if self.isFocusing:
                self.isFocusing = False
                self.onClickCancel()

        elif event_type == "losecapture":
            if self.isCapturing:
                self.isCapturing = False
                self.onClickCancel()

        ButtonBase.onBrowserEvent(self, event)

        # Synthesize clicks based on keyboard events AFTER the normal
        # key handling.
        if (DOM.eventGetTypeInt(event) & Event.KEYEVENTS) == 0:
            return

        keyCode = DOM.eventGetKeyCode(event)
        if event_type == "keydown":
            if keyCode == ' ':
                self.isFocusing = True
                self.onClickStart()

        elif event_type == "keyup":
            if self.isFocusing  and  keyCode == ' ':
                self.isFocusing = False
                self.onClick()

        elif event_type == "keypress":
            if keyCode == '\n'  or  keyCode == '\r':
                self.onClickStart()
                self.onClick()
开发者ID:Afey,项目名称:pyjs,代码行数:86,代码来源:CustomButton.py

示例12: findItem

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
    def findItem(self, hItem):
        for item in self.items:
            if DOM.isOrHasChild(item.getElement(), hItem):
                return item

        return None
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:8,代码来源:MenuBar.py

示例13: _event_targets_control

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
 def _event_targets_control(self, event):
     target = DOM.eventGetTarget(event)
     return target and DOM.isOrHasChild(self.getElement(), target)
开发者ID:Afey,项目名称:pyjs,代码行数:5,代码来源:Control.py

示例14: isOrContains

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import isOrHasChild [as 别名]
 def isOrContains(self, parent, child):
     # While Safari 1.3.2 / Safari 2.0.4 support the 'contains' method on DOM
     # elements, the method does not appear to return valid results in all cases.
     # Revert to a DOM walk from DOM.isOrHasChild instead.
     return DOM.isOrHasChild(parent, child)
开发者ID:jaredly,项目名称:pyjamas,代码行数:7,代码来源:DOMUtilImplSafari.py


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