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


Python DOM.insertChild方法代码示例

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


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

示例1: insertRow

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
    def insertRow(self, beforeRow):
        if beforeRow != self.getRowCount():
            self.checkRowBounds(beforeRow)

        tr = DOM.createTR()
        DOM.insertChild(self.bodyElem, tr, beforeRow)
        return beforeRow
开发者ID:Afey,项目名称:pyjs,代码行数:9,代码来源:HTMLTable.py

示例2: insertChildBefore

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
def insertChildBefore(new_elem, elem):
    """
    Inserts an element "new_elem" before the element "elem".
    """
    parent = DOM.getParent(elem)
    id = DOM.getChildIndex(parent, elem)
    DOM.insertChild(parent, new_elem, id)
开发者ID:certik,项目名称:sympy_gamma,代码行数:9,代码来源:nb.py

示例3: insert

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
    def insert(self, widget, container, beforeIndex=None):
        """ has two modes of operation:
            widget, beforeIndex
            widget, container, beforeIndex.
            if beforeIndex argument is not given, the 1st mode is assumed.
            this technique is less costly than using *args.
        """
        if widget.getParent() == self:
            return

        if beforeIndex is None:
            beforeIndex = container
            container = self.getBody()

        widget.removeFromParent()

        tr = DOM.createTR()
        td = DOM.createTD()

        DOM.insertChild(container, tr, beforeIndex)
        DOM.appendChild(tr, td)

        CellPanel.insert(self, widget, td, beforeIndex)

        self.setCellHorizontalAlignment(widget, self.horzAlign)
        self.setCellVerticalAlignment(widget, self.vertAlign)
开发者ID:Afey,项目名称:pyjs,代码行数:28,代码来源:VerticalPanel.py

示例4: addMessage

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
 def addMessage(self, text):
     d = datetime.now().strftime("%x %X")
     li = DOM.createElement('li')
     DOM.setInnerHTML(li,
                      '<dt class="time">%s</dt><dd class="txt">%s</dd>' % (
                      d, text))
     DOM.insertChild(self.element, li, 0)
开发者ID:anandology,项目名称:pyjamas,代码行数:9,代码来源:DNDTest.py

示例5: setCaption

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
 def setCaption(self, caption):
     self.caption = caption
     if caption is not None and not caption == "":
         DOM.setInnerHTML(self.legend, caption)
         DOM.insertChild(self.getElement(), self.legend, 0)
     elif DOM.getParent(self.legend) is not None:
         DOM.removeChild(self.getElement(), self.legend)
开发者ID:Afey,项目名称:pyjs,代码行数:9,代码来源:CaptionPanel.py

示例6: replaceLinks

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
 def replaceLinks(self, tagname="a"):
     """ replaces <tag href="#pagename">sometext</tag> with:
         Hyperlink("sometext", "pagename")
     """
     tags = self.findTags(tagname)
     pageloc = Window.getLocation()
     pagehref = pageloc.getPageHref()
     for el in tags:
         href = el.href
         l = href.split("#")
         if len(l) != 2:
             continue
         if l[0] != pagehref:
             continue
         token = l[1]
         if not token:
             continue
         html = DOM.getInnerHTML(el)
         parent = DOM.getParent(el)
         index = DOM.getChildIndex(parent, el)
         hl = Hyperlink(TargetHistoryToken=token,
                        HTML=html,
                        Element=DOM.createSpan())
         DOM.insertChild(parent, hl.getElement(), index)
         self.children.insert(index, hl)
         parent.removeChild(el)
开发者ID:Afey,项目名称:pyjs,代码行数:28,代码来源:HTMLLinkPanel.py

示例7: insert

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
 def insert(self, widget, beforeIndex):
     if widget.getParent() == self: 
         return
         
     widget.removeFromParent()            
     DOM.insertChild(self.getElement(), widget.getElement(), beforeIndex)        
     widget.setParent(self)
     self.children.insert(beforeIndex, widget)
开发者ID:fedenko,项目名称:clientbank,代码行数:10,代码来源:DjangoForm.py

示例8: adopt

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
 def adopt(self, widget, container):
     if container is not None:
         widget.removeFromParent()
         if indexBefore:
             DOM.insertChild(container, widget.getElement(), indexBefore)
         else:
             DOM.appendChild(container, widget.getElement())
     widget.setParent(self)
开发者ID:gpitel,项目名称:pyjs,代码行数:10,代码来源:Panel.py

示例9: insert

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
    def insert(self, widget, beforeIndex):
        widget.removeFromParent()

        td = DOM.createTD()
        DOM.insertChild(self.tableRow, td, beforeIndex)

        CellPanel.insert(self, widget, td, beforeIndex)

        self.setCellHorizontalAlignment(widget, self.horzAlign)
        self.setCellVerticalAlignment(widget, self.vertAlign)
开发者ID:certik,项目名称:pyjamas,代码行数:12,代码来源:HorizontalPanel.py

示例10: insertItem

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
    def insertItem(self, item, index=None):
        if isinstance(item, basestring):
            item = TreeItem(item)

        ret = self.root.addItem(item)
        if index is None:
            DOM.appendChild(self.getElement(), item.getElement())
        else:
            DOM.insertChild(self.getElement(), item.getElement(), index)

        return ret
开发者ID:anandology,项目名称:pyjamas,代码行数:13,代码来源:Tree.py

示例11: insertItem

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
 def insertItem(self, item, index):
     if self.vertical:
         tr = DOM.createTR()
         DOM.insertChild(self.body, tr, index)
     else:
         self._checkVerticalContainer()
         tr = DOM.getChild(self.body, 0)
     DOM.insertChild(tr, item.getElement(), index)
     item.setParentMenu(self)
     item.setSelectionStyle(False)
     self.items.insert(index, item)
开发者ID:Afey,项目名称:pyjs,代码行数:13,代码来源:MenuBar.py

示例12: insert

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
    def insert(self, widget, beforeIndex):
        widget.removeFromParent()

        tr = DOM.createTR()
        td = DOM.createTD()

        DOM.insertChild(self.getBody(), tr, beforeIndex)
        DOM.appendChild(tr, td)

        CellPanel.insert(self, widget, td, beforeIndex)

        self.setCellHorizontalAlignment(widget, self.horzAlign)
        self.setCellVerticalAlignment(widget, self.vertAlign)
开发者ID:anandology,项目名称:pyjamas,代码行数:15,代码来源:VerticalPanel.py

示例13: insertItem

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
    def insertItem(self, item, index=None):
        if not hasattr(item, "getTree"):
            #if not item.getTree:
            item = TreeItem(item)

        if (item.getParentItem() is not None) or (item.getTree() is not None):
            item.remove()

        item.setTree(self.tree)
        item.setParentItem(self)
        if index is None:
            self.children.append(item)
        else:
            self.children.insert(index, item)
        DOM.setStyleAttribute(item.getElement(), "marginLeft", "16px")
        if index is None:
            DOM.appendChild(self.childSpanElem, item.getElement())
        else:
            DOM.insertChild(self.childSpanElem, item.getElement(), index)

        if len(self.children) == 1:
            self.updateState()

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

示例14: insertCells

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
 def insertCells(self, row, column, count):
     tr = self.rowFormatter.getRow(self.bodyElem, row)
     for i in range(column, column + count):
         td = self.createCell()
         DOM.insertChild(tr, td, i)
开发者ID:Afey,项目名称:pyjs,代码行数:7,代码来源:HTMLTable.py

示例15: insertCell

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import insertChild [as 别名]
 def insertCell(self, row, column):
     tr = self.rowFormatter.getRow(self.bodyElem, row)
     td = self.createCell()
     DOM.insertChild(tr, td, column)
开发者ID:Afey,项目名称:pyjs,代码行数:6,代码来源:HTMLTable.py


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