#
# 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.
#
"""
Base module for rendering barcodes for Inkscape.
"""
import itertools
import sys
# pylint: disable=abstract-class-not-used
"""Provide a base class for all barcode renderers"""
name = None
"""Cause an error to be reported"""
return "ERROR"
"""
Replace this with the encoding function, it should return
a string of ones and zeros
"""
raise NotImplementedError("You need to write an encode() function.")
raise ValueError("No string specified for barcode.")
"""Get the next useful id (and claim it)"""
index = 0
index += 1
return name
"""Add an extra barcode along side this one, used for ean13 extras"""
from . import getBarcode
kw['scale'] = None
"""Generate the actual svg from the coding"""
if string == 'ERROR':
return
# use an svg group element to contain the barcode
else:
bar_id = 1
bar_offset = 0
# Datum 0 tells us what style of bar is to come next
# Datum 1 tells us what width in units,
# style tells us how wide a unit is
if style['write']:
bar_offset += width
bar_id += 1
if extra is not None:
# Add text at the bottom of the barcode
return barcode
"""Converts black and white markets into a space array"""
"""Returns the styles that should be applied to each bar"""
return result