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


Python DOM.getStyleAttribute方法代码示例

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


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

示例1: getStyleAttribute

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getStyleAttribute [as 别名]
 def getStyleAttribute(self, attribute):
     """ can be called with two forms:
         getStyleAttribute(self, attr) - returns value
         getStyleAttribute(self, (attr1,attr2,...)) - returns dictionary of attr:value pairs
     """
     if isinstance(attribute, basestring):
         return DOM.getStyleAttribute(self.getElement(), attribute)
     # if attribute is not a string, assume it is iterable,
     # and return the multi-attribute form
     el = self.getElement()
     result = {}
     for attr in attribute:
         result[attr] = DOM.getStyleAttribute(el, attr)
     return result
开发者ID:luiseduardohdbackup,项目名称:pyjs,代码行数:16,代码来源:UIObject.py

示例2: identify

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getStyleAttribute [as 别名]
 def identify(self, element):
     if element.nodeType != 1:
         return False
     if str(string.lower(element.tagName)) != 'span':
         return False
     style = DOM.getStyleAttribute(element, "font-family")
     return style is not None
开发者ID:Afey,项目名称:pyjs,代码行数:9,代码来源:RichTextToolbar.py

示例3: setDragImage

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getStyleAttribute [as 别名]
 def setDragImage(self, element, x, y):
     position_absolute = DOM.getStyleAttribute(element,
                                 'position') == 'absolute'
     if position_absolute:
         self.dragLeftOffset = x + DOM.getAbsoluteLeft(
                 element.offsetParent)
         self.dragTopOffset = y + DOM.getAbsoluteTop(
                 element.offsetParent)
     else:
         self.dragLeftOffset = x
         self.dragTopOffset = y
     if element.tagName.lower().endswith('img'):
         src = DOM.getAttribute(element,'src')
         element = DOM.createElement('img')
         DOM.setAttribute(element, 'src', src)
     if not self.draggingImage:
         self.createDraggingImage(element)
     else:
         self.draggingImage.setImage(element)
开发者ID:Afey,项目名称:pyjs,代码行数:21,代码来源:DNDHelper.py

示例4: copyStyles

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getStyleAttribute [as 别名]
def copyStyles(elem1, elem2):
    """
    Copy styles from one element to another, like in
    http://efreedom.com/Question/1-1848445/Duplicating-Element-Style-JavaScript
    """
    element_style = getComputedStyle(elem1)
    if element_style:
        element_style = dict(element_style)
    else:
        return
    for style in element_style:
        try:
            value = element_style[style]
            if isinstance(value, str):
                if not style == 'cssText':
                    DOM.setStyleAttribute(elem2, style, value)
                    if value == 'font':
                        DOM.setStyleAttribute(elem2, 'fontSize',
                            DOM.getStyleAttribute(elem1, 'fontSize'))
        except:
            pass
开发者ID:anandology,项目名称:pyjamas,代码行数:23,代码来源:utils.py

示例5: WidgetLocation

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getStyleAttribute [as 别名]
            if info.initialDraggableParent instanceof AbsolutePanel:
                info.initialDraggableParentLocation = WidgetLocation(widget,
                info.initialDraggableParent)
             elif info.initialDraggableParent instanceof HorizontalPanel:
                info.initialDraggableIndex = ((HorizontalPanel) info.initialDraggableParent).getWidgetIndex(widget)
             elif info.initialDraggableParent instanceof VerticalPanel:
                info.initialDraggableIndex = ((VerticalPanel) info.initialDraggableParent).getWidgetIndex(widget)
             elif info.initialDraggableParent instanceof FlowPanel:
                info.initialDraggableIndex = ((FlowPanel) info.initialDraggableParent).getWidgetIndex(widget)
             elif info.initialDraggableParent instanceof SimplePanel:
                # save nothing
             else:
                raise RuntimeException(
                "Unable to handle 'initialDraggableParent instanceof "
                + GWT.getTypeName(info.initialDraggableParent)
                + "'; Please create your own DragController and override saveDraggableLocationAndStyle() and restoreDraggableLocation()")
            
            
            info.initialDraggableMargin = DOM.getStyleAttribute(widget.getElement(), "margin")
            DOM.setStyleAttribute(widget.getElement(), "margin", "0px")
            savedWidgetInfoMap.put(widget, info)
        
    
    
    def getIntersectDropController(self, x, y):
        DropController dropController = dropControllerCollection.getIntersectDropController(x, y)
        return dropController is not None ? dropController : boundaryDropController
    


开发者ID:jaredly,项目名称:pyjamas,代码行数:29,代码来源:PickupDragController.py

示例6: getStyleAttr

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getStyleAttribute [as 别名]
 def getStyleAttr(self, row, column, attr):
     elem = self.getElement(row, column)
     return DOM.getStyleAttribute(elem, attr)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:5,代码来源:CellFormatter.py

示例7: getTextAlignment

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getStyleAttribute [as 别名]
 def getTextAlignment(self, align):
     return DOM.getStyleAttribute(self.getElement(), "textAlign")
开发者ID:nielsonsantana,项目名称:pyjs,代码行数:4,代码来源:TextBoxBase.py

示例8: getWordWrap

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getStyleAttribute [as 别名]
 def getWordWrap(self):
     ws = DOM.getStyleAttribute(self.getElement(), "whiteSpace")
     return ws != "nowrap"
开发者ID:Afey,项目名称:pyjs,代码行数:5,代码来源:Label.py

示例9: getCellVerticalAlignment

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getStyleAttribute [as 别名]
 def getCellVerticalAlignment(self, widget):
     td = self.getWidgetTd(widget)
     if td is None:
         return None
     return DOM.getStyleAttribute(td, "verticalAlign")
开发者ID:Afey,项目名称:pyjs,代码行数:7,代码来源:CellPanel.py

示例10: getWordWrap

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getStyleAttribute [as 别名]
 def getWordWrap(self):
     return not (DOM.getStyleAttribute(self.getElement(), "whiteSpace") == "nowrap")
开发者ID:emk,项目名称:pyjamas,代码行数:4,代码来源:Label.py

示例11: onMouseMove

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getStyleAttribute [as 别名]
    def onMouseMove(self, sender, x, y):
        event = DOM.eventGetCurrentEvent()
        self.mouseEvent = event
        button = DOM.eventGetButton(event)
        if not button == Event.BUTTON_LEFT:
            return
## The following commented code lets the native dnd happen in IE. sucks.
## But it may enable dragging our widgets out of IE into other apps.
#        else:
#            try:
#                self.dragWidget.getElement().dragDrop()
#                return
#            except:
#                pass

        # Adjust x and y to absolute coordinates.
        x, y = eventCoordinates(event)

        if self.dragging == DRAGGING_NO_MOVEMENT_YET:
            self.origMouseX = x
            self.origMouseY = y
            self.currentDragOperation = 'none'
            fromElement = self.dragWidget.getElement()
            # Is the widget itself draggable?
            try:
                draggable = fromElement.draggable
            except:
                draggable = False
            # if not, find the draggable element at (x, y) in the widget
            if not draggable:
                fromElement = findDraggable(sender.getElement(),
                    self.origMouseX, self.origMouseY)
            # Nothing draggable found. return.
            if fromElement is None:
                self.dragging = NOT_DRAGGING
                return
            # Get the location for the dragging widget

            #self.absParent = None

                #self.absParent = self.dragWidget.getParent()
                #self.absLeft = DOM.getStyleAttribute(fromElement, 'left')

                #print self.absLeft
                #self.absTop = DOM.getStyleAttribute(fromElement, 'top')
                #print self.absTop
                #self.origTop = DOM.getAbsoluteTop(fromElement) + parent.getAbsoluteTop()
                #self.origLeft = DOM.getAbsoluteLeft(fromElement) + parent.getAbsoluteLeft()
            self.origTop = DOM.getAbsoluteTop(fromElement)
            self.origLeft = DOM.getAbsoluteLeft(fromElement)
            #self.glassTop = DOM.getAbsoluteTop(fromElement.offsetParent)
            #self.glassLeft = DOM.getAbsoluteTop(fromElement.offsetParent)
            position_absolute = DOM.getStyleAttribute(fromElement,
                                'position') == 'absolute'
            if position_absolute:
                self.dragLeftOffset = (self.origMouseX -
                                DOM.getAbsoluteLeft(fromElement.offsetParent))
                self.dragTopOffset = (self.origMouseY -
                                DOM.getAbsoluteTop(fromElement.offsetParent))
            else:
                self.dragLeftOffset = self.origMouseX - self.origLeft
                self.dragTopOffset = self.origMouseY - self.origTop

# self.setDragImage(fromElement,
#                             self.origMouseX - self.origLeft,
#                             self.origMouseY - self.origTop)
            self.dragDataStore.elements = [fromElement]
            dragStartEvent = self.fireDNDEvent('dragstart', None,
                                               self.dragWidget)
            if not isCanceled(dragStartEvent):
                self.initFeedbackImage()
                RootPanel().add(self.draggingImage)
                self.setDragImageLocation(x, y)
                self.dragging = ACTIVELY_DRAGGING
                GlassWidget.show(self)
        elif self.dragging == ACTIVELY_DRAGGING:
            try:
                doc().selection.empty()
            except:
                wnd().getSelection().removeAllRanges()

            self.setDragImageLocation(x, y)

            # If we are still working on the previous iteration, or if we have
            # done this recently, we'll wait for the next event.
            if self.dragBusy or time.time() - self.drag_time < 0.25:
                return

            self.doDrag(event, x, y)
            self.drag_time = time.time()
开发者ID:Afey,项目名称:pyjs,代码行数:92,代码来源:DNDHelper.py


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