Added forgotten bool option

This commit is contained in:
Mario Voigt 2020-12-16 15:32:29 +01:00
parent 02c98d0b79
commit 171133fa7f

View File

@ -26,7 +26,7 @@ class Cleanup(inkex.Effect):
inkex.Effect.__init__(self) inkex.Effect.__init__(self)
self.arg_parser.add_argument("--stroke_width", type=float, default=0.1, help="Stroke width") self.arg_parser.add_argument("--stroke_width", type=float, default=0.1, help="Stroke width")
self.arg_parser.add_argument("--stroke_units", default="mm", help="Stroke unit") self.arg_parser.add_argument("--stroke_units", default="mm", help="Stroke unit")
self.arg_parser.add_argument("--remove_styles", default="mm", help="Remove stroke styles") self.arg_parser.add_argument("--remove_styles", type=inkex.Boolean, help="Remove stroke styles")
self.arg_parser.add_argument("--opacity", type=float, default="100.0", help="Opacity") self.arg_parser.add_argument("--opacity", type=float, default="100.0", help="Opacity")
def effect(self): def effect(self):
@ -57,16 +57,17 @@ class Cleanup(inkex.Effect):
if prop == 'stroke-opacity': if prop == 'stroke-opacity':
new_val = str(self.options.opacity / 100) new_val = str(self.options.opacity / 100)
declarations[i] = prop + ':' + new_val declarations[i] = prop + ':' + new_val
if prop == 'stroke-dasharray': if self.options.remove_styles == True:
declarations[i] = '' if prop == 'stroke-dasharray':
if prop == 'stroke-dashoffset': declarations[i] = ''
declarations[i] = '' if prop == 'stroke-dashoffset':
if prop == 'stroke-linejoin': declarations[i] = ''
declarations[i] = '' if prop == 'stroke-linejoin':
if prop == 'stroke-linecap': declarations[i] = ''
declarations[i] = '' if prop == 'stroke-linecap':
if prop == 'stroke-miterlimit': declarations[i] = ''
declarations[i] = '' if prop == 'stroke-miterlimit':
declarations[i] = ''
node.set('style', ';'.join(declarations)) node.set('style', ';'.join(declarations))
if __name__ == '__main__': if __name__ == '__main__':