From c9cb2fe8f4d5a923ccbdc2c9897f4f8bb2e3c2bc Mon Sep 17 00:00:00 2001 From: andrea Date: Fri, 30 Jan 2026 23:04:33 +0100 Subject: [PATCH] fix missing elements --- example.svg | 768 ++------------------------------- inkscape_uprint.code-workspace | 11 - inkscape_uprint.py | 25 +- 3 files changed, 54 insertions(+), 750 deletions(-) delete mode 100644 inkscape_uprint.code-workspace diff --git a/example.svg b/example.svg index 4c7dd8b..403b13a 100644 --- a/example.svg +++ b/example.svg @@ -23,34 +23,16 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" - inkscape:zoom="0.73762626" - inkscape:cx="612.0986" - inkscape:cy="446.02533" - inkscape:window-width="1920" - inkscape:window-height="1021" + inkscape:zoom="0.18440657" + inkscape:cx="555.83704" + inkscape:cy="444.66963" + inkscape:window-width="1366" + inkscape:window-height="709" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" - inkscape:current-layer="layer1"> - - - - + inkscape:current-layer="layer1" + showgrid="false" /> INSTRUCTIONS: + id="tspan1">INSTRUCTIONS: + id="tspan7"> 1. Create any shape with text whwere you like, put text in a 1. Create any shape with text whwere you like, put text in a frame as much as possible ( multiline substitution works in frame as much as possible ( multiline substitution works in framed text only ) + id="tspan34">framed text only ) + id="tspan35"> 2. place {{tags}} where you like in the text + id="tspan36">2. place {{tags}} where you like in the text + id="tspan37"> 3. apply any transform to the shape + id="tspan38">3. apply any transform to the shape + id="tspan39"> 4. group anything together but do not apply any transform to 4. group anything together but do not apply any transform to the group afterwards. If you need to ungroup make what you the group afterwards. If you need to ungroup make what you like ( translate, rotate, scale ) and then regroup everything like ( translate, rotate, scale ) and then regroup everything together. The changes applied to the toplevel group are together. The changes applied to the toplevel group are affecting the position of the shape after the placement on the affecting the position of the shape after the placement on the output pages. + id="tspan45">output pages. + id="tspan46"> 5. Select the group and apply InkscapeUprint. The parameters 5. Select the group and apply InkscapeUprint. The parameters are: + id="tspan48">are: padding: padding space among placed shapes + id="tspan49"> padding: padding space among placed shapes page margins: From the page to the page collection + id="tspan50"> page margins: From the page to the page collection The size of the output pages is copied from the model one + id="tspan51"> The size of the output pages is copied from the model one {{affiliazione}} + id="tspan52">{{affiliazione}} @@ -391,693 +373,7 @@ style="font-size:10.6667px;line-height:normal;font-family:'URW Gothic';-inkscape-font-specification:'URW Gothic';text-align:center;text-decoration-color:#000000;white-space:pre;shape-inside:url(#rect7);shape-padding:8.48145;display:inline;fill:#1a1a1a;fill-opacity:0.99;stroke-width:3">{{affiliazione}} - - - - - HarrisonWells - STAFF - - - Central City University -Head of sustainability of disasters dept. - - - - - BarryAllen - FLASH - - - S.T.A.T. Labs research center -Professional speedster - - - - - IrisWest - PRESS - - - self employed -Journalist and story teller without talent - - - - - KillerFrost - MD - - - Medical Doctor -Carnaval General Hospital - - - - - ThomasCavanagh - ACTOR - - - - - - - - HarrisonWells - STAFF - - - - - Central City University -Head of sustainability of disasters dept. - - - - - BarryAllen - FLASH - - - - - S.T.A.T. Labs research center -Professional speedster - - - - - IrisWest - PRESS - - - - - self employed -Journalist and story teller without talent - - - - - KillerFrost - MD - - - - - Medical Doctor -Carnaval General Hospital - - - - - ThomasCavanagh - ACTOR - - - - - + id="tspan53">{{affiliazione}} diff --git a/inkscape_uprint.code-workspace b/inkscape_uprint.code-workspace deleted file mode 100644 index eba5d12..0000000 --- a/inkscape_uprint.code-workspace +++ /dev/null @@ -1,11 +0,0 @@ -{ - "folders": [ - { - "path": "." - }, - { - "path": "../../../../../usr/share/inkscape/extensions/inkex" - } - ], - "settings": {} -} \ No newline at end of file diff --git a/inkscape_uprint.py b/inkscape_uprint.py index 2cb699c..2db0aaa 100755 --- a/inkscape_uprint.py +++ b/inkscape_uprint.py @@ -159,15 +159,35 @@ class InkscapeUprint(inkex.Effect): l.extend(self.svg_traverse_node(child)) return l + def draw_tick(self, page, pos, length, direction, parent): + x1,y1 = pos + x2,y2 = pos * direction + + line_style = { 'stroke': '#000000', + 'stroke-width': '0.2', + 'fill': 'none' + } + + line_attribs = {'style' : str(inkex.Style(line_style)), + inkex.addNS('label','inkscape') : "none", + 'd' : 'M '+str(x1) +',' + + str(y1) +' L '+str(x2) + +','+str(y2) } + + line = etree.SubElement(parent, inkex.addNS('path','svg'), line_attribs ) + return line + def replace_text(self, selected, substs): import re for node in selected: tspans = [ n for n in self.svg_traverse_node(node, tag='tspan')] for k,v in substs.items(): - patt = re.compile(r'\{\{' + re.escape(k) + r'\}\}') + if k is None: + continue + patt = re.compile(r'\{\{' + re.escape(str(k)) + r'\}\}') for t in tspans: if t.text is None: continue - t.text = patt.sub(v, t.text) + t.text = patt.sub(str(v), t.text) # multilines = t.text.split('\n') # if len(multilines) > 1: # t.text = multilines[0] @@ -313,4 +333,3 @@ class InkscapeUprint(inkex.Effect): if __name__ == '__main__': e = InkscapeUprint() e.run() -