e97dbe3cccc8b873b529cd251a26684fec2bac96apenner# coding=utf-8
5051b59af15dfa3ae44b4bf4f10981649d37ff0eSebastian WüstCopyright (C) 2013 Sebastian Wüst, sebi@timewaster.de
e97dbe3cccc8b873b529cd251a26684fec2bac96apennerThis program is free software; you can redistribute it and/or modify
e97dbe3cccc8b873b529cd251a26684fec2bac96apennerit under the terms of the GNU General Public License as published by
e97dbe3cccc8b873b529cd251a26684fec2bac96apennerthe Free Software Foundation; either version 2 of the License, or
e97dbe3cccc8b873b529cd251a26684fec2bac96apenner(at your option) any later version.
e97dbe3cccc8b873b529cd251a26684fec2bac96apennerThis program is distributed in the hope that it will be useful,
e97dbe3cccc8b873b529cd251a26684fec2bac96apennerbut WITHOUT ANY WARRANTY; without even the implied warranty of
e97dbe3cccc8b873b529cd251a26684fec2bac96apennerMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e97dbe3cccc8b873b529cd251a26684fec2bac96apennerGNU General Public License for more details.
e97dbe3cccc8b873b529cd251a26684fec2bac96apennerYou should have received a copy of the GNU General Public License
e97dbe3cccc8b873b529cd251a26684fec2bac96apenneralong with this program; if not, write to the Free Software
107e00c8104649437b9520d0ba298dba659e7cd7JazzyNicoFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
5051b59af15dfa3ae44b4bf4f10981649d37ff0eSebastian Wüst# standard libraries
5051b59af15dfa3ae44b4bf4f10981649d37ff0eSebastian Wüst# local libraries
e97dbe3cccc8b873b529cd251a26684fec2bac96apenner# parse options
7eeb834ef21e18fe242fcc0b7ab161daa31bb0fcSebastian Wüstparser = inkex.optparse.OptionParser(usage='usage: %prog [options] HPGLfile', option_class=inkex.InkOption)
7eeb834ef21e18fe242fcc0b7ab161daa31bb0fcSebastian Wüstparser.add_option('--resolutionX', action='store', type='float', dest='resolutionX', default=1016.0, help='Resolution X (dpi)')
7eeb834ef21e18fe242fcc0b7ab161daa31bb0fcSebastian Wüstparser.add_option('--resolutionY', action='store', type='float', dest='resolutionY', default=1016.0, help='Resolution Y (dpi)')
7eeb834ef21e18fe242fcc0b7ab161daa31bb0fcSebastian Wüstparser.add_option('--showMovements', action='store', type='inkbool', dest='showMovements', default='FALSE', help='Show Movements between paths')
e97dbe3cccc8b873b529cd251a26684fec2bac96apenner(options, args) = parser.parse_args(inkex.sys.argv[1:])
86776d459a74b8432bbeee60fe796db6403afe7eSebastian Wüst# needed to initialize the document
8b65722621bfa3a76feef34a9d3b7de60544140fSebastian Wüst# combine all lines
7eeb834ef21e18fe242fcc0b7ab161daa31bb0fcSebastian Wüst# interpret HPGL data
7eeb834ef21e18fe242fcc0b7ab161daa31bb0fcSebastian WüstmyHpglDecoder = hpgl_decoder.hpglDecoder(hpglString, options)
7eeb834ef21e18fe242fcc0b7ab161daa31bb0fcSebastian Wüst # issue error if no hpgl data found
933dce1d63c0de5b9b9323e3c6ac3ed6fc50c342Sebastian Wüst raise ValueError, ("", type, value), traceback
7cc5285e0a99d8e121e75abfdfea3474dcd6a86dSebastian Wüst# issue warning if unknown commands where found
7cc5285e0a99d8e121e75abfdfea3474dcd6a86dSebastian Wüst inkex.errormsg(_("The HPGL data contained unknown (unsupported) commands, there is a possibility that the drawing is missing some content."))
7cc5285e0a99d8e121e75abfdfea3474dcd6a86dSebastian Wüst# deliver document to inkscape
86776d459a74b8432bbeee60fe796db6403afe7eSebastian Wüst# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99