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


Python DOM.getIntAttribute方法代码示例

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


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

示例1: moveControl

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
    def moveControl(self, mouse_x, mouse_y, first_move=False):
        handle_height = DOM.getIntAttribute(self.handle, "offsetHeight")
        widget_height = self.getOffsetHeight()
        height_range = widget_height - 10 # handle height is hard-coded
        relative_y = mouse_y - (handle_height / 2)
        if relative_y < 0:
            relative_y = 0
        if relative_y >= height_range:
            relative_y = height_range

        # turn round (bottom to top) for x
        relative_y = height_range - relative_y

        handle_width = DOM.getIntAttribute(self.handle, "offsetWidth")
        widget_width = self.getOffsetWidth()
        length_range = widget_width - 10 # handle width is hard-coded
        relative_x = mouse_x - (handle_width / 2)
        if relative_x < 0:
            relative_x = 0
        if relative_x >= length_range:
            relative_x = length_range

        val_diff_x = self.max_value_x - self.min_value_x
        new_value_x = ((val_diff_x * relative_x) / length_range) + \
                      self.min_value_x

        val_diff_y = self.max_value_y - self.min_value_y
        new_value_y = ((val_diff_y * relative_y) / height_range) + \
                      self.min_value_y

        new_value = [new_value_x, new_value_y]
        new_value = self.processValue(new_value)
        self.setControlPos(new_value)
        self.setValue(new_value)
开发者ID:anandology,项目名称:pyjamas,代码行数:36,代码来源:AreaSlider.py

示例2: onImagesLoaded

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
 def onImagesLoaded(self, imagesHandles):
     self.clock = imagesHandles[0]
     el = self.clock.getElement()
     self.width = DOM.getIntAttribute(el, "width")
     self.height = DOM.getIntAttribute(el, "height")
     self.setWidth("%d" % self.width)
     self.setHeight("%d" % self.height)
开发者ID:anandology,项目名称:pyjamas,代码行数:9,代码来源:Widgets.py

示例3: getIntProp

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
def getIntProp(obj, propertyName):
    """
    Reads an object's property as an integer value.

    @param object The object
    @param propertyName The name of the property being read
    @return The value
    """
    DOM.getIntAttribute(obj, propertyName)
开发者ID:luiseduardohdbackup,项目名称:pyjs,代码行数:11,代码来源:Range.py

示例4: isIn

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
def isIn(element, x, y):
    """
    Given an element and an absolute x and y, return True if the
    (x,y) coordinate is within the element. Otherwise, return False.
    """
    top = DOM.getAbsoluteTop(element)
    height = DOM.getIntAttribute(element, 'offsetHeight')
    if y >= top and y <= top + height:
        left = DOM.getAbsoluteLeft(element)
        width = DOM.getIntAttribute(element, 'offsetWidth')
        if x >= left and x <= left + width:
            return True
    return False
开发者ID:anandology,项目名称:pyjamas,代码行数:15,代码来源:utils.py

示例5: getTreeTop

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
    def getTreeTop(self):
        item = self
        ret = 0

        while item is not None:
            ret += DOM.getIntAttribute(item.getElement(), "offsetTop")
            item = item.getParentItem()

        return ret
开发者ID:anthonyrisinger,项目名称:translate-pyjs-org.appspot.com,代码行数:11,代码来源:TreeItem.py

示例6: moveFocus

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
    def moveFocus(self, selection):
        focusableWidget = selection.getFocusableWidget()
        if focusableWidget is not None:
            focusableWidget.setFocus(True)
            DOM.scrollIntoView(focusableWidget.getElement())
        else:
            selectedElem = selection.getContentElem()
            containerLeft = self.getAbsoluteLeft()
            containerTop = self.getAbsoluteTop()

            left = DOM.getAbsoluteLeft(selectedElem) - containerLeft
            top = DOM.getAbsoluteTop(selectedElem) - containerTop
            width = DOM.getIntAttribute(selectedElem, "offsetWidth")
            height = DOM.getIntAttribute(selectedElem, "offsetHeight")

            DOM.setIntStyleAttribute(self.focusable, "left", left)
            DOM.setIntStyleAttribute(self.focusable, "top", top)
            DOM.setIntStyleAttribute(self.focusable, "width", width)
            DOM.setIntStyleAttribute(self.focusable, "height", height)

            DOM.scrollIntoView(self.focusable)
            Focus.focus(self.focusable)
