Пример #1
0
def getProperty(obj, propertyName):
    """
    Reads an object given a property and returns it as a JavaScriptObject

    @param object
    @param propertyName
    @return the object
    """
    DOM.getAttribute(obj, propertyName)
Пример #2
0
def getProperty(obj, propertyName):
    """
    Reads an object given a property and returns it as a JavaScriptObject

    @param object
    @param propertyName
    @return the object
    """
    DOM.getAttribute(obj, propertyName)
Пример #3
0
def pygwt_processMetas():
    from pyjamas import DOM
    metas = doc().getElementsByTagName("meta")
    for i in range(metas.length):
        meta = metas.item(i)
        name = DOM.getAttribute(meta, "name")
        if name == "pygwt:module":
            content = DOM.getAttribute(meta, "content")
            if content:
                pygwt_moduleNames.append(content)
    return pygwt_moduleNames
Пример #4
0
def pygwt_processMetas():
    from pyjamas import DOM
    metas = doc().getElementsByTagName("meta")
    for i in range(metas.length):
        meta = metas.item(i)
        name = DOM.getAttribute(meta, "name")
        if name == "pygwt:module":
            content = DOM.getAttribute(meta, "content")
            if content:
                pygwt_moduleNames.append(content)
    return pygwt_moduleNames
Пример #5
0
def createWidgetOnElement(element):
    fc = DOM.getAttribute(element, 'id')
    lbr = fc.find("(")
    klsname = fc[:lbr]
    txtargs = fc[lbr+1:-1]
    args = []
    kwargs = {}
    for arg in txtargs.split(','):
        findeq = arg.find('=')
        if findeq == -1:
            args.append(arg)
        else:
            k = arg[:findeq]
            v = arg[findeq+1:]
            if ((v[0] == "'" and v[-1] == "'") or
                (v[0] == '"' and v[-1] == '"')):
                # string - strip quotes
                v = v[1:-1]
            else:
                # assume it's an int
                v = int(v)
            kwargs[k] = v

    kwargs['Element'] = element
    return lookupClass(klsname)(*args, **kwargs)
Пример #6
0
 def identify(self, element):
     if element.nodeType != 1:
         return False
     if str(string.lower(element.tagName)) != 'span':
         return False
     style = DOM.getAttribute(element, "className")
     return style and style.startswith("editor-")
Пример #7
0
def setStyleName(element, style, add):

    oldStyle = DOM.getAttribute(element, "className")
    if oldStyle is None:
        oldStyle = ""
    idx = oldStyle.find(style)

    # Calculate matching index
    lastPos = len(oldStyle)
    while idx != -1:
        if idx == 0 or (oldStyle[idx - 1] == " "):
            last = idx + len(style)
            if (last == lastPos) or ((last < lastPos) and (oldStyle[last] == " ")):
                break
        idx = oldStyle.find(style, idx + 1)

    if add:
        if idx == -1:
            DOM.setAttribute(element, "className", oldStyle + " " + style)
    else:
        if idx != -1:
            if idx == 0:
              begin = ''
            else:
              begin = oldStyle[:idx-1]
            end = oldStyle[idx + len(style):]
            DOM.setAttribute(element, "className", begin + end)
Пример #8
0
def createWidgetOnElement(element):
    fc = DOM.getAttribute(element, 'id')
    lbr = fc.find("(")
    klsname = fc[:lbr]
    txtargs = fc[lbr + 1:-1]
    args = []
    kwargs = {}
    for arg in txtargs.split(','):
        findeq = arg.find('=')
        if findeq == -1:
            args.append(arg)
        else:
            k = arg[:findeq]
            v = arg[findeq + 1:]
            if ((v[0] == "'" and v[-1] == "'")
                    or (v[0] == '"' and v[-1] == '"')):
                # string - strip quotes
                v = v[1:-1]
            else:
                # assume it's an int
                v = int(v)
            kwargs[k] = v

    kwargs['Element'] = element
    return lookupClass(klsname)(*args, **kwargs)
Пример #9
0
def setStyleName(element, style, add):

    oldStyle = DOM.getAttribute(element, "className")
    if oldStyle is None:
        oldStyle = ""
    idx = oldStyle.find(style)

    # Calculate matching index
    lastPos = len(oldStyle)
    while idx != -1:
        if idx == 0 or (oldStyle[idx - 1] == " "):
            last = idx + len(style)
            if (last == lastPos) or ((last < lastPos) and
                                     (oldStyle[last] == " ")):
                break
        idx = oldStyle.find(style, idx + 1)

    if add:
        if idx == -1:
            DOM.setAttribute(element, "className", oldStyle + " " + style)
    else:
        if idx != -1:
            if idx == 0:
                begin = ''
            else:
                begin = oldStyle[:idx - 1]
            end = oldStyle[idx + len(style):]
            DOM.setAttribute(element, "className", begin + end)
Пример #10
0
 def identify(self, element):
     if element.nodeType != 1:
         return False
     if str(string.lower(element.tagName)) != 'span':
         return False
     style = DOM.getAttribute(element, "className")
     return style and style.startswith("editor-")
    def drawImage(self, img, *args):
        # create an image element:
        # <image xlink:href="firefox.jpg" x="0" y="0" height="50px" width="50px"/>
        # The way to do this is to create a clipping container and place the image inside that,
        # using scaling and positioning to approximate some of the effect of sourceXY and destXY
        # for now, we ignore all this
        #
        # get the image size and URL - image may be a Image Widget or an <img> Element
        if isinstance(img, Widget):     # Image widget
            img_elem = img.getElement()
            url = img.getUrl()
        else:   # <img> element
            img_elem = img
            url = DOM.getAttribute(img, "src")
        # determine all parms
        sourceXY = None
        sourceWH = None
        destXY = None
        destWH = None
        # get the parms that are specified
        if len(args) == 8:  # all parms specified
            sourceXY = (args[0], args[1])
            sourceWH = (args[2], args[3])
            destXY = (args[4], args[5])
            destWH = (args[6], args[7])
        elif len(args) == 4:    # only destXY and destWH are specified
            destXY = (args[0], args[1])
            destWH = (args[2], args[3])
        elif len(args) == 2:    # we just get destXY
            destXY = (args[0], args[1])
            # by default we keep the same size
            destWH = (img_elem.width, img_elem.height)
        else:
            raise TypeError("Wrong number of arguments for SVGCanvas.drawImage")

        # sourceWH and destWH determine the scaling
        # sourceXY and scaling determine where to place the image inside the clipping container
        # destXY determines where to place the clipping container

        # for now just create an SVG image element:
        # <image xlink:href="firefox.jpg" x="0" y="0" height="50px" width="50px"/>
#        print 'Create: <image xlink:href="'+url+'" x="'+str(destXY[0])+'" y="'+str(destXY[1])+'" height="'+str(destWH[1])+'px" width="'+str(destWH[0])+'px"/>'
        image = self._createElementSVG("image")
        # set the URL
        image.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", url); 
        # set the pos/dimensions
        DOM.setElemAttribute(image, "x", str(int(destXY[0])))
        DOM.setElemAttribute(image, "y", str(int(destXY[1])))
        DOM.setElemAttribute(image, "width", str(int(destWH[0])))
        DOM.setElemAttribute(image, "height", str(int(destWH[1])))
        # add the element to the canvas
        self._addElementSVG(image)
Пример #12
0
    def getEventTargetCell(self, event):
        td = DOM.eventGetTarget(event)
        while td is not None:
            if DOM.getAttribute(td, "tagName").lower() == "td":
                tr = DOM.getParent(td)
                body = DOM.getParent(tr)
                if DOM.compare(body, self.bodyElem):
                    return td
            if DOM.compare(td, self.bodyElem):
                return None
            td = DOM.getParent(td)

        return None
Пример #13
0
    def getEventTargetCell(self, event):
        td = DOM.eventGetTarget(event)
        while td is not None:
            if DOM.getAttribute(td, "tagName").lower() == "td":
                tr = DOM.getParent(td)
                body = DOM.getParent(tr)
                if DOM.compare(body, self.bodyElem):
                    return td
            if DOM.compare(td, self.bodyElem):
                return None
            td = DOM.getParent(td)

        return None
Пример #14
0
def getElementById(element, id):
    try:
        element_id = DOM.getAttribute(element, "id")
    except:
        element_id = None
    if element_id is not None and element_id == id:
        return element

    child = DOM.getFirstChild(element)
    while child is not None:
        ret = getElementById(child, id)
        if ret is not None:
            return ret
        child = DOM.getNextSibling(child)

    return None
Пример #15
0
def getElementById(element, id):
    try:
        element_id = DOM.getAttribute(element, "id")
    except:
        element_id = None
    if element_id is not None and element_id == id:
        return element

    child = DOM.getFirstChild(element)
    while child is not None:
        ret = getElementById(child, id)
        if ret is not None:
            return ret
        child = DOM.getNextSibling(child)

    return None
Пример #16
0
def findStyleName(element, style):

    oldStyle = DOM.getAttribute(element, "className")
    if oldStyle is None:
        return -1
    idx = oldStyle.find(style)

    # Calculate matching index
    lastPos = len(oldStyle)
    while idx != -1:
        if idx == 0 or (oldStyle[idx - 1] == " "):
            last = idx + len(style)
            if (last == lastPos) or ((last < lastPos) and (oldStyle[last] == " ")):
                break
        idx = oldStyle.find(style, idx + 1)

    return idx
Пример #17
0
 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)
Пример #18
0
def findStyleName(element, style):

    oldStyle = DOM.getAttribute(element, "className")
    if oldStyle is None:
        return -1
    idx = oldStyle.find(style)

    # Calculate matching index
    lastPos = len(oldStyle)
    while idx != -1:
        if idx == 0 or (oldStyle[idx - 1] == " "):
            last = idx + len(style)
            if (last == lastPos) or ((last < lastPos) and \
                                     (oldStyle[last] == " ")):
                break
        idx = oldStyle.find(style, idx + 1)

    return idx
Пример #19
0
 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)
Пример #20
0
 def onDragStart(self, event):
     dt = event.dataTransfer
     target = DOM.eventGetTarget(event)
     target = Widget(Element=target)
     try:
         id = target.getID()
     except:
         id = ''
     if id == 'datadrag0':
         dt.setData('text/plain', 'Hello World!')
     elif id == 'datadrag1':
         logo = doc().getElementById('logo')
         logo_parent_element = DOM.getParent(logo)
         text = DOM.getInnerText(logo_parent_element)
         html = DOM.getInnerHTML(logo_parent_element)
         uri = DOM.getAttribute(logo, 'src')
         dt.setData('text/plain', text)
         dt.setData('text/html', html)
         dt.setData('text/uri-list', uri)
     elif id == 'datadrag2':
         dt.setData('x-star-trek/tribble', 'I am a tribble')
Пример #21
0
 def onDragStart(self, event):
     dt = event.dataTransfer
     target = DOM.eventGetTarget(event)
     target = Widget(Element=target)
     try:
         id = target.getID()
     except:
         id = ''
     if id == 'datadrag0':
         dt.setData('text/plain', 'Hello World!')
     elif id == 'datadrag1':
         logo = doc().getElementById('logo')
         logo_parent_element = DOM.getParent(logo)
         text = DOM.getInnerText(logo_parent_element)
         html = DOM.getInnerHTML(logo_parent_element)
         uri = DOM.getAttribute(logo, 'src')
         dt.setData('text/plain', text)
         dt.setData('text/html', html)
         dt.setData('text/uri-list', uri)
     elif id == 'datadrag2':
         dt.setData('x-star-trek/tribble', 'I am a tribble')
