本文整理汇总了Python中pyjamas.DOM.getChild方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.getChild方法的具体用法?Python DOM.getChild怎么用?Python DOM.getChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.getChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [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
示例2: setStackText
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [as 别名]
def setStackText(self, index, text, asHTML=False):
if index >= self.getWidgetCount():
return
td = DOM.getChild(DOM.getChild(self.body, index * 2), 0)
if asHTML:
DOM.setInnerHTML(td, text)
else:
DOM.setInnerText(td, text)
示例3: getCellElement
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [as 别名]
def getCellElement(self, row, cell) :
""" Get a specific Element from the panel.
@param row the row index
@param cell the cell index
@return the Element at the given row and cell
"""
tr = DOM.getChild(self.tbody, row)
td = DOM.getChild(tr, cell)
return DOM.getFirstChild(td)
示例4: setStackVisible
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [as 别名]
def setStackVisible(self, index, visible):
tr = DOM.getChild(self.body, (index * 2))
if tr is None:
return
td = DOM.getFirstChild(tr)
self.setStyleName(td, "gwt-StackPanelItem-selected", visible)
tr = DOM.getChild(self.body, (index * 2) + 1)
self.setVisible(tr, visible)
self.getWidget(index).setVisible(visible)
示例5: inicia
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [as 别名]
def inicia(self):
global IMAGEREPO
self.__form = f = DOM.getElementById('mainform')
self.x = DOM.getChild(f,0).value #DOM.getElementByName('_xsrf').value
g = DOM.getChild(f,1).value
self.scored = DOM.getChild(f,2)
self.housed = DOM.getChild(f,3)
if g == '12de6b622cbfe4d8f5c8d3347e56ae8c': IMAGEREPO = 'imagens/'
#self.talk(self.scored.value+self.housed.value+IMAGEREPO)
self._socket = NullSocket() #WebSocket("ws://%s/chatsocket"%self.test())
self._socket.register_receiver(self.game.receive)
obj = j_p.wdecode(self.housed.value)
#self.text(400,85, str(obj) ,'darkbrown',10)
#obj = [dict(body='nonono')]
return obj
示例6: findTextPoint
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [as 别名]
def findTextPoint(node, offset):
"""
If the found range is not on a text node, this finds the cooresponding
text node to where the selection is. If it is on a text node, just
directly creates the endpoint from it.
@param node node returned as an endpoint of a range
@param offset offset returned to the endpoint of a range
@return A range end point with a proper (or None) text node
"""
if DOM.getNodeType(node) == DOM.TEXT_NODE:
res = RangeEndPoint(node, offset)
else:
# search backwards unless this is after the last node
dirn = offset >= DOM.getChildCount(node)
child = (DOM.getChildCount(node) == 0) and node or DOM.getChild(node, dirn and (offset - 1) or offset)
# Get the previous/next text node
text = RangeUtil.getAdjacentTextElement(child, dirn)
if text is None:
# If we didn't find a text node in the preferred direction,
# try the other direction
dirn = not dirn
text = RangeUtil.getAdjacentTextElement(child, dirn)
res = RangeEndPoint(text, dirn)
return res
示例7: removeItem
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [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]
示例8: insertItem
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [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)
示例9: clear
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [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()
示例10: addItem
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [as 别名]
def addItem(self, item, asHTML=None, popup=None):
if not hasattr(item, "setSubMenu"):
item = MenuItem(item, asHTML, popup)
if self.vertical:
tr = DOM.createTR()
DOM.appendChild(self.body, tr)
else:
tr = DOM.getChild(self.body, 0)
DOM.appendChild(tr, item.getElement())
item.setParentMenu(self)
item.setSelectionStyle(False)
self.items.append(item)
return item
示例11: clear
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [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()
示例12: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [as 别名]
def __init__(self, rowStyles=None, containerIndex=1, **kwargs):
""" Creates a new panel using the specified style names to
apply to each row. Each row will contain three cells
(Left, Center, and Right). The Center cell in the
containerIndex row will contain the {@link Widget}.
@param rowStyles an array of style names to apply to each row
@param containerIndex the index of the container row
"""
if rowStyles is None:
rowStyles = self.DEFAULT_ROW_STYLENAMES
if kwargs.has_key('Element'):
self.table = kwargs.pop('Element')
fc = DOM.getFirstChild(self.table)
if fc:
self.tbody = fc
else:
self.tbody = DOM.createTBody()
DOM.appendChild(self.table, self.tbody)
else:
# Add a tbody
self.table = DOM.createTable()
self.tbody = DOM.createTBody()
DOM.appendChild(self.table, self.tbody)
DOM.setAttribute(self.table, "cellSpacing", "0")
DOM.setAttribute(self.table, "cellPadding", "0")
if not kwargs.has_key('StyleName'): kwargs['StyleName']=self.DEFAULT_STYLENAME
SimplePanel.__init__(self, self.table, **kwargs)
# Add each row
for i in range(len(rowStyles)):
row = self.createTR(rowStyles[i])
DOM.appendChild(self.tbody, row)
if i == containerIndex:
self.containerElem = DOM.getFirstChild(DOM.getChild(row, 1))
示例13: clear
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [as 别名]
def clear(self):
h = self.getElement()
while DOM.getChildCount(h) > 0:
DOM.removeChild(h, DOM.getChild(h, 0))
示例14: clearItems
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [as 别名]
def clearItems(self):
container = self.getItemContainerElement()
while DOM.getChildCount(container) > 0:
DOM.removeChild(container, DOM.getChild(container, 0))
self.items = []
示例15: getItemContainerElement
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import getChild [as 别名]
def getItemContainerElement(self):
if self.vertical:
return self.body
else:
return DOM.getChild(self.body, 0)