fit for inkscape 1.3+

This commit is contained in:
devdesk
2025-10-23 19:34:20 +03:00
parent 9fd2ec24e1
commit 6adfb97eab
2 changed files with 10 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
<_name>LY Drawbot tool by Love Open Design</_name> <_name>LY Drawbot tool by Love Open Design</_name>
<id>love-open-design.com</id> <id>love-open-design.com</id>
<dependency type="executable" location="inx">plotter-lod.py</dependency> <dependency type="executable" location="inx">plotter-lod.py</dependency>
<dependency type="executable" location="extensions">inkex.py</dependency> <dependency type="executable" location="extensions">inkex</dependency>
<param name="plotter-command" type="string" _gui-text="Drawing ON Command:">M03</param> <param name="plotter-command" type="string" _gui-text="Drawing ON Command:">M03</param>
<param name="plotter-off-command" type="string" _gui-text="Drawing OFF Command:">M05</param> <param name="plotter-off-command" type="string" _gui-text="Drawing OFF Command:">M05</param>

View File

@@ -804,6 +804,8 @@ class LaserGcode(inkex.Effect):
def check_dir(self): def check_dir(self):
if not self.options.directory:
self.options.directory = os.getcwd() + "/"
if self.options.directory[-1] not in ["/", "\\"]: if self.options.directory[-1] not in ["/", "\\"]:
if "\\" in self.options.directory: if "\\" in self.options.directory:
self.options.directory += "\\" self.options.directory += "\\"
@@ -938,7 +940,7 @@ class LaserGcode(inkex.Effect):
if 'transform' in list(g.keys()): if 'transform' in list(g.keys()):
t = g.get('transform') t = g.get('transform')
t = [list(row) for row in Transform(t).matrix] t = [list(row) for row in Transform(t).matrix]
trans = [list(row) for row in (Transform(t) * Transform(trans)).matrix] if trans != [] else t trans = [list(row) for row in (Transform(t) @ Transform(trans)).matrix] if trans != [] else t
print_(trans) print_(trans)
g = g.getparent() g = g.getparent()
return trans return trans
@@ -1072,15 +1074,15 @@ class LaserGcode(inkex.Effect):
active_layer_already_has_tool active_layer_already_has_tool
active_layer_already_has_orientation_points active_layer_already_has_orientation_points
""" """
if type_.lower() in re.split("[\s\n,\.]+", errors.lower()): if type_.lower() in re.split(r"[\s\n,\.]+", errors.lower()):
print_(s) print_(s)
inkex.errormsg(s + "\n") inkex.errormsg(s + "\n")
sys.exit() sys.exit()
elif type_.lower() in re.split("[\s\n,\.]+", warnings.lower()): elif type_.lower() in re.split(r"[\s\n,\.]+", warnings.lower()):
print_(s) print_(s)
if not self.options.suppress_all_messages: if not self.options.suppress_all_messages:
inkex.errormsg(s + "\n") inkex.errormsg(s + "\n")
elif type_.lower() in re.split("[\s\n,\.]+", notes.lower()): elif type_.lower() in re.split(r"[\s\n,\.]+", notes.lower()):
print_(s) print_(s)
else: else:
print_(s) print_(s)
@@ -1202,7 +1204,7 @@ class LaserGcode(inkex.Effect):
for path in self.selected_paths[layer]: for path in self.selected_paths[layer]:
if self.options.dxfpoints_action == 'replace': if self.options.dxfpoints_action == 'replace':
path.set("dxfpoint", "1") path.set("dxfpoint", "1")
r = re.match("^\s*.\s*(\S+)", path.get("d")) r = re.match(r"^\s*.\s*(\S+)", path.get("d"))
if r != None: if r != None:
print_(("got path=", r.group(1))) print_(("got path=", r.group(1)))
path.set("d", path.set("d",
@@ -1429,6 +1431,8 @@ class LaserGcode(inkex.Effect):
options.doc_root = self.document.getroot() options.doc_root = self.document.getroot()
# define print_ function # define print_ function
global print_ global print_
self.options.log_create_log = True # Force enable for verbose logging
self.options.log_filename = os.path.expanduser("~/log.log")
if self.options.log_create_log: if self.options.log_create_log:
try: try:
if os.path.isfile(self.options.log_filename): os.remove(self.options.log_filename) if os.path.isfile(self.options.log_filename): os.remove(self.options.log_filename)