Пример #22
0
def setStyleName(element, style, add):

    oldStyle = DOM.getAttribute(element, "className")
    if oldStyle is None:
        oldStyle = ""

    idx = findStyleName(element, style)

    if add:
        if idx == -1:
            DOM.setAttribute(element, "className", oldStyle + " " + style)
        return

    if idx == -1:
        return

    if idx == 0:
      begin = ''
    else:
      begin = oldStyle[:idx-1]

    end = oldStyle[idx + len(style):]
    DOM.setAttribute(element, "className", begin + end)
Пример #23
0
def setStyleName(element, style, add):

    oldStyle = DOM.getAttribute(element, "className")
    if oldStyle is None:
        oldStyle = ""

    idx = findStyleName(element, style)

    if add:
        if idx == -1:
            DOM.setAttribute(element, "className", oldStyle + " " + style)
        return

    if idx == -1:
        return

    if idx == 0:
        begin = ''
    else:
        begin = oldStyle[:idx - 1]

    end = oldStyle[idx + len(style):]
    DOM.setAttribute(element, "className", begin + end)
Пример #24
0
 def getStyleName(self, row, column):
     return DOM.getAttribute(self.getElement(row, column), "className")
Пример #25
0
 def getStyleName(self):
     return DOM.getAttribute(self.element, "className")
Пример #26
0
 def getMin(self):
     return DOM.getAttribute(self.getElement(), "min")
Пример #27
0
 def getAttr(self, row, column, attr):
     elem = self.getElement(row, column)
     return DOM.getAttribute(elem, attr)
Пример #28
0
    def drawImage(self, img, *args):

        if isinstance(img, Widget):
            img = img.getElement()
        fullWidth = img.width
        fullHeight = img.height

        if len(args) == 8:
            sourceX = args[0]
            sourceY = args[1]
            sourceWidth = args[2]
            sourceHeight = args[3]
            destX = args[4]
            destY = args[5]
            destWidth = args[6]
            destHeight = args[7]
        elif len(args) == 4:
            sourceX = 0
            sourceY = 0
            sourceWidth = fullWidth
            sourceHeight = fullHeight
            destX = args[0]
            destY = args[1]
            destWidth = args[2]
            destHeight = args[3]
        elif len(args) == 2:
            sourceX = 0
            sourceY = 0
            sourceWidth = fullWidth
            sourceHeight = fullHeight
            destX = args[0]
            destY = args[1]
            destWidth = fullWidth
            destHeight = fullHeight

        vmlStr = []  # JSOStack.getScratchArray()

        vmlStr.append("<v:group style=\"position:absolute;width:10;height:10;")
        dX = self.getCoordX(self.matrix, destX, destY)
        dY = self.getCoordY(self.matrix, destX, destY)

        # If we have a transformation matrix with rotation/scale, we
        # apply a filter
        if self.context.matrix[0] != 1 or self.context.matrix[1] != 0:

            # We create a padding bounding box to prevent clipping.
            vmlStr.append("padding-right:")
            vmlStr.append(str(self.parentWidth) + "px;")
            vmlStr.append("padding-bottom:")
            vmlStr.append(str(self.parentHeight) + "px;")
            vmlStr.append(
                "filter:progid:DXImageTransform.Microsoft.Matrix(M11='")
            vmlStr.append("" + str(self.matrix[0]))
            vmlStr.append("',")
            vmlStr.append("M12='")
            vmlStr.append("" + str(self.matrix[1]))
            vmlStr.append("',")
            vmlStr.append("M21='")
            vmlStr.append(str(self.matrix[3]))
            vmlStr.append("',")
            vmlStr.append("M22='")
            vmlStr.append(str(self.matrix[4]))
            vmlStr.append("',")
            vmlStr.append("Dx='")
            vmlStr.append(str(math.floor(((dX / 10)))))
            vmlStr.append("',")
            vmlStr.append("Dy='")
            vmlStr.append(str(math.floor(((dY / 10)))))
            vmlStr.append("', SizingMethod='clip');")

        else:
            vmlStr.append("left:")
            vmlStr.append("%dpx;" % int(dX / 10))
            vmlStr.append("top:")
            vmlStr.append("%dpx" % int(dY / 10))

        vmlStr.append(
            "\" coordsize=\"100,100\" coordorigin=\"0,0\"><v:image src=\"")
        vmlStr.append(DOM.getAttribute(img, "src"))
        vmlStr.append("\" style=\"")

        vmlStr.append("width:")
        vmlStr.append(str(int(destWidth * 10)))
        vmlStr.append(";height:")
        vmlStr.append(str(int(destHeight * 10)))
        vmlStr.append(";\" cropleft=\"")
        vmlStr.append(str(sourceX / fullWidth))
        vmlStr.append("\" croptop=\"")
        vmlStr.append(str(sourceY / fullHeight))
        vmlStr.append("\" cropright=\"")
        vmlStr.append(str((fullWidth - sourceX - sourceWidth) / fullWidth))
        vmlStr.append("\" cropbottom=\"")
        vmlStr.append(str((fullHeight - sourceY - sourceHeight) / fullHeight))
        vmlStr.append("\"/></v:group>")

        self.insert("BeforeEnd", ''.join(vmlStr))
