Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Menu
Projects
Groups
Snippets
Sign up now
Login
Sign in / Register
Toggle navigation
Menu
Open sidebar
Inkscape
extensions
Commits
60abf805
Commit
60abf805
authored
Jul 28, 2020
by
Nathan Lee
Committed by
Martin Owens
Aug 17, 2020
Browse files
Fix hpgl output: pen number regex
Fix
#275
parent
d8750d09
Changes
1
Hide whitespace changes
Inline
Side-by-side
hpgl_encoder.py
View file @
60abf805
...
...
@@ -32,7 +32,7 @@ class NoPathError(ValueError):
"""Raise that paths not selected"""
# Find the pen number in the layer number
FIND_PEN
=
re
.
compile
(
r
'
(
\s
|\A)
pen\s*(\d+)
(
\s
|\Z)'
)
FIND_PEN
=
re
.
compile
(
r
'\s
*
pen\s*(\d+)\s
*'
,
re
.
IGNORECASE
)
class
hpglEncoder
(
object
):
"""HPGL Encoder, used by others"""
...
...
@@ -190,9 +190,9 @@ class hpglEncoder(object):
def
get_pen_number
(
self
,
node
):
"""Get pen number for node label (usually group)"""
for
parent
in
[
node
]
+
list
(
node
.
ancestors
().
values
()):
match
=
fullmatch
(
FIND_PEN
,
parent
.
label
or
''
,
re
.
IGNORECASE
)
match
=
fullmatch
(
FIND_PEN
,
parent
.
label
or
''
)
if
match
:
return
int
(
match
.
group
(
2
))
return
int
(
match
.
group
(
1
))
return
int
(
self
.
options
.
pen
)
def
process_path
(
self
,
node
,
transform
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment