本文整理汇总了Python中shape.Shape.getStyleString方法的典型用法代码示例。如果您正苦于以下问题:Python Shape.getStyleString方法的具体用法?Python Shape.getStyleString怎么用?Python Shape.getStyleString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shape.Shape
的用法示例。
在下文中一共展示了Shape.getStyleString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _placeRouting
# 需要导入模块: from shape import Shape [as 别名]
# 或者: from shape.Shape import getStyleString [as 别名]
def _placeRouting(self):
"""
"""
routing = config.rte
routes = routing.get('routes') or {}
# Path effects are used for meandering paths, for example
path_effects = routes.get('path_effects')
xpath_expr = "//g[@inkscape:label='%s']//g[@inkscape:label='%s']"
extra_attributes = ['inkscape:connector-curvature', 'inkscape:original-d', 'inkscape:path-effect']
for pcb_layer in config.stk['layer-names']:
# Are there pours in the layer? This makes a difference for whether to place
# masks
there_are_pours = utils.checkForPoursInLayer(pcb_layer)
# Define a group where masks are stored
mask_group = et.SubElement(self._masks[pcb_layer], 'g')
# Place defined routes on this SVG layer
sheet = self._layers[pcb_layer]['conductor']['routing']['layer']
for route_key in (routes.get(pcb_layer) or {}):
shape_dict = routes[pcb_layer][route_key]
shape = Shape(shape_dict)
style = Style(shape_dict, 'conductor')
shape.setStyle(style)
# Routes are a special case where they are used as-is
# counting on Inkscapes 'optimised' setting to modify
# the path such that placement is refleced in
# it. Therefor we use the original path, not the
# transformed one as usual
use_original_path = True
mirror_path = False
route_element = place.placeShape(shape,
sheet,
mirror_path,
use_original_path)
route_element.set('style', shape.getStyleString())
# Set the key as pcbmode:id of the route. This is used
# when extracting routing to offset the location of a
# modified route
route_element.set('{'+config.cfg['ns']['pcbmode']+'}%s' % ('id'),
route_key)
# Add a custom buffer definition if it exists
custom_buffer = shape_dict.get('buffer-to-pour')
if custom_buffer != None:
route_element.set('{'+config.cfg['namespace']['pcbmode']+'}%s' % "buffer-to-pour", str(custom_buffer))
# TODO: can this be done more elegantly, and "general purpose"?
for extra_attrib in extra_attributes:
ea = shape_dict.get(extra_attrib)
if ea is not None:
route_element.set('{'+config.cfg['namespace']['inkscape']+'}%s' % (extra_attrib[extra_attrib.index(':')+1:], ea))
# TODO: this needs to eventually go away or be done properly
pcbmode_params = shape_dict.get('pcbmode')
if pcbmode_params is not None:
route_element.set('pcbmode', pcbmode_params)
if ((there_are_pours == True) and (custom_buffer != "0")):
self._placeMask(self._masks[pcb_layer],
shape,
'route',
use_original_path)