#
# Copyright (C) 2010 Martin Owens
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA.
#
"""
Python barcode renderer for UPCE barcodes. Designed for use with Inkscape.
"""
# This is almost exactly the same as the standard FAMILIES
# But flipped around and with the first 111000 instead of 000000.
'100110', '100011', '101010', '101001', '100101']
"""Generate a UPC-E Barcode"""
"""Generate a UPCE Checksum"""
"""Converting UPC-A to UPC-E, may cause errors."""
# All UPC-E Numbers use number system 0
# If not then the code is invalid
raise ValueError("Invalid UPC Number")
# Most of the conversions deal
# with the specific code parts
# There are 4 cases to convert:
# Maxium number product code digits can be encoded
# Now only 2 product code digits can be used
# With even more maker code we have less room for product code
# The last recorse is to try and squeeze it in the last 5 numbers
# so long as the product is 00005-00009 so as not to conflict with
# the 0-4 used above.
else:
# Invalid UPC-A Numbe
raise ValueError("Invalid UPC Number")
"""Convert UPC-E to UPC-A by padding with zeros"""
# It's more likly to convert this without fault
# But we still must be mindful of the 4 conversions
return None
else: