index 0ba9cf2ec9bb1d0c48f5d5623c75bec6d7f65ede..2f0b327ed44a988274efe53d1b390edca6ecb4d1 100644 (file)
'''
Copyright (C) 2007 Martin Owens
+Debugged by Ralf Heinecke & Martin Siepmann 09/07/2007
+Debugged by Horst Schottky Feb. 27. 2010
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
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
+
+
+
'''
from Base import Barcode
# The mapExtra method is used to slim down the amount
# of pre code and instead we generate the lists
-charAB = list(r' !"#$%&\()*+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQSTUVWXYZ\]^_')
+charAB = list(' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_')
charA = mapExtra(charAB, range(0, 31)) # Offset 64
charB = mapExtra(charAB, range(96, 125)) # Offset -32
# Split up into sections of numbers, or charicters
# This makes sure that all the charicters are encoded
# In the best way posible for Code128
- for datum in re.findall(r'(?:(?:\d\d){2,})|.', text):
+ for datum in re.findall(r'(?:(?:\d\d){2,})|(?:^\d\d)|.', text):
if len(datum) == 1:
block = block + datum
else:
def bestBlock(self, block):
# If this has lower case then select B over A
if block.upper() == block:
- return [ 'B', block ]
- return [ 'A', block ]
+ return [ 'A', block ]
+ return [ 'B', block ]
def encodeBlocks(self, blocks):
total = 0
# C : 99, 105
num = 0;
if set == 'A':
- num = 101
+ num = 103
elif set == 'B':
- num = 100
+ num = 104
elif set == 'C':
- num = 99
+ num = 105
i = pos
if pos:
- num = num + (math.abs(num - 102) * 2)
+ num = 204 - num
else:
i = 1
if set == 'A' or set == 'B':
chars = charB
- if set == 'B':
+ if set == 'A':
chars = charA
for char in datum: