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


Python DOM.removeChild方法代码示例

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


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

示例1: remove

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
    def remove(self, child, index=None):
        if index is None:
            if isinstance(child, int):
                index = child
                child = self.getWidget(child)
            else:
                index = self.getWidgetIndex(child)

        if child.getParent() != self:
            return False

        if self.visibleStack == index:
            self.visibleStack = -1
        elif self.visibleStack > index:
            self.visibleStack -= 1

        rowIndex = 2 * index
        tr = DOM.getChild(self.body, rowIndex)
        DOM.removeChild(self.body, tr)
        tr = DOM.getChild(self.body, rowIndex)
        DOM.removeChild(self.body, tr)
        CellPanel.remove(self, child)
        rows = self.getWidgetCount() * 2

        #for (int i = rowIndex; i < rows; i = i + 2) {
        for i in range(rowIndex, rows, 2):
            childTR = DOM.getChild(self.body, i)
            td = DOM.getFirstChild(childTR)
            curIndex = self._getIndex(td)
            self._setIndex(td, index)
            index += 1

        return True
开发者ID:Afey,项目名称:pyjs,代码行数:35,代码来源:StackPanel.py

示例2: setCaption

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [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

示例3: setImage

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
 def setImage(self,element):
     container = self.getElement()
     clone = cloneElement(element)
     while self.children:
         child = self.children.pop()
         DOM.removeChild(container, child)
     self.addChild(clone)
开发者ID:anandology,项目名称:pyjamas,代码行数:9,代码来源:utils.py

示例4: removeItem

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
 def removeItem(self, item):
     try:
         idx = self.items.index(item)
     except ValueError:
         return
     container = self.getItemContainerElement()
     DOM.removeChild(container, DOM.getChild(container, idx))
     del self.items[idx]
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:10,代码来源:MenuBar.py

示例5: setCurrentFaceElement

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
 def setCurrentFaceElement(self, newFaceElement):
     # XXX: TODO
     if self.curFaceElement != newFaceElement:
         if self.curFaceElement is not None:
             DOM.removeChild(self.getElement(), self.curFaceElement)
         
         self.curFaceElement = newFaceElement
         DOM.appendChild(self.getElement(), self.curFaceElement)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:10,代码来源:CustomButton.py

示例6: testDivHTML

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
    def testDivHTML(self):
        e = DOM.getElementById('tests')
        div = DOM.createElement('div')
        DOM.appendChild(e, div)
        DOM.setInnerHTML(div, 'hello world\n')
        self.write_test_output('addDiv')

        DOM.removeChild(e, div)
        self.write_test_output('removeDiv')
开发者ID:anandology,项目名称:pyjamas,代码行数:11,代码来源:DOMTest.py

示例7: disown

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
 def disown(self, widget):
     if widget.getParent() != self:
         console.error("widget %o is not a child of this panel %o", widget, self)
     else:
         element = widget.getElement()
         widget.setParent(None)
         parentElement = DOM.getParent(element)
         if parentElement:
             DOM.removeChild(parentElement, element)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:11,代码来源:Panel.py

示例8: disown

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
 def disown(self, widget):
     if widget.getParent() is not self:
         raise Exception("widget %s is not a child of this panel %s" % \
                          (str(widget), str(self)))
     element = widget.getElement()
     widget.setParent(None)
     parentElement = DOM.getParent(element)
     if parentElement is not None:
         DOM.removeChild(parentElement, element)
开发者ID:anandology,项目名称:pyjamas,代码行数:11,代码来源:Panel.py

示例9: removeItem

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
    def removeItem(self, item):
        if item not in self.children:
            return

        item.setTree(None)
        item.setParentItem(None)
        self.children.remove(item)
        DOM.removeChild(self.childSpanElem, item.getElement())
        if len(self.children) == 0:
            self.updateState()
开发者ID:anthonyrisinger,项目名称:translate-pyjs-org.appspot.com,代码行数:12,代码来源:TreeItem.py

示例10: clear

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
 def clear(self):
     # as long as the canvas has children other than our <defs> element
     while DOM.getChildCount(self.canvas) > 1:
         # remove the second one (skip defs)
         DOM.removeChild(self.canvas, DOM.getChild(self.canvas, 1))
     # # init styles context stack
     # self.ctx_stack = []
     # # init current context
     # self._init_context()
     # also reset path
     self.beginPath()
开发者ID:anthonyrisinger,项目名称:translate-pyjs-org.appspot.com,代码行数:13,代码来源:SVGCanvas.py

示例11: remove

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
    def remove(self, widget):
        if isinstance(widget, int):
            widget = self.getWidget(widget)

        if widget.getParent() != self:
            return False

        td = DOM.getParent(widget.getElement())
        DOM.removeChild(self.tableRow, td)

        CellPanel.remove(self, widget)
        return True
开发者ID:certik,项目名称:pyjamas,代码行数:14,代码来源:HorizontalPanel.py

示例12: clear

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
 def clear(self):
     """
     Clears the entire canvas.
     Also deletes the context stack and current path
     TODO: NEED TO RESET STYLES?
     TODO: NEED TO RESET STYLES?
     """
     # as long as the canvas has children other than our <defs> element
     while DOM.getChildCount(self.canvas) > 1:
         # remove the second one (skip defs)
         DOM.removeChild(self.canvas, DOM.getChild(self.canvas, 1))
     # # init styles context stack
     # self.ctx_stack = []
     # # init current context
     # self._init_context()
     # also reset path
     self.beginPath()
开发者ID:Afey,项目名称:pyjs,代码行数:19,代码来源:SVGCanvas.py

示例13: clear

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
 def clear(self):
     h = self.getElement()
     while DOM.getChildCount(h) > 0:
         DOM.removeChild(h, DOM.getChild(h, 0))
开发者ID:Afey,项目名称:pyjs,代码行数:6,代码来源:ListBox.py

示例14: removeItem

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
 def removeItem(self, item):
     self.root.removeItem(item)
     DOM.removeChild(self.getElement(), item.getElement())
开发者ID:anandology,项目名称:pyjamas,代码行数:5,代码来源:Tree.py

示例15: realizeTable

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import removeChild [as 别名]
    def realizeTable(self, beingAdded):
        bodyElement = self.getBody()

        while DOM.getChildCount(bodyElement) > 0:
            DOM.removeChild(bodyElement, DOM.getChild(bodyElement, 0))

        rowCount = 1
        colCount = 1
        for child in self.dock_children:
            dir = child.getLayoutData().direction
            if dir == self.NORTH or dir == self.SOUTH:
                rowCount += 1
            elif dir == self.EAST or dir == self.WEST:
                colCount += 1

        rows = []
        for i in range(rowCount):
            rows.append(DockPanelTmpRow())
            rows[i].tr = DOM.createTR()
            DOM.appendChild(bodyElement, rows[i].tr)

        westCol = 0
        eastCol = colCount - 1
        northRow = 0
        southRow = rowCount - 1
        centerTd = None

        for child in self.dock_children:
            layout = child.getLayoutData()

            td = DOM.createTD()
            layout.td = td
            DOM.setAttribute(layout.td, "align", layout.hAlign)
            DOM.setStyleAttribute(layout.td, "verticalAlign", layout.vAlign)
            DOM.setAttribute(layout.td, "width", layout.width)
            DOM.setAttribute(layout.td, "height", layout.height)

            if layout.direction == self.NORTH:
                DOM.insertChild(rows[northRow].tr, td, rows[northRow].center)
                self.appendAndMaybeAdopt(td, child.getElement(), beingAdded)
                DOM.setIntAttribute(td, "colSpan", eastCol - westCol + 1)
                northRow += 1
            elif layout.direction == self.SOUTH:
                DOM.insertChild(rows[southRow].tr, td, rows[southRow].center)
                self.appendAndMaybeAdopt(td, child.getElement(), beingAdded)
                DOM.setIntAttribute(td, "colSpan", eastCol - westCol + 1)
                southRow -= 1
            elif layout.direction == self.WEST:
                row = rows[northRow]
                DOM.insertChild(row.tr, td, row.center)
                row.center += 1
                self.appendAndMaybeAdopt(td, child.getElement(), beingAdded)
                DOM.setIntAttribute(td, "rowSpan", southRow - northRow + 1)
                westCol += 1
            elif layout.direction == self.EAST:
                row = rows[northRow]
                DOM.insertChild(row.tr, td, row.center)
                self.appendAndMaybeAdopt(td, child.getElement(), beingAdded)
                DOM.setIntAttribute(td, "rowSpan", southRow - northRow + 1)
                eastCol -= 1
            elif layout.direction == self.CENTER:
                centerTd = td

        if self.center is not None:
            row = rows[northRow]
            DOM.insertChild(row.tr, centerTd, row.center)
            self.appendAndMaybeAdopt(centerTd, self.center.getElement(), beingAdded)
开发者ID:andreyvit,项目名称:pyjamas,代码行数:69,代码来源:DockPanel.py


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