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


Python DOM.sinkEvents方法代码示例

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


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

示例1: sinkEvents

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
 def sinkEvents(self, eventBitsToAdd):
     """Request that the given events be delivered to the event handler for this
     element.  The event bits passed are added (using inclusive OR) to the events
     already "sunk" for the element associated with the UIObject.  The event bits
     are a combination of values from class L{Event}."""
     if self.element:
         DOM.sinkEvents(self.getElement(), eventBitsToAdd | DOM.getEventsSunk(self.getElement()))
开发者ID:andreyvit,项目名称:pyjamas,代码行数:9,代码来源:UIObject.py

示例2: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
    def __init__(self, **ka):
        ka['StyleName'] = ka.get('StyleName', "gwt-Tree")

        self.root = None
        self.childWidgets = Set()
        self.curSelection = None
        self.focusable = None
        self.focusListeners = []
        self.mouseListeners = []
        self.imageBase = pygwt.getModuleBaseURL()
        self.keyboardListeners = []
        self.listeners = []
        self.lastEventType = ""

        element = ka.pop('Element', None) or DOM.createDiv()
        self.setElement(element)
        DOM.setStyleAttribute(self.getElement(), "position", "relative")
        self.focusable = Focus.createFocusable()
        # Hide focus outline in Mozilla/Webkit/Opera
        DOM.setStyleAttribute(self.focusable, "outline", "0px")
        # Hide focus outline in IE 6/7
        DOM.setElemAttribute(self.focusable, "hideFocus", "true");

        DOM.setStyleAttribute(self.focusable, "fontSize", "0")
        DOM.setStyleAttribute(self.focusable, "position", "absolute")
        DOM.setIntStyleAttribute(self.focusable, "zIndex", -1)
        DOM.appendChild(self.getElement(), self.focusable)

        self.root = RootTreeItem()
        self.root.setTree(self)

        Widget.__init__(self, **ka)

        self.sinkEvents(Event.ONMOUSEDOWN | Event.ONCLICK | Event.KEYEVENTS)
        DOM.sinkEvents(self.focusable, Event.FOCUSEVENTS)
开发者ID:anandology,项目名称:pyjamas,代码行数:37,代码来源:Tree.py

示例3: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
    def __init__(self, width=0, height=0):
        Widget.__init__(self)
        self.context = None
        
        self.setElement(DOM.createDiv())
        canvas = DOM.createElement("canvas")
        self.setWidth(width)
        self.setHeight(height)
        
        canvas.width=width
        canvas.height=height
        
        DOM.appendChild(self.getElement(), canvas)
        self.setStyleName("gwt-Canvas")
        
        self.init()
        
        self.context.fillStyle = "black"
        self.context.strokeStyle = "black"

        self.focusable = None
        self.focusable = Focus.createFocusable()
        
        self.focusListeners = []
        self.clickListeners = []
        self.mouseListeners = []
        self.keyboardListeners = []
        
        DOM.appendChild(self.getElement(), self.focusable)
        DOM.sinkEvents(canvas, Event.ONCLICK | Event.MOUSEEVENTS | DOM.getEventsSunk(canvas))
        DOM.sinkEvents(self.focusable, Event.FOCUSEVENTS | Event.KEYEVENTS)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:33,代码来源:Canvas2D.py

示例4: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
    def __init__(self, **kwargs):
        self.body = None
        self.visibleStack = -1
        self.indices = {}

        if kwargs.has_key('Element'):
            table = kwargs.pop('Element')
            fc = DOM.getFirstChild(table)
            if fc:
                self.body = fc
            else:
                self.body = DOM.createTBody()
                DOM.appendChild(table, self.body)
        else:
            table = DOM.createTable()
            self.body = DOM.createTBody()
            DOM.appendChild(table, self.body)

        self.setElement(table)

        if not kwargs.has_key('Spacing'): kwargs['Spacing'] = 0
        if not kwargs.has_key('Padding'): kwargs['Padding'] = 0
        if not kwargs.has_key('StyleName'): kwargs['StyleName'] = "gwt-StackPanel"

        DOM.sinkEvents(table, Event.ONCLICK)

        ComplexPanel.__init__(self, **kwargs)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:29,代码来源:StackPanel.py

示例5: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
    def __init__(self, **kwargs):
        self.visibleStack = -1
        self.indices = {}
        self.stackListeners = []

        kwargs['StyleName'] = kwargs.get('StyleName', "gwt-StackPanel")

        CellPanel.__init__(self, **kwargs)
        DOM.sinkEvents(self.getElement(), Event.ONCLICK)
开发者ID:Afey,项目名称:pyjs,代码行数:11,代码来源:StackPanel.py

