summaryrefslogtreecommitdiff
path: root/lib/extensions/update_svg.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2025-03-02 20:54:56 +0100
committerGitHub <noreply@github.com>2025-03-02 20:54:56 +0100
commitdc23265d2d2619ef6cb1c701480fc4ba10fafc77 (patch)
treecd3f13c3f1b1dcc06704136cea9b9a00a7b70656 /lib/extensions/update_svg.py
parent70d2ea52c412eb983a6d6037f1bb0ec1258196c1 (diff)
Use symbol as command position (#3542)
Diffstat (limited to 'lib/extensions/update_svg.py')
-rw-r--r--lib/extensions/update_svg.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/lib/extensions/update_svg.py b/lib/extensions/update_svg.py
index f620af2d..d51c1fa1 100644
--- a/lib/extensions/update_svg.py
+++ b/lib/extensions/update_svg.py
@@ -3,9 +3,6 @@
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-from inkex import errormsg
-
-from ..i18n import _
from ..update import update_inkstitch_document
from .base import InkstitchExtension
@@ -14,24 +11,22 @@ class UpdateSvg(InkstitchExtension):
def __init__(self, *args, **kwargs):
InkstitchExtension.__init__(self, *args, **kwargs)
+ self.arg_parser.add_argument("--update-from", type=int, default=0, dest="update_from")
# inkstitch_svg_version history:
# 1 -> v3.0.0, May 2023
# 2 -> v.3.1.0 May 2024
-
- # TODO: When there are more legacy versions than only one, this can be transformed into a user input
- self.update_from = 0
+ # 3 -> v.3.2.0 May2025
def effect(self):
if not self.svg.selection:
- errormsg(_('Please select at least one element to update. '
- 'This extension is designed to help you update copy and pasted elements from old designs.'))
-
- # set the file version to the update_from value, so that the updater knows where to start from
- # the updater will then reset it to the current version after the update has finished
- metadata = self.get_inkstitch_metadata()
- metadata['inkstitch_svg_version'] = self.update_from
-
- update_inkstitch_document(self.document, self.get_selection())
+ update_inkstitch_document(self.document, warn_unversioned=False)
+ else:
+ # set the file version to the update_from value, so that the updater knows where to start from
+ # the updater will then reset it to the current version after the update has finished
+ metadata = self.get_inkstitch_metadata()
+ metadata['inkstitch_svg_version'] = self.options.update_from
+
+ update_inkstitch_document(self.document, self.get_selection(), warn_unversioned=False)
def get_selection(self):
selection = []