kopia lustrzana https://github.com/inkstitch/inkstitch
rodzic
9b3950137d
commit
e87fe0cce7
|
@ -58,7 +58,15 @@ class DanglingRungWarning(ValidationWarning):
|
|||
description = _("Satin column: A rung doesn't intersect both rails.") + " " + rung_message
|
||||
|
||||
|
||||
class UnequalPointsWarning(ValidationError):
|
||||
class TwoRungsWarning(ValidationWarning):
|
||||
name = _("Satin has exactly two rungs")
|
||||
description = _("Satin column: There are exactly two rungs. This may lead to false rail/rung detection.")
|
||||
steps_to_solve = [
|
||||
_("Add an other rung.")
|
||||
]
|
||||
|
||||
|
||||
class UnequalPointsWarning(ValidationWarning):
|
||||
name = _("Unequal number of points")
|
||||
description = _("Satin column: There are no rungs and rails have an unequal number of points.")
|
||||
steps_to_solve = [
|
||||
|
@ -668,6 +676,8 @@ class SatinColumn(EmbroideryElement):
|
|||
return sections
|
||||
|
||||
def validation_warnings(self):
|
||||
if len(self.csp) == 4:
|
||||
yield TwoRungsWarning(self.flattened_rails[0].interpolate(0.5, normalized=True))
|
||||
if len(self.csp) == 2 and len(self.rails[0]) != len(self.rails[1]):
|
||||
yield UnequalPointsWarning(self.flattened_rails[0].interpolate(0.5, normalized=True))
|
||||
for rung in self.flattened_rungs:
|
||||
|
|
|
@ -29,12 +29,16 @@ class SelectElements(InkstitchExtension):
|
|||
pars.add_argument("--select-polyline", type=Boolean, dest="poly", default=False)
|
||||
pars.add_argument("--select-satin", type=Boolean, dest="satin", default=False)
|
||||
pars.add_argument("--satin-underlay", type=str, dest="satin_underlay", default="all")
|
||||
pars.add_argument("--rung-count", type=str, dest="rung_count", default="all")
|
||||
pars.add_argument("--select-e", type=Boolean, dest="e", default=False)
|
||||
pars.add_argument("--select-s", type=Boolean, dest="s", default=False)
|
||||
pars.add_argument("--select-satin-zigzag", type=Boolean, dest="satin_zigzag", default=False)
|
||||
pars.add_argument("--select-auto-fill", type=Boolean, dest="fill", default=False)
|
||||
pars.add_argument("--select-contour-fill", type=Boolean, dest="contour", default=False)
|
||||
pars.add_argument("--select-guided-fill", type=Boolean, dest="guided", default=False)
|
||||
pars.add_argument("--select-meander-fill", type=Boolean, dest="meander", default=False)
|
||||
pars.add_argument("--select-circular-fill", type=Boolean, dest="circular", default=False)
|
||||
pars.add_argument("--select-linear-gradient-fill", type=Boolean, dest="linear_gradient", default=False)
|
||||
pars.add_argument("--select-legacy-fill", type=Boolean, dest="legacy", default=False)
|
||||
pars.add_argument("--fill-underlay", type=str, dest="fill_underlay", default="all")
|
||||
pars.add_argument("--select-clone", type=Boolean, dest="clone", default=False)
|
||||
|
@ -45,11 +49,12 @@ class SelectElements(InkstitchExtension):
|
|||
py_path, file_path = self._get_paths()
|
||||
id_list = self._get_id_list()
|
||||
|
||||
subprocess.Popen(
|
||||
[py_path, 'select_elements.py', id_list],
|
||||
cwd=file_path,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL)
|
||||
with subprocess.Popen(
|
||||
[py_path, 'select_elements.py', id_list],
|
||||
cwd=file_path,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL) as proc:
|
||||
proc.wait()
|
||||
|
||||
def _get_paths(self):
|
||||
file_path = get_bundled_dir("dbus")
|
||||
|
@ -127,6 +132,8 @@ class SelectElements(InkstitchExtension):
|
|||
select = True
|
||||
elif self.options.circular and method == 'circular_fill':
|
||||
select = True
|
||||
elif self.options.linear_gradient and method == 'linear_gradient_fill':
|
||||
select = True
|
||||
elif self.options.legacy and method == 'legacy_fill':
|
||||
select = True
|
||||
return select
|
||||
|
@ -144,11 +151,17 @@ class SelectElements(InkstitchExtension):
|
|||
select = False
|
||||
if not self._select_satin_underlay(element):
|
||||
return False
|
||||
if not self._select_rung_count(element):
|
||||
return False
|
||||
method = element.satin_method
|
||||
if self.options.satin and method == "satin_column":
|
||||
select = True
|
||||
elif self.options.e and method == "e_stitch":
|
||||
select = True
|
||||
elif self.options.s and method == "s_stitch":
|
||||
select = True
|
||||
elif self.options.satin_zigzag and method == "zigzag":
|
||||
select = True
|
||||
return select
|
||||
|
||||
def _select_satin_underlay(self, element):
|
||||
|
@ -160,6 +173,13 @@ class SelectElements(InkstitchExtension):
|
|||
underlay['all'] = True
|
||||
return underlay[self.options.satin_underlay]
|
||||
|
||||
def _select_rung_count(self, element):
|
||||
rung_count = {'all': None, 'zero': None, 'two': None}
|
||||
rung_count['zero'] = len(element.paths) == 2
|
||||
rung_count['two'] = len(element.paths) == 4
|
||||
rung_count['all'] = True
|
||||
return rung_count[self.options.rung_count]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
SelectElements().run()
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
<label>Satin</label>
|
||||
<param indent="1" name="select-satin" type="boolean" gui-text="Satin Column">false</param>
|
||||
<param indent="1" name="select-e" type="boolean" gui-text="E-Stitch">false</param>
|
||||
<param indent="1" name="select-s" type="boolean" gui-text="S-Stitch">false</param>
|
||||
<param indent="1" name="select-satin-zigzag" type="boolean" gui-text="Zig-Zag">false</param>
|
||||
<param indent="1" name="satin-underlay" type="optiongroup" appearance="combo" gui-text="Underlay"
|
||||
gui-description="Only select satins with this underlay type">
|
||||
<option value="all">No restriction</option>
|
||||
|
@ -37,6 +39,12 @@
|
|||
<option value="contour">Contour</option>
|
||||
<option value="zigzag">Zigzag</option>
|
||||
</param>
|
||||
<param indent="1" name="rung-count" type="optiongroup" appearance="combo" gui-text="Rung count"
|
||||
gui-description="Only select satins with this rung count">
|
||||
<option value="all">No restriction</option>
|
||||
<option value="zero">No Rungs</optiagon>
|
||||
<option value="two">Two Rungs</option>
|
||||
</param>
|
||||
</vbox>
|
||||
<spacer />
|
||||
<separator />
|
||||
|
@ -44,10 +52,11 @@
|
|||
<vbox>
|
||||
<label>Fill</label>
|
||||
<param indent="1" name="select-auto-fill" type="boolean" gui-text="Fill">false</param>
|
||||
<param indent="1" name="select-circular-fill" type="boolean" gui-text="Circular Fill">false</param>
|
||||
<param indent="1" name="select-contour-fill" type="boolean" gui-text="Contour Fill">false</param>
|
||||
<param indent="1" name="select-guided-fill" type="boolean" gui-text="Guided Fill">false</param>
|
||||
<param indent="1" name="select-linear-gradient-fill" type="boolean" gui-text="Linear Gradient Fill">false</param>
|
||||
<param indent="1" name="select-meander-fill" type="boolean" gui-text="Meander Fill">false</param>
|
||||
<param indent="1" name="select-circular-fill" type="boolean" gui-text="Circular Fill">false</param>
|
||||
<param indent="1" name="select-legacy-fill" type="boolean" gui-text="Legacy Fill">false</param>
|
||||
<param indent="1" name="fill-underlay" type="optiongroup" appearance="combo" gui-text="Underlay"
|
||||
gui-description="Only select fills with this underlay">
|
||||
|
|
Ładowanie…
Reference in New Issue