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


Python DOM.setCapture方法代码示例

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


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

示例1: onMouseDown

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

示例2: show

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setCapture [as 别名]
    def show(self):
        if self.showing:
            return

        self.showing = True

        self.showGlass()

        DOM.addEventPreview(self)

        RootPanel().add(self)
        self.onShowImpl(self.getElement())
        DOM.setCapture(self.getElement())
开发者ID:Afey,项目名称:pyjs,代码行数:15,代码来源:GlassWidget.py

示例3: onBrowserEvent

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

示例4: onMouseDown

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setCapture [as 别名]
 def onMouseDown(self, sender, x, y):
     self.dragging = True
     DOM.setCapture(self.caption.getElement())
     self.dragStartX = x
     self.dragStartY = y
开发者ID:nielsonsantana,项目名称:emath,代码行数:7,代码来源:PopupPagina.py

示例5: onBrowserEvent

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

示例6: onMouseDown

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setCapture [as 别名]
 def onMouseDown(self, sender, x, y):
     self.dragging = True
     DOM.setCapture(self.getElement())
     self.moveSlider(y)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:6,代码来源:Controls.py


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