summaryrefslogtreecommitdiffstats
path: root/share/extensions/plotter.py
diff options
context:
space:
mode:
authorSebastian Wüst <sebi@timewaster.de>2014-03-02 20:27:16 +0000
committerSebastian Wüst <sebi@timewaster.de>2014-03-02 20:27:16 +0000
commit3174646c68a76a61bf130d76dd6fc11976074f31 (patch)
tree49d579ad453a46a282a05566bb940c6b8fddb529 /share/extensions/plotter.py
parentAvoid crashing when the document is set to NULL (upon cleanup, window closing... (diff)
downloadinkscape-3174646c68a76a61bf130d76dd6fc11976074f31.tar.gz
inkscape-3174646c68a76a61bf130d76dd6fc11976074f31.zip
cleanup
(bzr r13093)
Diffstat (limited to 'share/extensions/plotter.py')
-rw-r--r--share/extensions/plotter.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/share/extensions/plotter.py b/share/extensions/plotter.py
index 056a90fe3..be59f604b 100644
--- a/share/extensions/plotter.py
+++ b/share/extensions/plotter.py
@@ -30,7 +30,7 @@ import inkex
inkex.localize()
-class MyEffect(inkex.Effect):
+class Plot(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
@@ -70,16 +70,17 @@ class MyEffect(inkex.Effect):
raise ValueError, ('', type, value), traceback
# TODO: Get preview to work. This requires some work on the C++ side to be able to determine if it is
# a preview or a final run. (Remember to set <effect needs-live-preview='false'> to true)
- # This outcommented code has a user unit issue (getSvg produces px, docWidth could be mm or something else)
'''
- # reparse data for preview
- self.options.showMovements = True
- self.options.docWidth = float(self.unittouu(self.document.getroot().get('width')))
- self.options.docHeight = float(self.unittouu(self.document.getroot().get('height')))
- myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options)
- doc, warnings = myHpglDecoder.getSvg()
- # deliver document to inkscape
- self.document = doc
+ if MAGIC:
+ # reparse data for preview
+ self.options.showMovements = True
+ self.options.docWidth = self.uutounit(self.unittouu(self.document.getroot().get('width')), "px")
+ self.options.docHeight = self.uutounit(self.unittouu(self.document.getroot().get('height')), "px")
+ myHpglDecoder = hpgl_decoder.hpglDecoder(self.hpgl, self.options)
+ doc, warnings = myHpglDecoder.getSvg()
+ # deliver document to inkscape
+ self.document = doc
+ else:
'''
# convert to other formats
if self.options.commandLanguage == 'DMPL':
@@ -207,7 +208,7 @@ class MyEffect(inkex.Effect):
if __name__ == '__main__':
# start extension
- e = MyEffect()
+ e = Plot()
e.affect()
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99 \ No newline at end of file