Пример #29
0
 def getPlaceholder(self):
     return DOM.getAttribute(self.getElement(), "placeholder")
Пример #30
0
 def getKind(self):
     return DOM.getAttribute(self.getElement(), "type")
Пример #31
0
 def getDefaultValue(self):
     return DOM.getAttribute(self.getElement(), "defaultValue")
Пример #32
0
 def getText(self):
     return DOM.getAttribute(self.getElement(), "value")
Пример #33
0
 def getStyleName(self):
     return DOM.getAttribute(self.element, "className")
Пример #34
0
 def getUrl(self):
     return DOM.getAttribute(self.getElement(), "src")
Пример #35
0
 def getFilename(self):
     return DOM.getAttribute(self.getElement(), "value")
Пример #36
0
 def getAttr(self, row, column, attr):
     elem = self.getElement(row, column)
     return DOM.getAttribute(elem, attr)
Пример #37
0
 def getTitle(self):
     return DOM.getAttribute(self.element, "title")
 def getStyleName(self, row):
     return DOM.getAttribute(self.getElement(row), "className")
Пример #39
0
 def getID(self):
     """Get the id attribute of the associated DOM element."""
     return DOM.getAttribute(self.getElement(), "id")
Пример #40
0
    def drawImage(self, img, *args):
        """
        Draws an input image at a given position on the canvas. Resizes image
        according to specified width and height and samples from the specified
        sourceY and sourceX.

        We recommend that the pixel and coordinate spaces be the same to provide
        consistent positioning and scaling results

        option 1:
        @param img the image to be drawn
        @param destX x coord of the top left corner in the destination space
        @param destY y coord of the top left corner in the destination space

        option 2:
        @param img The image to be drawn
        @param destX x coord of the top left corner in the destination space
        @param destY y coord of the top left corner in the destination space
        @param destWidth the width of drawn image in the destination
        @param destHeight the height of the drawn image in the destination

        option 3:
        @param img the image to be drawn
        @param sourceX the start X position in the source image
        @param sourceY the start Y position in the source image
        @param sourceWidth the width in the source image you want to sample
        @param sourceHeight the height in the source image you want to sample
        @param destX x coord of the top left corner in the destination space
        @param destY y coord of the top left corner in the destination space
        @param destWidth the width of drawn image in the destination
        @param destHeight the height of the drawn image in the destination
        """
        # create an image element:
        # <image xlink:href="firefox.jpg" x="0" y="0" height="50px" width="50px"/>
        # The way to do this is to create a clipping container and place the image inside that,
        # using scaling and positioning to approximate some of the effect of sourceXY and destXY
        # for now, we ignore all this
        #
        # get the image size and URL - image may be a Image Widget or an <img> Element
        if isinstance(img, Widget):     # Image widget
            img_elem = img.getElement()
            url = img.getUrl()
        else:   # <img> element
            img_elem = img
            url = DOM.getAttribute(img, "src")
        # determine all parms
        sourceXY = None
        sourceWH = None
        destXY = None
        destWH = None
        # get the parms that are specified
        if len(args) == 8:  # all parms specified
            sourceXY = (args[0], args[1])
            sourceWH = (args[2], args[3])
            destXY = (args[4], args[5])
            destWH = (args[6], args[7])
        elif len(args) == 4:    # only destXY and destWH are specified
            destXY = (args[0], args[1])
            destWH = (args[2], args[3])
        elif len(args) == 2:    # we just get destXY
            destXY = (args[0], args[1])
            # by default we keep the same size
            destWH = (img_elem.width, img_elem.height)
        else:
            raise TypeError("Wrong number of arguments for SVGCanvas.drawImage")

        # sourceWH and destWH determine the scaling
        # sourceXY and scaling determine where to place the image inside the clipping container
        # destXY determines where to place the clipping container

        # for now just create an SVG image element:
        # <image xlink:href="firefox.jpg" x="0" y="0" height="50px" width="50px"/>
