Commit 761029d1 authored by kumy's avatar kumy Committed by Martin Owens

Fix #280: Add ability to set group ID on generated QRcode

parent 084022a0
......@@ -45,6 +45,8 @@
<param name="smoothval" type="float" min="0.01" max="1.0" precision="2" gui-text="Smooth square value (0-1):">0.2</param>
<label xml:space="preserve">For Path: custom set the path in relative coordinates (0,0)=(left,up) square size 1.0 </label>
<param name="symbolid" type="string" gui-text="Path string (Path: custom) or symbol #url:">m 0,1 l 0.5,-1 l 0.5,1</param>
<label xml:space="preserve">Manually define the group ID. Leave blank to have it auto-generated.</label>
<param name="groupid" type="string" gui-text="Group ID:"></param>
<effect>
<object-type>all</object-type>
<effects-menu>
......
......@@ -877,6 +877,7 @@ class QrCode(inkex.GenerateExtension):
pars.add_argument("--drawtype", default="greedy")
pars.add_argument("--smoothval", type=float, default=0.2)
pars.add_argument("--symbolid", default='')
pars.add_argument("--groupid", default='')
def generate(self):
......@@ -898,6 +899,8 @@ class QrCode(inkex.GenerateExtension):
grp = Group()
grp.set('inkscape:label', 'QR Code: ' + text_str)
if opt.groupid:
grp.set('id', opt.groupid)
pos_x, pos_y = self.svg.namedview.center
grp.transform.add_translate(pos_x, pos_y)
if scale:
......
......@@ -11,6 +11,7 @@ class TestQRCodeInkscapeBasic(ComparisonMixin, TestCase):
('--text=BreadRolls', '--typenumber=2', '--encoding=utf8'),
('--text=Blue Front Yard', '--typenumber=3', '--correctionlevel=1'),
('--text=Waterfall', '--typenumber=1', '--drawtype=circle'),
('--text=groupid', '--groupid=testid'),
]
class TestQRCodeInkscapeSymbol(ComparisonMixin, TestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment