trunk: ink2canvas for stroked objects fails with "AttributeError: 'module' object has no attribute 'unittouu'"

Bug #1258473 reported by su_v on 2013-12-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Medium
Alvin Penner

Bug Description

Steps to reproduce:
1) launch current trunk (default (new) prefs, default not-localized template)
2) draw a rectangle
3) change stroke width to any value ≠ 1 px
4) save a copy as 'HTML 5 canvas (*.html)'

Saving fails with this error message:

Traceback (most recent call last):
  File "ink2canvas.py", line 89, in <module>
    ink.affect()
  File "/custom/prefix/share/inkscape/extensions/inkex.py", line 245, in affect
    self.effect()
  File "ink2canvas.py", line 84, in effect
    self.walk_tree(svg_root)
  File "ink2canvas.py", line 75, in walk_tree
    self.walk_tree(node)
  File "ink2canvas.py", line 74, in walk_tree
    elem.draw()
  File "/custom/prefix/share/inkscape/extensions/ink2canvas/svg.py", line 134, in draw
    self.set_style(style)
  File "/custom/prefix/share/inkscape/extensions/ink2canvas/svg.py", line 86, in set_style
    getattr(self.ctx, method)(style[key])
  File "/custom/prefix/share/inkscape/extensions/ink2canvas/canvas.py", line 120, in setStrokeWidth
    self.write("ctx.lineWidth = %f;" % inkex.unittouu(value))
AttributeError: 'module' object has no attribute 'unittouu'

Simply changing 'inkex.unittouu' to 'self.unittouu' does not work in this case.

AFAIU this regression is related to the changes in revision 12722:
<http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/12722>

Backtrace produced with r12839 on OS X 10.7.5.

su_v (suv-lp) on 2013-12-06
description: updated
tags: added: units
su_v (suv-lp) on 2013-12-06
description: updated
jazzynico (jazzynico) wrote :

Reproduced on Crunchbang Waldorf, Inkscape trunk revision 12840.

Changed in inkscape:
importance: Undecided → Medium
status: New → Triaged
Alvin Penner (apenner) wrote :

I believe the crash is fixed with the following two updated files : ink2canvas.py

Alvin Penner (apenner) wrote :

and the subdirectory file : ink2canvas/canvas.py

however, I am not familiar enough with html to know whether the resulting scaling behaviour is the intended behaviour or not, so I am just posting it here for comment...

Alvin Penner (apenner) wrote :

committed to rev 13027

Changed in inkscape:
status: Triaged → Fix Committed
su_v (suv-lp) on 2014-02-13
Changed in inkscape:
assignee: nobody → Alvin Penner (apenner)
Bryce Harrington (bryce) on 2015-02-23
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers