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


Python simplestyle.formatStyle函数代码示例

本文整理汇总了Python中simplestyle.formatStyle函数的典型用法代码示例。如果您正苦于以下问题:Python formatStyle函数的具体用法?Python formatStyle怎么用?Python formatStyle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: do_entity

 def do_entity():
     global style, layer
     if block != defs:                       # in a BLOCK
         layer = block
     elif vals[groups['8']]:                 # use Common Layer Name
         layer = layer_nodes[vals[groups['8']][0]]
     color = '#000000'                       # default color
     if vals[groups['8']]:
         if layer_colors.has_key(vals[groups['8']][0]):
             if colors.has_key(layer_colors[vals[groups['8']][0]]):
                 color = colors[layer_colors[vals[groups['8']][0]]]
     if vals[groups['62']]:                  # Common Color Number
         if colors.has_key(vals[groups['62']][0]):
             color = colors[vals[groups['62']][0]]
     style = simplestyle.formatStyle({'stroke': '%s' % color, 'fill': 'none'})
     w = 0.5                                 # default lineweight for POINT
     if vals[groups['370']]:                 # Common Lineweight
         if vals[groups['370']][0] > 0:
             w = 90.0/25.4*vals[groups['370']][0]/100.0
             if w < 0.5:
                 w = 0.5
             style = simplestyle.formatStyle({'stroke': '%s' % color, 'fill': 'none', 'stroke-width': '%.1f' % w})
     if vals[groups['6']]:                   # Common Linetype
         if linetypes.has_key(vals[groups['6']][0]):
             style += ';' + linetypes[vals[groups['6']][0]]
     entities[entity]()
开发者ID:palfrey,项目名称:cube_generator,代码行数:26,代码来源:dxf_input.py

示例2: make_double_line

    def make_double_line(self, length):
        opt = self.options
        
        w1 = float(opt.stroke_width_1)
        w2 = float(opt.stroke_width_2)
        offset = 0.5*(w1 + w2)

        line = inkex.etree.Element('g')

        style_line1 = {
                'fill': 'none',
                'stroke': simplestyle.svgcolors[opt.stroke_color_1],
                'stroke-width': opt.stroke_width_1+'px',}
        path_atts_1 = {
            inkex.addNS('connector-curvature', 'inkscape'): "0",
            'd': "M 0.0,0.0 %f,0.0" % (length,),
            'style': simplestyle.formatStyle(style_line1), }
        inkex.etree.SubElement(line, 'path', path_atts_1)

        style_line2 = {
                'fill': 'none',
                'stroke': simplestyle.svgcolors[opt.stroke_color_2],
                'stroke-width': opt.stroke_width_2+'px',}
        path_atts_2 = {
            inkex.addNS('connector-curvature', 'inkscape'): "0",
            'd': "M 0.0,%f %f,%f.0" % (offset, length, offset),
            'style': simplestyle.formatStyle(style_line2),}
        inkex.etree.SubElement(line, 'path', path_atts_2)
            
        return line
开发者ID:brentini,项目名称:inkscape-label,代码行数:30,代码来源:label.py

示例3: drawCircles

	def drawCircles(self, hole_diameter, diameter):
		# Attributes for the center hole, then create it, if diameter is 0, dont
		# create it
		circle_elements = []
		attributes = {
			'style': simplestyle.formatStyle({'stroke': 'none', 'fill': 'black'}),
			'r': str(hole_diameter / 2)
		}
		if self.options.hole_diameter > 0:
			circle_elements.append(attributes)

		# Attributes for the guide hole in the center hole, then create it
		attributes = {
			'style': simplestyle.formatStyle(
				{'stroke': 'white', 'fill': 'white', 'stroke-width': '0.1'}),
			'r': '1'
		}
		circle_elements.append(attributes)

		# Attributes for the outer rim, then create it
		attributes = {
			'style': simplestyle.formatStyle(
				{'stroke': 'black', 'stroke-width': '1', 'fill': 'none'}),
			'r': str(diameter / 2)
		}
		if self.options.diameter > 0:
			circle_elements.append(attributes)

		return circle_elements
开发者ID:Dragonrun1,项目名称:Inkscape-rotary-encoder-disk-generator,代码行数:29,代码来源:encoder_disk_generator.py

示例4: write_month_header

    def write_month_header(self, g, m):
        txt_atts = {'style': simplestyle.formatStyle(self.style_month),
                    'x': str((self.month_w - self.day_w) / 2),
                    'y': str(self.day_h / 5 )}
        try:
            inkex.etree.SubElement(g, 'text', txt_atts).text = unicode(
                                                self.options.month_names[m-1],
                                                self.options.input_encode)
        except:
            inkex.errormsg(_('You must select a correct system encoding.'))
            exit(1)
        gw = inkex.etree.SubElement(g, 'g')
        week_x = 0
        if self.options.start_day=='sun':
            day_names = self.options.day_names[:]
        else:
            day_names = self.options.day_names[1:]
            day_names.append(self.options.day_names[0])

        if self.options.show_weeknr:
            day_names.insert(0, self.options.weeknr_name)

        for wday in day_names:
            txt_atts = {'style': simplestyle.formatStyle(self.style_day_name),
                        'x': str( self.day_w * week_x ),
                        'y': str( self.day_h ) }
            try:
                inkex.etree.SubElement(gw, 'text', txt_atts).text = unicode(
                                                    wday,
                                                    self.options.input_encode)
            except:
                inkex.errormsg(_('You must select a correct system encoding.'))
                exit(1)
            week_x += 1
开发者ID:AakashDabas,项目名称:inkscape,代码行数:34,代码来源:svgcalendar.py

示例5: effect

    def effect(self):
        defs = self.xpathSingle('/svg//defs')
        if not defs:
            defs = self.document.createElement('svg:defs')
            self.document.documentElement.appendChile(defs)

        for id, node in self.selected.iteritems():
            mprops = ['marker', 'marker-start', 'marker-mid', 'marker-end']
            try:
                style = simplestyle.parseStyle(
                    node.attributes.getNamedItem('style').value)
            except:
                inkex.debug("No style attribute found for id: %s" % id)
                continue

            stroke = style.get('stroke', '#000000')

            for mprop in mprops:
                if style.has_key(mprop) and style[mprop] != 'none' and style[
                        mprop][:5] == 'url(#':
                    marker_id = style[mprop][5:-1]
                    try:
                        old_mnode = self.xpathSingle(
                            '/svg//marker[@id="%s"]' % marker_id)
                        if not self.options.modify:
                            mnode = old_mnode.cloneNode(True)
                        else:
                            mnode = old_mnode
                    except:
                        inkex.debug("unable to locate marker: %s" % marker_id)
                        continue

                    new_id = self.uniqueId(marker_id, not self.options.modify)

                    style[mprop] = "url(#%s)" % new_id
                    mnode.attributes.getNamedItem('id').value = new_id
                    mnode.attributes.getNamedItemNS(inkex.NSS['inkscape'],
                                                    'stockid').value = new_id
                    defs.appendChild(mnode)

                    children = inkex.xml.xpath.Evaluate(
                        '/svg//marker[@id="%s"]//*[@style]' % new_id,
                        self.document,
                        context=self.ctx)
                    for child in children:
                        cstyle = simplestyle.parseStyle(
                            child.attributes.getNamedItem('style').value)
                        if ('stroke' in cstyle and cstyle['stroke'] != 'none'
                            ) or 'stroke' not in cstyle:
                            cstyle['stroke'] = stroke
                        if ('fill' in cstyle and cstyle['fill'] != 'none'
                            ) or 'fill' not in cstyle:
                            cstyle['fill'] = stroke
                        child.attributes.getNamedItem(
                            'style').value = simplestyle.formatStyle(cstyle)
            node.attributes.getNamedItem(
                'style').value = simplestyle.formatStyle(style)
开发者ID:NirBenTalLab,项目名称:proorigami-cde-package,代码行数:57,代码来源:markers_strokepaint.py

示例6: effect

	def effect(self):
		for id, node in self.selected.iteritems():
			if node.tag == '{http://www.w3.org/2000/svg}path':
				path=node
				break
		else:
			sys.stderr.write('Need one path selected\n')
			return

		pts = cubicsuperpath.parsePath(path.get('d'))

		if 'transform' in path.keys():
			trans = path.get('transform')
			trans = simpletransform.parseTransform(trans)
			simpletransform.applyTransformToPath(trans, pts[i])

		gtext = inkex.etree.SubElement(path.xpath('..')[0], inkex.addNS('g','svg'), {} )
		gdots = inkex.etree.SubElement(path.xpath('..')[0], inkex.addNS('g','svg'), {} )

		size = 10
		if 'style' in path.attrib:
			style=path.get('style')
			if style!='':
				styles=style.split(';')
            			for i in range(len(styles)):
					if styles[i].startswith('stroke-width'):
						if ( styles[i].endswith('px') or styles[i].endswith('cm') ) :
							size=float(styles[i][len('stroke-width:'):-2])*2
						else:
							size=float(styles[i][len('stroke-width:'):])*2
#		if len(pts[0])>2:
#			size = math.sqrt(math.pow(pts[0][0][0][0]-pts[0][1][0][0],2)+math.pow(pts[0][0][0][1]-pts[0][1][0][1],2))/10

		it = 0
		for sub in pts:
			for p in sub:
				if it == 0:
					style = { 'stroke': 'none', 'fill': 'black' }
					x0 = p[0][0]
					y0 = p[0][1]
					circ_attribs = {'id':'pt0','style':simplestyle.formatStyle(style),'cx':str(x0), 'cy':str(y0),'r':str(size)}
					circle = inkex.etree.SubElement(gdots, inkex.addNS('circle','svg'), circ_attribs )
				else:
					clone_attribs = { 'x':'0', 'y':'0', 'transform':'translate(%f,%f)' % (p[0][0]-x0,p[0][1]-y0) }
					clone = inkex.etree.SubElement(gdots, inkex.addNS('use','svg'), clone_attribs )
					xlink = inkex.addNS('href','xlink')
					clone.set(xlink, '#pt0')

				text_style = { 'font-size':'%dpx' % (size*2.4), 'fill':'black', 'font-family':'DejaVu Sans', 'text-anchor':'middle' }
				text_attribs = { 'x':str(p[0][0]), 'y':str(p[0][1]-size*1.8), 'style':simplestyle.formatStyle(text_style) }
				text = inkex.etree.SubElement(gtext, inkex.addNS('text','svg'), text_attribs)
				tspan = inkex.etree.SubElement(text , 'tspan', {inkex.addNS('role','sodipodi'): 'line'})
            			tspan.text = '%d' % ( it+1 )

				it+=1
开发者ID:PoufPoufProduction,项目名称:ppvc,代码行数:55,代码来源:dots.py

示例7: export_HATCH

def export_HATCH():
    # mandatory group codes : (10, 20, 70, 72, 92, 93) (x, y, fill, Edge Type, Path Type, Number of edges)
    if vals[groups['10']] and vals[groups['20']] and vals[groups['70']] and vals[groups['72']] and vals[groups['92']] and vals[groups['93']]:
        if len(vals[groups['10']]) > 1 and len(vals[groups['20']]) == len(vals[groups['10']]):
            # optional group codes : (11, 21, 40, 50, 51, 73) (x, y, r, angle1, angle2, CCW)
            i10 = 1    # count start points
            i11 = 0    # count line end points
            i40 = 0    # count circles
            i72 = 0    # count edge type flags
            path = ''
            for i in range (0, len(vals[groups['93']])):
                xc = vals[groups['10']][i10]
                yc = vals[groups['20']][i10]
                if vals[groups['72']][i72] == 2:            # arc
                    rm = scale*vals[groups['40']][i40]
                    a1 = vals[groups['50']][i40]
                    path += 'M %f,%f ' % (xc + rm*math.cos(a1*math.pi/180.0), yc + rm*math.sin(a1*math.pi/180.0))
                else:
                    a1 = 0
                    path += 'M %f,%f ' % (xc, yc)
                for j in range(0, vals[groups['93']][i]):
                    if vals[groups['92']][i] & 2:           # polyline
                        if j > 0:
                            path += 'L %f,%f ' % (vals[groups['10']][i10], vals[groups['20']][i10])
                        if j == vals[groups['93']][i] - 1:
                            i72 += 1
                    elif vals[groups['72']][i72] == 2:      # arc
                        xc = vals[groups['10']][i10]
                        yc = vals[groups['20']][i10]
                        rm = scale*vals[groups['40']][i40]
                        a2 = vals[groups['51']][i40]
                        diff = (a2 - a1 + 360) % (360)
                        sweep = 1 - vals[groups['73']][i40] # sweep CCW
                        large = 0                           # large-arc-flag
                        if diff:
                            path += 'A %f,%f 0.0 %d %d %f,%f ' % (rm, rm, large, sweep, xc + rm*math.cos(a2*math.pi/180.0), yc + rm*math.sin(a2*math.pi/180.0))
                        else:
                            path += 'A %f,%f 0.0 %d %d %f,%f ' % (rm, rm, large, sweep, xc + rm*math.cos((a1+180.0)*math.pi/180.0), yc + rm*math.sin((a1+180.0)*math.pi/180.0))
                            path += 'A %f,%f 0.0 %d %d %f,%f ' % (rm, rm, large, sweep, xc + rm*math.cos(a1*math.pi/180.0), yc + rm*math.sin(a1*math.pi/180.0))
                        i40 += 1
                        i72 += 1
                    elif vals[groups['72']][i72] == 1:      # line
                        path += 'L %f,%f ' % (scale*(extrude*vals[groups['11']][i11] - xmin), height - scale*(vals[groups['21']][i11] - ymin))
                        i11 += 1
                        i72 += 1
                    i10 += 1
                path += "z "
            if vals[groups['70']][0]:
                style = simplestyle.formatStyle({'fill': '%s' % color})
            else:
                style = simplestyle.formatStyle({'fill': 'url(#Hatch)', 'fill-opacity': '1.0'})
            attribs = {'d': path, 'style': style}
            inkex.etree.SubElement(layer, 'path', attribs)
开发者ID:Drooids,项目名称:inkscape,代码行数:53,代码来源:dxf_input.py

示例8: effect

	def effect(self):
		self.checkopts()

		o = self.options.fbedges
		oNF,oBF,oNL,oBL = o,o,o,o

		if self.doMultiScale:
			strings, meta = ffproc.FindStringsMultiScale(self.options.strings,self.options.firstscalelength,
				self.options.lastscalelength,self.options.nutwidth,self.options.bridgewidth,
				self.options.perpdist,oNF,oBF,oNL,oBL)
		else:
			strings, meta = ffproc.FindStringsSingleScale(self.options.strings,self.options.scalelength,
				self.options.nutwidth,self.options.bridgewidth,
				oNF,oBF,oNL,oBL)
		
		frets = ffproc.FindFrets(strings, meta, self.scale, self.tuning, self.options.frets)
		
		edgepath = seg2path(meta[0]) + seg2path(meta[-1])
		stringpath = "".join([seg2path(s) for s in strings])
		fretpath = "".join(["".join([seg2path(f) for f in s]) for s in frets])
	
		group = self.document.createElement('svg:g')
		group.setAttribute('transform',"scale(%s,%s)" % (self.options.pxperunit,self.options.pxperunit))
		self.document.documentElement.appendChild(group)
		
		edge = self.document.createElement('svg:path')
		s = {'stroke-linejoin': 'miter', 'stroke-width': '0.01px', 
			'stroke-opacity': '1.0', 'fill-opacity': '1.0', 
			'stroke': '#0000FF', 'stroke-linecap': 'butt', 
			'fill': 'none'}
		edge.setAttribute('style', simplestyle.formatStyle(s))
		edge.setAttribute('d', edgepath)

		string = self.document.createElement('svg:path')
		s = {'stroke-linejoin': 'miter', 'stroke-width': '0.01px', 
			'stroke-opacity': '1.0', 'fill-opacity': '1.0', 
			'stroke': '#FF0000', 'stroke-linecap': 'butt', 
			'fill': 'none'}
		string.setAttribute('style', simplestyle.formatStyle(s))
		string.setAttribute('d', stringpath)

		fret = self.document.createElement('svg:path')
		s = {'stroke-linejoin': 'miter', 'stroke-width': '0.01px', 
			'stroke-opacity': '1.0', 'fill-opacity': '1.0', 
			'stroke': '#000000', 'stroke-linecap': 'butt', 
			'fill': 'none'}
		fret.setAttribute('style', simplestyle.formatStyle(s))
		fret.setAttribute('d', fretpath)

		group.appendChild(edge)
		group.appendChild(string)
		group.appendChild(fret)
开发者ID:86proof,项目名称:FretFind2D,代码行数:52,代码来源:fretfind.py

示例9: effect

	def effect(self):
		"""
		Effect behaviour.
		Overrides base class' method and draws something.
		"""

		# color
		self.options.dotFill = self.getColorString(self.options.dotFill)
		# constants
		self.dotStyle = simplestyle.formatStyle({'fill': self.options.dotFill,'stroke':'none'})
		self.scale = self.getUnittouu("1" + self.options.units)
		self.dotR = str(self.options.dotSize * (self.scale/2))
		self.computations(radians(self.options.angleOnFootside))

		# processing variables
		self.generatedCircles = []
		self.gridContainer =  self.current_layer

		self.generate()

		if self.options.variant == 'rectangle':
			self.removeGroups(1, 2)
		elif self.options.variant == 'hexagon1':
			self.removeGroups(0, 3)
		elif self.options.variant == 'hexagon2' or self.options.variant == 'snow2':
			for i in range(0, len(self.generatedCircles), 1):
				self.removeDots(i, (((i%2)+1)*2)%3, 3)
		elif self.options.variant == 'hexagon3':
			for i in range(0, len(self.generatedCircles), 2):
				self.removeDots(i, (i//2+1)%2, 2)
		elif self.options.variant == 'hexagon4':
			self.removeGroups(0, 4)
		elif self.options.variant == 'hexagon5' or self.options.variant == 'snow1':
			for i in range(0, len(self.generatedCircles), 2):
				self.removeDots(i, 1, 2)

		self.dotStyle = simplestyle.formatStyle({'fill': 'none','stroke':self.options.dotFill,'stroke-width':0.7})
		self.dotR = str((((self.options.innerDiameter * pi) / self.options.dotsPerCircle) / 2) * self.scale)
		self.generatedCircles = []
		if self.options.variant == 'snow2':
			self.options.dotsPerCircle = self.options.dotsPerCircle // 3
			self.computations(radians(self.options.angleOnFootside))
			self.generate()
		elif self.options.variant == 'snow1':
			self.generate()
			self.removeGroups(1, 2)
			for i in range(0, len(self.generatedCircles), 2):
				self.removeDots(i, i%4, 2)
			for i in range(0, len(self.generatedCircles), 2):
				self.removeDots(i, (i+1)%2, 2)
			for i in range(2, len(self.generatedCircles), 4):
				self.removeDots(i, 0, self.options.dotsPerCircle)
开发者ID:d-bl,项目名称:inkscape-bobbinlace,代码行数:52,代码来源:lace_polar.py

示例10: _merge_style

    def _merge_style(self, node, style):
        """Propagate style and transform to remove inheritance
        Originally from
        https://github.com/nikitakit/svg2sif/blob/master/synfig_prepare.py#L370
        """

        # Compose the style attribs
        this_style = simplestyle.parseStyle(node.get("style", ""))
        remaining_style = {}  # Style attributes that are not propagated

        # Filters should remain on the top ancestor
        non_propagated = ["filter"]
        for key in non_propagated:
            if key in this_style.keys():
                remaining_style[key] = this_style[key]
                del this_style[key]

        # Create a copy of the parent style, and merge this style into it
        parent_style_copy = style.copy()
        parent_style_copy.update(this_style)
        this_style = parent_style_copy

        # Merge in any attributes outside of the style
        style_attribs = ["fill", "stroke"]
        for attrib in style_attribs:
            if node.get(attrib):
                this_style[attrib] = node.get(attrib)
                del node.attrib[attrib]

        if (node.tag == addNS("svg", "svg")
            or node.tag == addNS("g", "svg")
            or node.tag == addNS("a", "svg")
            or node.tag == addNS("switch", "svg")):
            # Leave only non-propagating style attributes
            if len(remaining_style) == 0:
                if "style" in node.keys():
                    del node.attrib["style"]
            else:
                node.set("style", simplestyle.formatStyle(remaining_style))

        else:
            # This element is not a container

            # Merge remaining_style into this_style
            this_style.update(remaining_style)

            # Set the element's style attribs
            node.set("style", simplestyle.formatStyle(this_style))
开发者ID:brentini,项目名称:inkscape-ungroup-deep,代码行数:48,代码来源:ungroup_deep.py

示例11: draw_SVG_circle

def draw_SVG_circle(r, cx, cy, width, fill, name, parent):
    style = { 'stroke': '#000000', 'stroke-width':str(width), 'fill': fill }
    circ_attribs = {'style':simplestyle.formatStyle(style),
                    'cx':str(cx), 'cy':str(cy), 
                    'r':str(r),
                    inkex.addNS('label','inkscape'):name}
    circle = inkex.etree.SubElement(parent, inkex.addNS('circle','svg'), circ_attribs )
开发者ID:AakashDabas,项目名称:inkscape,代码行数:7,代码来源:grid_polar.py

示例12: addTextOnPath

 def addTextOnPath(self, node, x, y, text, id, anchor, startOffset, dy=0):
     new = inkex.etree.SubElement(node, inkex.addNS("textPath", "svg"))
     s = {
         "text-align": "center",
         "vertical-align": "bottom",
         "text-anchor": anchor,
         "font-size": str(self.options.fontsize),
         "fill-opacity": "1.0",
         "stroke": "none",
         "font-weight": "normal",
         "font-style": "normal",
         "fill": "#000000",
     }
     new.set("style", simplestyle.formatStyle(s))
     new.set(inkex.addNS("href", "xlink"), "#" + id)
     new.set("startOffset", startOffset)
     new.set("dy", str(dy))  # dubious merit
     # new.append(tp)
     if text[-2:] == "^2":
         appendSuperScript(new, "2")
         new.text = str(text)[:-2]
     else:
         new.text = str(text)
     # node.set('transform','rotate(180,'+str(-x)+','+str(-y)+')')
     node.set("x", str(x))
     node.set("y", str(y))
开发者ID:vinics,项目名称:inkscape,代码行数:26,代码来源:measure.py

示例13: change_attribute

 def change_attribute(self, node, attribute):
     for key, value in attribute.items():
         if key == 'preserveAspectRatio':
             # set presentation attribute
             if value != "unset":
                 node.set(key, str(value))
             else:
                 if node.get(key):
                     del node.attrib[key]
         elif key == 'image-rendering':
             node_style = simplestyle.parseStyle(node.get('style'))
             if key not in node_style:
                 # set presentation attribute
                 if value != "unset":
                     node.set(key, str(value))
                 else:
                     if node.get(key):
                         del node.attrib[key]
             else:
                 # set style property
                 if value != "unset":
                     node_style[key] = str(value)
                 else:
                     del node_style[key]
                 node.set('style', simplestyle.formatStyle(node_style))
         else:
             pass
开发者ID:Drooids,项目名称:inkscape,代码行数:27,代码来源:image_attributes.py

示例14: line

    def line(self,points):
        """
        Draw a line from point at (x1, y1) to point at (x2, y2).
        Style of line is hard coded and specified by 's'.
        """
        # define the motions
        path = ('M%.4f,%.4fL' % tuple(points[0][:2])) + 'L'.join([('%f,%f' % tuple(a[:2])) for a in points[1:]])

        # define the stroke style
        s = {'stroke-linejoin': 'miter', 
            'stroke-width': self.options.linewidth,
            'stroke-opacity': '1.0', 
            'fill-opacity': '1.0',
            'stroke': self.options.linecolor, 
            'stroke-linecap': 'round',
            'fill': 'none'
        }


        ## Attributes for new element
        attribs = {'style' : simplestyle.formatStyle(s),
                   'd' : path}

        ## Add new element
        inkex.etree.SubElement(self.current_layer, inkex.addNS('path', 'svg'), attribs)
开发者ID:d-bl,项目名称:inkscape-bobbinlace,代码行数:25,代码来源:lace_circular_ground.py

示例15: effect

	def effect(self):
		svg = self.document.getroot()
		width = float(self.document.getroot().get('width'))
		height = float(self.document.getroot().get('height'))
		
		group = inkex.etree.SubElement(self.current_layer, 'g', {
			inkex.addNS('label', 'inkscape') : 'Slider electrodes'
		})
		
		style = {
			'stroke'	: 'none',
			'fill'		: '#000000'
		}
		
		eWidth = width / self.options.count
		spikeWidth = 0.6 * eWidth
		
		for eid in range(self.options.count):
			if eid == 0:
				path = self.genPathString((eid * eWidth, 0, (eid + 1) * eWidth + 0.4 * spikeWidth, height), spikeWidth, first=True)
			elif eid == self.options.count - 1:
				path = self.genPathString((eid * eWidth - 0.4 * spikeWidth, 0, (eid + 1) * eWidth, height), spikeWidth, last=True)
			else:
				path = self.genPathString((eid * eWidth - 0.4 * spikeWidth, 0, (eid + 1) * eWidth + 0.4 * spikeWidth, height), spikeWidth)
		
			e = inkex.etree.SubElement(group, inkex.addNS('path', 'svg'), {
				'style' : simplestyle.formatStyle(style),
				'd' : path
			})
开发者ID:henningpohl,项目名称:Inkscape-Slider-Electrode-Generator,代码行数:29,代码来源:slider_electrodes.py


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