[IMP] Changed all module categories, limited number of categories
[odoo/odoo.git] / addons / auction / barcode / fourstate.py
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (c) 2000 Tyler C. Sarna <tsarna@sarna.org>
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 #    notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 #    notice, this list of conditions and the following disclaimer in the
13 #    documentation and/or other materials provided with the distribution.
14 # 3. All advertising materials mentioning features or use of this software
15 #    must display the following acknowledgement:
16 #      This product includes software developed by Tyler C. Sarna.
17 # 4. Neither the name of the author nor the names of contributors
18 #    may be used to endorse or promote products derived from this software
19 #    without specific prior written permission.
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
25 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 # POSSIBILITY OF SUCH DAMAGE.
32 #
33
34 from reportlab.lib.units import inch
35 from common import Barcode
36 import string
37
38 # . 3 T Tracker
39 # , 2 D Descender
40 # ' 1 A Ascender
41 # | 0 H Ascender/Descender
42
43 _rm_patterns = {
44     "0" : "--||",   "1" : "-',|",   "2" : "-'|,",   "3" : "'-,|",
45     "4" : "'-|,",   "5" : "'',,",   "6" : "-,'|",   "7" : "-|-|",
46     "8" : "-|',",   "9" : "',-|",   "A" : "',',",   "B" : "'|-,",
47     "C" : "-,|'",   "D" : "-|,'",   "E" : "-||-",   "F" : "',,'",
48     "G" : "',|-",   "H" : "'|,-",   "I" : ",-'|",   "J" : ",'-|",
49     "K" : ",'',",   "L" : "|--|",   "M" : "|-',",   "N" : "|'-,",
50     "O" : ",-|'",   "P" : ",','",   "Q" : ",'|-",   "R" : "|-,'",
51     "S" : "|-|-",   "T" : "|',-",   "U" : ",,''",   "V" : ",|-'",
52     "W" : ",|'-",   "X" : "|,-'",   "Y" : "|,'-",   "Z" : "||--",
53
54     # start, stop
55     "(" : "'-,'",   ")" : "'|,|"
56 }
57
58 _ozN_patterns = {
59     "0" : "||",    "1" : "|'",    "2" : "|,",    "3" : "'|",    "4" : "''",
60     "5" : "',",    "6" : ",|",    "7" : ",'",    "8" : ",,",    "9" : ".|"
61 }
62
63 _ozC_patterns = {
64     "A" : "|||",    "B" : "||'",    "C" : "||,",    "D" : "|'|",
65     "E" : "|''",    "F" : "|',",    "G" : "|,|",    "H" : "|,'",
66     "I" : "|,,",    "J" : "'||",    "K" : "'|'",    "L" : "'|,",
67     "M" : "''|",    "N" : "'''",    "O" : "'',",    "P" : "',|",
68     "Q" : "','",    "R" : "',,",    "S" : ",||",    "T" : ",|'",
69     "U" : ",|,",    "V" : ",'|",    "W" : ",''",    "X" : ",',",
70     "Y" : ",,|",    "Z" : ",,'",    "a" : "|,.",    "b" : "|.|",
71     "c" : "|.'",    "d" : "|.,",    "e" : "|..",    "f" : "'|.",
72     "g" : "''.",    "h" : "',.",    "i" : "'.|",    "j" : "'.'",
73     "k" : "'.,",    "l" : "'..",    "m" : ",|.",    "n" : ",'.",
74     "o" : ",,.",    "p" : ",.|",    "q" : ",.'",    "r" : ",.,",
75     "s" : ",..",    "t" : ".|.",    "u" : ".'.",    "v" : ".,.",
76     "w" : "..|",    "x" : "..'",    "y" : "..,",    "z" : "...",
77     "0" : ",,,",    "1" : ".||",    "2" : ".|'",    "3" : ".|,",
78     "4" : ".'|",    "5" : ".''",    "6" : ".',",    "7" : ".,|",
79     "8" : ".,'",    "9" : ".,,",    " " : "||.",    "#" : "|'.",
80 }
81
82 #http://www.auspost.com.au/futurepost/
83 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: