######################################################################### # # # # # copyright 2002 Paul Henry Tremblay # # # # 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. # # # # # ######################################################################### import sys class BorderParse: """ Parse a border line and return a dictionary of attributes and values """ def __init__(self): # cw bt 'bdr-li-wid' : 'line-width', 'bdr-sp-wid' : 'padding', 'bdr-color_' : 'color', } self.__border_style_dict = { 'bdr-single' : 'single', 'bdr-doubtb' : 'double-thickness-border', 'bdr-shadow' : 'shadowed-border', 'bdr-double' : 'double-border', 'bdr-dotted' : 'dotted-border', 'bdr-dashed' : 'dashed', 'bdr-hair__' : 'hairline', 'bdr-inset_' : 'inset', 'bdr-das-sm' : 'dash-small', 'bdr-dot-sm' : 'dot-dash', 'bdr-dot-do' : 'dot-dot-dash', 'bdr-outset' : 'outset', 'bdr-trippl' : 'tripple', 'bdr-thsm__' : 'thick-thin-small', 'bdr-htsm__' : 'thin-thick-small', 'bdr-hthsm_' : 'thin-thick-thin-small', 'bdr-thm___' : 'thick-thin-medium', 'bdr-htm___' : 'thin-thick-medium', 'bdr-hthm__' : 'thin-thick-thin-medium', 'bdr-thl___' : 'thick-thin-large', 'bdr-hthl__' : 'thin-thick-thin-large', 'bdr-wavy__' : 'wavy', 'bdr-d-wav_' : 'double-wavy', 'bdr-strip_' : 'striped', 'bdr-embos_' : 'emboss', 'bdr-engra_' : 'engrave', 'bdr-frame_' : 'frame', } def parse_border(self, line): """ Requires: line -- line with border definition in it Returns: ? Logic: """ border_dict = {} border_style_dict = {} border_style_list = [] border_type = self.__border_dict.get(line[6:16]) if not border_type: sys.stderr.write( 'module is border_parse.py\n' 'function is parse_border\n' 'token does not have a dictionary value\n' 'token is "%s"' % line ) return border_dict att_line = line[20:-1] atts = att_line.split('|') # cw