示例6: prepareImage

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
 def prepareImage(self, url):
     img = Image()
     img.__isLoaded = False
     img.addLoadListener(self)
     # normally, event listeners are only set up when the widget
     # is attached to part of the DOM (see Widget.onAttach).  but,
     # in this case, we want a load even _even though_ the Image
     # widget is not yet attached (and quite likely won't be).
     DOM.setEventListener(img.getElement(), img)
     DOM.sinkEvents(img.getElement(), Event.ONLOAD)
     return img
开发者ID:audreyr,项目名称:pyjs,代码行数:13,代码来源:ImageLoader.py

示例7: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
   def __init__(self):
      self.canvas = GWTCanvas(coordX = 400, coordY= 400, pixelX = 400, pixelY = 400)
      self.canvas.addStyleName("gwt-canvas")
      DOM.sinkEvents(self.canvas.getElement(), Event.MOUSEEVENTS)
      #DOM.setEventListener(self.canvas.getElement(), self)

      self.canvas.setFillStyle(Color.Color(255, 0, 0))
      self.canvas.fillRect(4,4,10,10)

      self._dragging = False
      #Register for canvas mouse events


      RootPanel().add(self.canvas)
开发者ID:ASayre,项目名称:UCSBsketch,代码行数:16,代码来源:tester.py

示例8: initElement

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
    def initElement(self, element, **ka):
        self.inputElem = element
        self.labelElem = DOM.createLabel()
        element = ka.pop("Element", None) or DOM.createSpan()
        ButtonBase.__init__(self, element, **ka)

        self.unsinkEvents(Event.FOCUSEVENTS | Event.ONCLICK)
        DOM.sinkEvents(self.inputElem, Event.FOCUSEVENTS | Event.ONCLICK | DOM.getEventsSunk(self.inputElem))

        DOM.appendChild(self.getElement(), self.inputElem)
        DOM.appendChild(self.getElement(), self.labelElem)

        uid = "check%d" % self.getUniqueID()
        DOM.setAttribute(self.inputElem, "id", uid)
        DOM.setAttribute(self.labelElem, "htmlFor", uid)
开发者ID:anandology,项目名称:pyjamas,代码行数:17,代码来源:CheckBox.py

示例9: initElement

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
    def initElement(self, element, **kwargs):
        self.inputElem = element
        self.labelElem = DOM.createLabel()
        if kwargs.has_key('Element'):
            element = kwargs.pop('Element')
        else:
            element = DOM.createSpan()
        ButtonBase.__init__(self, element, **kwargs)

        self.unsinkEvents(Event.FOCUSEVENTS| Event.ONCLICK)
        DOM.sinkEvents(self.inputElem, Event.FOCUSEVENTS | Event.ONCLICK | DOM.getEventsSunk(self.inputElem))

        DOM.appendChild(self.getElement(), self.inputElem)
        DOM.appendChild(self.getElement(), self.labelElem)

        uid = "check%d" % self.getUniqueID()
        DOM.setAttribute(self.inputElem, "id", uid)
        DOM.setAttribute(self.labelElem, "htmlFor", uid)
开发者ID:certik,项目名称:pyjamas,代码行数:20,代码来源:CheckBox.py

示例10: __init__

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
   def __init__(self):
      self._dragging = False
      Canvas.__init__(self, Width=WIDTH, Height=HEIGHT)
      canvasElement = self.getElement()
      #Register for canvas mouse events
      self._proc = Processing(DOM.getFirstChild(canvasElement))
      self._proc.setup = (lambda: self.setup_proc())
      self._proc.draw = None
      self._proc.init()

      DOM.sinkEvents(canvasElement, Event.MOUSEEVENTS)
      DOM.setEventListener(canvasElement, self)

      self._currentPointList = []

      self._x = None
      self._y = None

      self._callback_Redraw = None
      self._callback_AddStroke = None
      self._callback_DeleteStroke = None
开发者ID:ASayre,项目名称:UCSBsketch,代码行数:23,代码来源:PyjSketchGUI.py

示例11: hookEvents

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
 def hookEvents(self):
     print self, "hook events"
     DOM.sinkEvents(self.elem, Event.MOUSEEVENTS | Event.KEYEVENTS |
                    Event.ONCHANGE | Event.ONCLICK | Event.FOCUSEVENTS)
开发者ID:Afey,项目名称:pyjs,代码行数:6,代码来源:RichTextAreaImpl.py

示例12: sinkEvents

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import sinkEvents [as 别名]
 def sinkEvents(self, eventBitsToAdd):
     """ Unlike other widgets the CheckBox sinks on its inputElement,
         not its wrapper
     """
     eventBitsToAdd |= DOM.getEventsSunk(self.inputElem)
     DOM.sinkEvents(self.inputElem, eventBitsToAdd)
开发者ID:Afey,项目名称:pyjs,代码行数:8,代码来源:CheckBox.py


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