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

Bug #1258473 reported by su_v
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
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)
description: updated
tags: added: units
su_v (suv-lp)
description: updated
Revision history for this message
jazzynico (jazzynico) wrote :

Reproduced on Crunchbang Waldorf, Inkscape trunk revision 12840.

Changed in inkscape:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Alvin Penner (apenner) wrote :

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

Revision history for this message
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...

Revision history for this message
Alvin Penner (apenner) wrote :

committed to rev 13027

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.