#        print 'Create: <image xlink:href="'+url+'" x="'+str(destXY[0])+'" y="'+str(destXY[1])+'" height="'+str(destWH[1])+'px" width="'+str(destWH[0])+'px"/>'
        image = self._createElementSVG("image")
        # set the URL
        image.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", url);
        # set the pos/dimensions
        DOM.setElemAttribute(image, "x", str(int(destXY[0])))
        DOM.setElemAttribute(image, "y", str(int(destXY[1])))
        DOM.setElemAttribute(image, "width", str(int(destWH[0])))
        DOM.setElemAttribute(image, "height", str(int(destWH[1])))
        # add the element to the canvas
        self._addElementSVG(image)
Пример #41
0
 def getTitle(self):
     return DOM.getAttribute(self.element, "title")
Пример #42
0
 def getMax(self):
     return DOM.getAttribute(self.getElement(), "max")
Пример #43
0
 def getSrc(self):
     return DOM.getAttribute(self.getElement(), 'src')
Пример #44
0
 def getText(self):
     return DOM.getAttribute(self.getElement(), "value")
Пример #45
0
 def getName(self):
     return DOM.getAttribute(self.inputElem, "name")
Пример #46
0
 def getAction(self):
     return DOM.getAttribute(self.getElement(), "action")
Пример #47
0
 def getStep(self):
     return DOM.getAttribute(self.getElement(), "step")
Пример #48
0
 def getStep(self):
     return DOM.getAttribute(self.getElement(), "step")
Пример #49
0
 def getName(self):
     return DOM.getAttribute(self.getElement(), "name")
    def getValue(self, index):
        self.checkIndex(index)

        option = DOM.getChild(self.getElement(), index)
        return DOM.getAttribute(option, "value")
