hpgl_input.py revision 8a982a4a1c50afd95f83db62cb4b42d5f3bd5fad
# coding=utf-8
'''
hpgl_input.py - input a HP Graphics Language file
Copyright (C) 2013 Sebastian Wüst, sebi@timewaster.de, http://www.timewasters-place.com/
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
# standard library
# local library
import hpgl_decoder, inkex
# parse options
parser = inkex.optparse.OptionParser(usage="usage: %prog [options] HPGLfile", option_class=inkex.InkOption)
parser.add_option("--resolutionX", action="store", type="float", dest="resolutionX", default=1016.0, help="Resolution X (dpi)")
parser.add_option("--resolutionY", action="store", type="float", dest="resolutionY", default=1016.0, help="Resolution Y (dpi)")
parser.add_option("--showMovements", action="store", type="inkbool", dest="showMovements", default="FALSE", help="Show Movements between paths")
# needed to initialize the document
# TODO:2013-07-13:Sebastian Wüst:Load the whole file and try to parse all the different HPGL formats correctly.
# read file (read only one line, there should not be more than one line)
# interpret data
# TODO:2013-07-13:Sebastian Wüst:Find a better way to pass errors correctly, think about how data is passed.
# issue warning if no hpgl data found
if hasNoHpglData:
print 1
else:
# issue warning if unknown commands where found
inkex.errormsg(_("The HPGL data contained unknown (unsupported) commands, there is a possibility that the drawing is missing some content."))
# deliver document to inkscape
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99