2
Copyright (C) 2007 Martin Owens
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
from Barcode import getBarcode
23
class InsertBarcode(inkex.Effect):
25
inkex.Effect.__init__(self)
26
self.OptionParser.add_option("-l", "--height",
27
action="store", type="int",
28
dest="height", default=30,
29
help="Barcode Height")
30
self.OptionParser.add_option("-t", "--type",
31
action="store", type="string",
32
dest="type", default='',
34
self.OptionParser.add_option("-d", "--text",
35
action="store", type="string",
36
dest="text", default='',
37
help="Text to print on barcode")
40
x, y = self.view_center
41
object = getBarcode( self.options.type, {
42
'text' : self.options.text,
43
'height' : self.options.height,
44
'document' : self.document,
49
barcode = object.generate()
51
self.current_layer.append(barcode)
53
sys.stderr.write("No barcode was generated\n")
55
sys.stderr.write("Unable to make barcode with: " + str(self.options) + "\n")