Пример #51
0
    def drawImage(self, img, *args):

        if isinstance(img, Widget):
            img = img.getElement()
        fullWidth = img.width
        fullHeight = img.height

        if len(args) == 8:
            sourceX = args[0]
            sourceY = args[1]
            sourceWidth = args[2]
            sourceHeight = args[3]
            destX = args[4]
            destY = args[5]
            destWidth = args[6]
            destHeight = args[7]
        elif len(args) == 4:
            sourceX = 0
            sourceY = 0
            sourceWidth = fullWidth
            sourceHeight = fullHeight
            destX = args[0]
            destY = args[1]
            destWidth = args[2]
            destHeight = args[3]
        elif len(args) == 2:
            sourceX = 0
            sourceY = 0
            sourceWidth = fullWidth
            sourceHeight = fullHeight
            destX = args[0]
            destY = args[1]
            destWidth = fullWidth
            destHeight = fullHeight

        vmlStr = [] # JSOStack.getScratchArray()

        vmlStr.append("<v:group style=\"position:absolute;width:10;height:10;")
        dX = self.getCoordX(self.matrix, destX, destY)
        dY = self.getCoordY(self.matrix, destX, destY)

        # If we have a transformation matrix with rotation/scale, we
        # apply a filter
        if self.context.matrix[0] != 1  or  self.context.matrix[1] != 0:

            # We create a padding bounding box to prevent clipping.
            vmlStr.append("padding-right:")
            vmlStr.append(str(self.parentWidth) + "px;")
            vmlStr.append("padding-bottom:")
            vmlStr.append(str(self.parentHeight) + "px;")
            vmlStr.append("filter:progid:DXImageTransform.Microsoft.Matrix(M11='")
            vmlStr.append("" + str(self.matrix[0]))
            vmlStr.append("',")
            vmlStr.append("M12='")
            vmlStr.append("" + str(self.matrix[1]))
            vmlStr.append("',")
            vmlStr.append("M21='")
            vmlStr.append(str(self.matrix[3]))
            vmlStr.append("',")
            vmlStr.append("M22='")
            vmlStr.append(str(self.matrix[4]))
            vmlStr.append("',")
            vmlStr.append("Dx='")
            vmlStr.append(str(math.floor(((dX / 10)))))
            vmlStr.append("',")
            vmlStr.append("Dy='")
            vmlStr.append(str(math.floor(((dY / 10)))))
            vmlStr.append("', SizingMethod='clip');")

        else:
            vmlStr.append("left:")
            vmlStr.append("%dpx;" % int(dX / 10))
            vmlStr.append("top:")
            vmlStr.append("%dpx" % int(dY / 10))


        vmlStr.append("\" coordsize=\"100,100\" coordorigin=\"0,0\"><v:image src=\"")
        vmlStr.append(DOM.getAttribute(img, "src"))
        vmlStr.append("\" style=\"")

        vmlStr.append("width:")
        vmlStr.append(str(int(destWidth * 10)))
        vmlStr.append(";height:")
        vmlStr.append(str(int(destHeight * 10)))
        vmlStr.append(";\" cropleft=\"")
        vmlStr.append(str(sourceX / fullWidth))
        vmlStr.append("\" croptop=\"")
        vmlStr.append(str(sourceY / fullHeight))
        vmlStr.append("\" cropright=\"")
        vmlStr.append(str((fullWidth - sourceX - sourceWidth) / fullWidth))
        vmlStr.append("\" cropbottom=\"")
        vmlStr.append(str((fullHeight - sourceY - sourceHeight) / fullHeight))
        vmlStr.append("\"/></v:group>")

        self.insert("BeforeEnd", ''.join(vmlStr))
Пример #52
0
 def getKind(self):
     return DOM.getAttribute(self.getElement(), "type")
Пример #53
0
 def getName(self):
     return DOM.getAttribute(self.inputElem, "name")
Пример #54
0
 def getMin(self):
     return DOM.getAttribute(self.getElement(), "min")
Пример #55
0
 def getName(self):
     return DOM.getAttribute(self.getElement(), "name")
Пример #56
0
 def getMax(self):
     return DOM.getAttribute(self.getElement(), "max")
Пример #57
0
 def get(self):
     "Get the value"
     return DOM.getAttribute(self.element, self.attribute)
Пример #58
0
 def getPlaceholder(self):
     return DOM.getAttribute(self.getElement(), "placeholder")