summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/elements/satin_column.py12
-rw-r--r--lib/extensions/select_elements.py30
2 files changed, 36 insertions, 6 deletions
diff --git a/lib/elements/satin_column.py b/lib/elements/satin_column.py
index 3daf1085..54ae02d5 100644
--- a/lib/elements/satin_column.py
+++ b/lib/elements/satin_column.py
@@ -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:
diff --git a/lib/extensions/select_elements.py b/lib/extensions/select_elements.py
index 55aae46c..a8fac466 100644
--- a/lib/extensions/select_elements.py
+++ b/lib/extensions/select_elements.py
@@ -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()