kopia lustrzana https://github.com/inkstitch/inkstitch
pep8
rodzic
6cdf990c76
commit
50493add9e
1
PyEmb.py
1
PyEmb.py
|
@ -66,6 +66,7 @@ class Point:
|
|||
def __len__(self):
|
||||
return 2
|
||||
|
||||
|
||||
class Stitch(Point):
|
||||
|
||||
def __init__(self, x, y, color=None, jump_stitch=False):
|
||||
|
|
16
embroider.py
16
embroider.py
|
@ -48,7 +48,9 @@ SVG_PATH_TAG = inkex.addNS('path', 'svg')
|
|||
SVG_DEFS_TAG = inkex.addNS('defs', 'svg')
|
||||
SVG_GROUP_TAG = inkex.addNS('g', 'svg')
|
||||
|
||||
|
||||
class EmbroideryElement(object):
|
||||
|
||||
def __init__(self, node, options):
|
||||
self.node = node
|
||||
self.options = options
|
||||
|
@ -76,12 +78,11 @@ class EmbroideryElement(object):
|
|||
return default
|
||||
|
||||
if param.endswith('_mm'):
|
||||
#print >> dbg, "get_float_param", param, value, "*", self.options.pixels_per_mm
|
||||
# print >> dbg, "get_float_param", param, value, "*", self.options.pixels_per_mm
|
||||
value = value * self.options.pixels_per_mm
|
||||
|
||||
return value
|
||||
|
||||
|
||||
def get_int_param(self, param, default=None):
|
||||
try:
|
||||
value = int(self.get_param(param, default))
|
||||
|
@ -175,6 +176,7 @@ class EmbroideryElement(object):
|
|||
|
||||
|
||||
class Fill(EmbroideryElement):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Fill, self).__init__(*args, **kwargs)
|
||||
|
||||
|
@ -463,6 +465,7 @@ class Fill(EmbroideryElement):
|
|||
|
||||
|
||||
class AutoFill(Fill):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(AutoFill, self).__init__(*args, **kwargs)
|
||||
|
||||
|
@ -598,7 +601,9 @@ class AutoFill(Fill):
|
|||
|
||||
return patches
|
||||
|
||||
|
||||
class Stroke(EmbroideryElement):
|
||||
|
||||
@property
|
||||
def color(self):
|
||||
return self.get_style("stroke")
|
||||
|
@ -693,7 +698,7 @@ class Stroke(EmbroideryElement):
|
|||
if self.is_running_stitch():
|
||||
patch = self.stroke_points(path, self.running_stitch_length, stroke_width=0.0)
|
||||
else:
|
||||
patch = self.stroke_points(path, self.zigzag_spacing/2.0, stroke_width=self.width)
|
||||
patch = self.stroke_points(path, self.zigzag_spacing / 2.0, stroke_width=self.width)
|
||||
|
||||
patches.append(patch)
|
||||
|
||||
|
@ -701,6 +706,7 @@ class Stroke(EmbroideryElement):
|
|||
|
||||
|
||||
class SatinColumn(EmbroideryElement):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SatinColumn, self).__init__(*args, **kwargs)
|
||||
|
||||
|
@ -842,7 +848,7 @@ class SatinColumn(EmbroideryElement):
|
|||
# we're currently on. <start_pos> is where along that line
|
||||
# segment we are. Return a new position and index.
|
||||
|
||||
#print >> dbg, "walk", start_pos, start_index, distance
|
||||
# print >> dbg, "walk", start_pos, start_index, distance
|
||||
|
||||
pos = start_pos
|
||||
index = start_index
|
||||
|
@ -1039,6 +1045,7 @@ class SatinColumn(EmbroideryElement):
|
|||
|
||||
|
||||
class Patch:
|
||||
|
||||
def __init__(self, color=None, stitches=None):
|
||||
self.color = color
|
||||
self.stitches = stitches or []
|
||||
|
@ -1123,6 +1130,7 @@ def emit_inkscape(parent, stitches):
|
|||
|
||||
|
||||
class Embroider(inkex.Effect):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
inkex.Effect.__init__(self)
|
||||
self.OptionParser.add_option("-r", "--row_spacing_mm",
|
||||
|
|
|
@ -12,6 +12,7 @@ import inkex
|
|||
|
||||
|
||||
class EmbroiderParams(inkex.Effect):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
inkex.Effect.__init__(self)
|
||||
|
||||
|
|
|
@ -11,11 +11,13 @@ import simplestyle
|
|||
|
||||
PIXELS_PER_MM = 10
|
||||
|
||||
|
||||
class EmbroiderParams(inkex.Effect):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
inkex.Effect.__init__(self)
|
||||
|
||||
self.mapping = { "zigzag_spacing": "zigzag_spacing_mm",
|
||||
self.mapping = {"zigzag_spacing": "zigzag_spacing_mm",
|
||||
"row_spacing": "row_spacing_mm",
|
||||
"pull_compensation": "pull_compensation_mm",
|
||||
"max_stitch_length": "max_stitch_length_mm",
|
||||
|
|
|
@ -10,6 +10,7 @@ import inkex
|
|||
|
||||
|
||||
class Reorder(inkex.Effect):
|
||||
|
||||
def get_selected_in_order(self):
|
||||
selected = []
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue