コード例 #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
ファイル: Range.py プロジェクト: luiseduardohdbackup/pyjs
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
ファイル: __pyjamas__.py プロジェクト: audreyr/pyjs
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
ファイル: Factory.py プロジェクト: Afey/pyjs
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
ファイル: RichTextToolbar.py プロジェクト: Afey/pyjs
 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
ファイル: UIObject.py プロジェクト: anandology/pyjamas
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
ファイル: RichTextToolbar.py プロジェクト: minghuascode/pyj
 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-")
コード例 #11
0
    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
ファイル: HTMLTable.py プロジェクト: andreyvit/pyjamas
    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
ファイル: HTMLPanel.py プロジェクト: certik/pyjamas
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
ファイル: UIObject.py プロジェクト: sofianhw/pyjs
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
ファイル: DNDHelper.py プロジェクト: Afey/pyjs
 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
ファイル: DNDTest.py プロジェクト: trb116/pythonanalyzer
 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
ファイル: DNDTest.py プロジェクト: anandology/pyjamas
 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
ファイル: UIObject.py プロジェクト: sofianhw/pyjs
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
ファイル: TextBoxBase.py プロジェクト: pombredanne/pyjamas
 def getText(self):
     return DOM.getAttribute(self.getElement(), "value")
コード例 #33
0
ファイル: UIObject.py プロジェクト: sofianhw/pyjs
 def getStyleName(self):
     return DOM.getAttribute(self.element, "className")
コード例 #34
0
ファイル: Image.py プロジェクト: lindh04/ultimateTicTacToe
 def getUrl(self):
     return DOM.getAttribute(self.getElement(), "src")
コード例 #35
0
ファイル: FileUpload.py プロジェクト: pombredanne/pyjamas
 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")
コード例 #38
0
 def getStyleName(self, row):
     return DOM.getAttribute(self.getElement(row), "className")
コード例 #39
0
ファイル: Widget.py プロジェクト: anandology/pyjamas
 def getID(self):
     """Get the id attribute of the associated DOM element."""
     return DOM.getAttribute(self.getElement(), "id")
コード例 #40
0
ファイル: SVGCanvas.py プロジェクト: Afey/pyjs
    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
ファイル: UIObject.py プロジェクト: sofianhw/pyjs
 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
ファイル: TextBoxBase.py プロジェクト: nielsonsantana/pyjs
 def getText(self):
     return DOM.getAttribute(self.getElement(), "value")
コード例 #45
0
ファイル: CheckBox.py プロジェクト: pombredanne/pyjamas
 def getName(self):
     return DOM.getAttribute(self.inputElem, "name")
コード例 #46
0
ファイル: FormPanel.py プロジェクト: Afey/pyjs
 def getAction(self):
     return DOM.getAttribute(self.getElement(), "action")
コード例 #47
0
ファイル: TextBox.py プロジェクト: anandology/pyjamas
 def getStep(self):
     return DOM.getAttribute(self.getElement(), "step")
コード例 #48
0
 def getStep(self):
     return DOM.getAttribute(self.getElement(), "step")
コード例 #49
0
ファイル: TextBoxBase.py プロジェクト: nielsonsantana/pyjs
 def getName(self):
     return DOM.getAttribute(self.getElement(), "name")
コード例 #50
0
    def getValue(self, index):
        self.checkIndex(index)

        option = DOM.getChild(self.getElement(), index)
        return DOM.getAttribute(option, "value")
コード例 #51
0
ファイル: GWTCanvasImplIE6.py プロジェクト: Afey/pyjs
    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
ファイル: TextBox.py プロジェクト: anandology/pyjamas
 def getKind(self):
     return DOM.getAttribute(self.getElement(), "type")
コード例 #53
0
ファイル: CheckBox.py プロジェクト: certik/pyjamas
 def getName(self):
     return DOM.getAttribute(self.inputElem, "name")
コード例 #54
0
ファイル: TextBox.py プロジェクト: anandology/pyjamas
 def getMin(self):
     return DOM.getAttribute(self.getElement(), "min")
コード例 #55
0
ファイル: TextBoxBase.py プロジェクト: pombredanne/pyjamas
 def getName(self):
     return DOM.getAttribute(self.getElement(), "name")
コード例 #56
0
ファイル: TextBox.py プロジェクト: anandology/pyjamas
 def getMax(self):
     return DOM.getAttribute(self.getElement(), "max")
コード例 #57
0
ファイル: Anchor.py プロジェクト: minghuascode/pyj
 def get(self):
     "Get the value"
     return DOM.getAttribute(self.element, self.attribute)
コード例 #58
0
ファイル: TextBox.py プロジェクト: anandology/pyjamas
 def getPlaceholder(self):
     return DOM.getAttribute(self.getElement(), "placeholder")