本文整理汇总了Python中utils.add_iter函数的典型用法代码示例。如果您正苦于以下问题:Python add_iter函数的具体用法?Python add_iter怎么用?Python add_iter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_iter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_zmf4_obj_text_frame
def add_zmf4_obj_text_frame(hd, size, data):
_zmf4_obj_common(hd, size, data)
off = 0x1c
_zmf4_obj_bbox(hd, size, data, off)
off = 0x88
(text, off) = rdata(data, off, '<I')
add_iter(hd, 'Text reference', '0x%x' % text, off - 4, 4, '<I')
示例2: add_font
def add_font(hd, size, data):
i = 2
start = i
while i < len(data) and data[i] != '\0':
i += 1
length = i - start
add_iter(hd, 'Name', data[start:i], start, length, '<%ds' % length)
示例3: add_record
def add_record(hd, size, data):
off = 0
(typ, off) = rdata(data, off, '<B')
add_iter(hd, 'Record type', typ, off - 1, 1, '<B')
(length, off) = rdata(data, off, '<H')
add_iter(hd, 'Record length', length, off - 2, 2, '<H')
return off
示例4: add_style_para
def add_style_para(hd, size, data):
off = 0
(attribs, off) = rdata(data, off, '<H')
# add_iter(hd, 'Changed attributes', '%s' % get_para_style(attribs), off - 2, 2, '<H')
off += 2
(attrset, off) = rdata(data, off, '<H')
add_iter(hd, 'Attribute set', attrset, off - 2, 2, '<H')
示例5: add_alignment
def add_alignment(hd, size, data):
off = add_record(hd, size, data)
align_map = {0: 'default', 1: 'left', 2: 'center', 3: 'right', 4: 'fill'}
(align, off) = rdata(data, off, '<B')
add_iter(hd, 'Alignment', key2txt(align, align_map), off - 1, 1, '<B')
off += 2
add_range(hd, size, data, off)
示例6: add_iwa_compressed_block
def add_iwa_compressed_block(hd, size, data):
(length, off) = rdata(data, 1, '<H')
add_iter(hd, 'Compressed length', length, off - 2, 2, '<H')
off += 1
var_off = off
(ulength, off) = read_var(data, off)
add_iter(hd, 'Uncompressed length', ulength, var_off, off - var_off, '%ds' % (off - var_off))
示例7: add_string
def add_string(hd, size, data, off, name, fmt):
fmtlen = struct.calcsize(fmt)
(length, off) = rdata(data, off, fmt)
add_iter(hd, '%s length' % name, length, off - fmtlen, fmtlen, fmt)
(text, off) = rdata(data, off, '%ds' % length)
add_iter(hd, name, unicode(text, 'cp1250'), off - length, length, '%ds' % length)
return off
示例8: chop_tag_f533
def chop_tag_f533(hd, size, data):
(rule, off) = rdata(data, 2, '<H')
rule_map = {0x12: 'horizontal adjustable', 0x14: 'horizontal fixed',
0x21: 'vertical adjustable', 0x22: 'block adjustable',
0x41: 'vertical fixed', 0x44: 'block fixed'}
rule_str = key2txt(int(rule), rule_map)
add_iter(hd, 'Rule', rule_str, off - 2, 2, '<H')
示例9: add_packed
def add_packed(hd, size, data, parser, p16=False):
off = add_field(hd, size, data)
obj = parser(data, off, 0, size)
i = 0
for (v, e) in zip(obj.value, obj.extents):
add_iter(hd, 'Value %d' % i, v, e[0], e[1] - e[0], '%ds' % (e[1] - e[0]))
i += 1
示例10: add_cell_type
def add_cell_type(hd, size, data):
off = add_record(hd, size, data)
type_map = {0: 'default', 1: 'text'}
(typ, off) = rdata(data, off, '<B')
add_iter(hd, 'Type', key2txt(typ, type_map), off - 1, 1, '<B')
off += 2
add_range(hd, size, data, off)
示例11: add_cell_lock
def add_cell_lock(hd, size, data):
off = add_record(hd, size, data)
lock_flags = {1: 'locked', 2: 'hidden'}
(lock, off) = rdata(data, off, '<B')
add_iter(hd, 'Type', bflag2txt(lock, lock_flags), off - 1, 1, '<B')
off += 2
add_range(hd, size, data, off)
示例12: add_font
def add_font(hd, size, data):
off = add_record(hd, size, data)
font_map = {0: 'normal', 1: 'italic', 2: 'bold', 3: 'high', 4: 'gray'}
(font, off) = rdata(data, off, '<B')
add_iter(hd, 'Font', key2txt(font, font_map), off - 1, 1, '<B')
off += 2
add_range(hd, size, data, off)
示例13: add_comment
def add_comment(hd, size, data, off):
(row, off) = rdata(data, off, '<H')
add_iter(hd, 'Row', format_row(row), off - 2, 2, '<H')
(col, off) = rdata(data, off, '<B')
add_iter(hd, 'Column', format_column(col), off - 1, 1, '<B')
off += 1
add_long_string(hd, size, data, off, 'Comment')
示例14: add_column_widths
def add_column_widths(hd, size, data):
off = add_record(hd, size, data)
col = 0
while off < size:
(width, off) = rdata(data, off, '<B')
add_iter(hd, 'Column %s' % format_column(col), width, off - 1, 1, '<B')
col += 1
示例15: add_cell
def add_cell(hd, size, data):
off = add_record(hd, size, data)
(col, off) = rdata(data, off, '<B')
add_iter(hd, 'Column', format_column(col), off - 1, 1, '<B')
(row, off) = rdata(data, off, '<H')
add_iter(hd, 'Row', format_row(row), off - 2, 2, '<H')
return (off, col, row)