本文整理汇总了Python中string.Template.path方法的典型用法代码示例。如果您正苦于以下问题:Python Template.path方法的具体用法?Python Template.path怎么用?Python Template.path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类string.Template
的用法示例。
在下文中一共展示了Template.path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: results
# 需要导入模块: from string import Template [as 别名]
# 或者: from string.Template import path [as 别名]
def results(self):
top = Template(svgTemplate.topSection);
layer = Template(svgTemplate.pathSection);
bottom = Template(svgTemplate.bottomSection);
#build the top and bottom portion of the document
p = {}:
p['unitScale'] = self.unitScale;
p['units'] = self.units;
p['description'] = self.description;
p['title']=self.title;
p['sliceHeight'] = self.NUMBERFORMAT % self.sliceSet.sliceHeight;
p['xMin'] = self.NUMBERFORMAT % self.sliceSet.analyzer.xMin;
p['xMax'] = self.NUMBERFORMAT % self.sliceSet.analyzer.xMax;
p['xRange'] = self.NUMBERFORMAT % self.sliceSet.analyzer.xDim;
p['yMin'] = self.NUMBERFORMAT % self.sliceSet.analyzer.yMin;
p['yMax'] = self.NUMBERFORMAT % self.sliceSet.analyzer.yMax;
p['yRange'] = self.NUMBERFORMAT % self.sliceSet.analyzer.yDim;
p['zMin'] = self.NUMBERFORMAT % self.sliceSet.analyzer.zMin;
p['zMax'] = self.NUMBERFORMAT % self.sliceSet.analyzer.zMax;
p['zRange'] = self.NUMBERFORMAT % self.sliceSet.analyzer.zDim;
#svg specific properties
p['xTranslate']=(-1)*self.sliceSet.analyzer.xMin
p['yTranslate']=(-1)*self.sliceSet.analyzer.yMin
#put layer dims as nicely formatted numbers
p['xMinText'] = self.NUMBERFORMAT % self.sliceSet.analyzer.xMin;
p['xMaxText'] = "self.NUMBERFORMAT % self.sliceSet.analyzer.xMax;
p['yMinText'] = self.NUMBERFORMAT % self.sliceSet.analyzer.yMin;
p['yMaxText'] = self.NUMBERFORMAT % self.sliceSet.analyzer.yMax;
p['zMinText'] = self.NUMBERFORMAT % self.sliceSet.analyzer.zMin;
p['zMaxText'] = self.NUMBERFORMAT % self.sliceSet.analyzer.zMax;
resultDoc = top.substitute(p);
for layer in self.layers:
p['zLevel'] = layer.zLevel();
p['layerNo'] = layer.slice.layerNo;
p['xTransform'] = layer.xTransform();
p['yTransform'] = layer.yTransform();
p['path'] = layer.path();
resultDoc += layer.subsitute(p);
resultDoc += bottom.substitute(p);
return resultDoc;