开发者ID:anandology,项目名称:pyjamas,代码行数:24,代码来源:Tree.py

示例7: drawImage

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
 def drawImage(self, img, *args):
     if isinstance(img, Widget):
         img_width = img.getWidth()
         img_height = img.getHeight()
     else:
         img_width = DOM.getIntAttribute(img, "offsetWidth")
         img_height = DOM.getIntAttribute(img, "offsetHeight")
     if len(args) == 8:
         self.impl.drawImage(img, *args)
     elif len(args) == 4:
         sourceX = 0
         sourceY = 0
         sourceWidth = img_width
         sourceHeight = img_height
         destX = args[0]
         destY = args[1]
         destWidth = args[2]
         destHeight = args[3]
         self.impl.drawImage(img, sourceX, sourceY,
                                  sourceWidth, sourceHeight,
                                  destX, destY, destWidth, destHeight)
     elif len(args) == 2:
         self.impl.drawImage(img, *args)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:25,代码来源:GWTCanvas.py

示例8: moveControl

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
    def moveControl(self, mouse_x, mouse_y, first_move=False):
        handle_width = DOM.getIntAttribute(self.handle, "offsetWidth")
        widget_width = self.getOffsetWidth()
        length_range = widget_width - 10 # handle width is hard-coded
        relative_x = mouse_x - (handle_width / 2)
        if relative_x < 0:
            relative_x = 0
        if relative_x >= length_range:
            relative_x = length_range

        val_diff = self.max_value - self.min_value
        new_value = ((val_diff * relative_x) / length_range) + self.min_value
        new_value = self.processValue(new_value)

        self.setControlPos(new_value)
        self.setValue(new_value)
开发者ID:Afey,项目名称:pyjs,代码行数:18,代码来源:HorizontalSlider.py

示例9: moveControl

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
    def moveControl(self, mouse_x, mouse_y, first_move=False):
        handle_height = DOM.getIntAttribute(self.handle, "offsetHeight")
        widget_height = self.getOffsetHeight()
        height_range = widget_height - 10 # handle height is hard-coded
        relative_y = mouse_y - (handle_height / 2)
        if relative_y < 0:
            relative_y = 0
        if relative_y >= height_range:
            relative_y = height_range

        relative_y = height_range - relative_y # turn round (bottom to top)

        val_diff = self.max_value - self.min_value
        new_value = ((val_diff * relative_y) / height_range) + self.min_value
        new_value = self.processValue(new_value)

        self.setControlPos(new_value)
        self.setValue(new_value)
开发者ID:Afey,项目名称:pyjs,代码行数:20,代码来源:VerticalSlider.py

示例10: getClientWidth

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
 def getClientWidth(self):
     return DOM.getIntAttribute(self.getElement(), "clientWidth")
开发者ID:luiseduardohdbackup,项目名称:pyjs,代码行数:4,代码来源:UIObject.py

示例11: getVisibleLength

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
 def getVisibleLength(self):
     return DOM.getIntAttribute(self.getElement(), "size")
开发者ID:anandology,项目名称:pyjamas,代码行数:4,代码来源:TextBox.py

示例12: getMaxLength

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
 def getMaxLength(self):
     return DOM.getIntAttribute(self.getElement(), "maxLength")
开发者ID:anandology,项目名称:pyjamas,代码行数:4,代码来源:TextBox.py

示例13: getPopupTop

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
 def getPopupTop(self):
     return DOM.getIntAttribute(self.getElement(), "offsetTop")
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:4,代码来源:PopupPanel.py

示例14: getPopupLeft

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
 def getPopupLeft(self):
     return DOM.getIntAttribute(self.getElement(), "offsetLeft")
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:4,代码来源:PopupPanel.py

示例15: getOffsetHeight

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getIntAttribute [as 别名]
 def getOffsetHeight(self, elem):
     """ Returns the offsetHeight element property.
     """
     return DOM.getIntAttribute(elem, "offsetHeight")
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:6,代码来源:splitpanel.py


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