本文整理汇总了Python中utils.text_get函数的典型用法代码示例。如果您正苦于以下问题:Python text_get函数的具体用法?Python text_get怎么用?Python text_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了text_get函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _lines
def _lines(self, node):
line_str = utils.text_get(node).split()
lines = []
while len(line_str) > 3:
lines.append([utils.unit_get(l) for l in line_str[0:4]])
line_str = line_str[4:]
self.canvas.lines(lines)
示例2: __init__
def __init__(self, node, style):
coord = [utils.unit_get(x) for x in utils.text_get(node).split(' ')]
self.ok = False
self.posx = coord[0]
self.posy = coord[1]
self.width = coord[2]-coord[0]
self.ok = coord[1]==coord[3]
self.style = style
self.style = style.get('hr')
示例3: _path
def _path(self, node):
self.path = self.canvas.beginPath()
self.path.moveTo(**utils.attr_get(node, ["x", "y"]))
for n in node.childNodes:
if n.nodeType == node.ELEMENT_NODE:
if n.localName == "moveto":
vals = utils.text_get(n).split()
self.path.moveTo(utils.unit_get(vals[0]), utils.unit_get(vals[1]))
elif n.localName == "curvesto":
vals = utils.text_get(n).split()
while len(vals) > 5:
pos = []
while len(pos) < 6:
pos.append(utils.unit_get(vals.pop(0)))
self.path.curveTo(*pos)
elif n.nodeType == node.TEXT_NODE:
data = n.data.split() # Not sure if I must merge all TEXT_NODE ?
while len(data) > 1:
x = utils.unit_get(data.pop(0))
y = utils.unit_get(data.pop(0))
self.path.lineTo(x, y)
if (not node.hasAttribute("close")) or utils.bool_get(node.getAttribute("close")):
self.path.close()
self.canvas.drawPath(self.path, **utils.attr_get(node, [], {"fill": "bool", "stroke": "bool"}))
示例4: _path
def _path(self, node):
self.path = self.canvas.beginPath()
self.path.moveTo(**utils.attr_get(node, ['x','y']))
for n in utils._child_get(node, self):
if not n.text :
if n.tag=='moveto':
vals = utils.text_get(n).split()
self.path.moveTo(utils.unit_get(vals[0]), utils.unit_get(vals[1]))
elif n.tag=='curvesto':
vals = utils.text_get(n).split()
while len(vals)>5:
pos=[]
while len(pos)<6:
pos.append(utils.unit_get(vals.pop(0)))
self.path.curveTo(*pos)
elif n.text:
data = n.text.split() # Not sure if I must merge all TEXT_NODE ?
while len(data)>1:
x = utils.unit_get(data.pop(0))
y = utils.unit_get(data.pop(0))
self.path.lineTo(x,y)
if (not node.get('close')) or utils.bool_get(node.get('close')):
self.path.close()
self.canvas.drawPath(self.path, **utils.attr_get(node, [], {'fill':'bool','stroke':'bool'}))
示例5: _curves
def _curves(self, node):
line_str = utils.text_get(node).split()
lines = []
while len(line_str) > 7:
self.canvas.bezier(*[utils.unit_get(l) for l in line_str[0:8]])
line_str = line_str[8:]