diff options
Diffstat (limited to 'lib/extensions/select_elements.py')
| -rw-r--r-- | lib/extensions/select_elements.py | 30 |
1 files changed, 25 insertions, 5 deletions
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() |
