当前位置: 首页>>代码示例>>Python>>正文


Python utils.add_pgiter函数代码示例

本文整理汇总了Python中utils.add_pgiter函数的典型用法代码示例。如果您正苦于以下问题:Python add_pgiter函数的具体用法?Python add_pgiter怎么用?Python add_pgiter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了add_pgiter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parse_configuration

def parse_configuration(page, data, offset, parent):
	(length, off) = rdata(data, offset, '<I')
	length = int(length)
	data = data[off - 4:off + length]
	confiter = add_pgiter(page, 'Configuration', 'zbr', 'configuration', data, parent)
	add_pgiter(page, 'Local configuration', 'zbr', 'config_local', data[4:], confiter)
	return off + length
开发者ID:renyxa,项目名称:re-lab,代码行数:7,代码来源:zbr.py

示例2: parse_palette

def parse_palette(page, data, offset, parent):
	(length, off) = rdata(data, offset, '<I')
	length = int(length)
	data = data[off - 4:off + length]
	palette_iter = add_pgiter(page, 'Color Palette', 'zbr', 'color_palette', data, parent)
	add_pgiter(page, 'Palette', 'zbr', 'palette', data[4:], palette_iter)
	return off + length
开发者ID:renyxa,项目名称:re-lab,代码行数:7,代码来源:zbr.py

示例3: handle_tile_row

def handle_tile_row(parser, page, data, parent):
	data = parser.tile_row_data
	offsets = sorted(parser.tile_row_offsets.keys())
	for (start, end) in zip(offsets, offsets[1:] + [len(data)]):
		add_pgiter(page, 'Column %d' % parser.tile_row_offsets[start], 'iwa', 'iwa_tile_row', data[start:end], parser.tile_row_iter)
	parser.tile_row_data = ''
	parser.tile_row_offsets = {}
开发者ID:AlexP11223,项目名称:re-lab,代码行数:7,代码来源:iwa.py

示例4: parse_configuration

	def parse_configuration(self, off):
		(length, off) = rdata(self.data, off, '<I')
		length = int(length)
		data = self.data[off - 4:off + length]
		confiter = add_pgiter(self.page, 'Configuration', 'zbr', 'configuration', data, self.fileiter)
		add_pgiter(self.page, 'Local configuration', 'zbr', 'config_local', data[4:], confiter)
		return off + length
开发者ID:AlexP11223,项目名称:re-lab,代码行数:7,代码来源:zbr.py

示例5: read_thumbnail

	def read_thumbnail(self):
		start = self.header_size + self.metadata_size
		end = start + self.thumbnail_size
		typ = "Unknown"
		if lrf_thumbnail_types.has_key(self.thumbnail_type):
			typ = lrf_thumbnail_types[self.thumbnail_type]
		add_pgiter(self.page, 'Thumbnail (%s)' % typ, 'lrf', 0, self.data[start:end], self.parent)
开发者ID:AlexP11223,项目名称:re-lab,代码行数:7,代码来源:lrf.py

示例6: parse_text_frame

	def parse_text_frame(self, data, parent):
		off = self._parse_object(data, 0, parent)
		off = self._parse_object(data, off, parent)
		off = self._parse_object(data, off, parent)
		add_pgiter(self.page, 'Bounding box', 'zmf', 'zmf2_bbox', data[off:off + 0x20], parent)
		off += 0x20
		(count, off) = rdata(data, off, '<I')

		chars = []
		chars_len = 0
		i = 0
		while i < int(count):
			(length, off) = rdata(data, off, '<I')
			i += 1
			chars.append(data[off - 4:off + int(length)])
			chars_len += 4 + int(length)
			off += int(length)

		charsiter = add_pgiter(self.page, 'Characters', 'zmf', 0, data[off:off + chars_len], parent)
		i = 0
		while i != len(chars):
			add_pgiter(self.page, 'Character %d' % (i + 1), 'zmf', 'zmf2_character', chars[i], charsiter)
			i += 1

		return off
开发者ID:cherry-wb,项目名称:re-lab,代码行数:25,代码来源:zmf.py

示例7: read_stream

	def read_stream(self, data, parent):
		callback = 0
		if self.stream_states[-1].stream_flags == 0x100:
			callback = 'compressed_stream'
		strmiter = add_pgiter(self.page, 'Stream', 'lrf', callback, data, parent)
		# data = self.decrypt_stream(self.data[start:start + length])
		# add_pgiter(self.page, '[Unobfuscated]', 'lrf', 0, data, strmiter)

		content = data
		content_name = 'Content'
		# TODO: This is speculative. I think that actually the lower
		# byte contains type (e.g., image types, ToC, tags) and only the
		# higher byte is flags (or flag). It seems that 0x1 means
		# 'compressed'.
		if self.stream_states[-1].stream_flags == 0x100:
			(uncompressed_size, off) = rdata(data, 0, '<I')
			try:
				content = zlib.decompress(data[off:])
				content_name = 'Uncompressed content'
				assert len(content) == uncompressed_size
			except zlib.error:
				pass
		callback = 0
		if self.stream_states[-1].stream_flags == 0x51:
			callback = 'toc'
		cntiter = add_pgiter(self.page, content_name, 'lrf', callback, content, strmiter)
		self.stream_level += 1
		if len(content) > 1 and ord(content[1]) == 0xf5:
			self.read_object_tags(content, cntiter)
		self.stream_level -= 1
		self.stream_states[-1].stream_read = True
开发者ID:AlexP11223,项目名称:re-lab,代码行数:31,代码来源:lrf.py

示例8: parse_data_record

	def parse_data_record(self, n, data, parent):
		(para, off) = rdata(data, 2, '>H')
		off += 2
		(typ, off) = rdata(data, off, 'B')
		typ_str = None
		if int(typ) < len(plucker_type):
			typ_str = ' (%s)' % plucker_type[int(typ)]
		reciter = add_pgiter(self.page, 'Record %d%s' % (n, typ_str), 'pdb', 'plucker_record', data, parent)

		if typ == 0 or typ == 1:
			# read para headers
			off = 8
			paraiter = add_pgiter(self.page, 'Paragraphs', 'pdb', 0, data[off:off + 4 * int(para)], reciter)
			for i in range(int(para)):
				(size, off) = rdata(data, off, '>H')
				(attrs, off) = rdata(data, off, '>H')
				add_pgiter(self.page, 'Paragraph %d' % i, 'pdb', 'plucker_para', data[off - 4:off], paraiter)

			text = data[off:len(data)]

			if typ == 0:
				add_pgiter(self.page, 'Text', 'pdb', 0, text, reciter)
			elif typ == 1:
				if self.version == 1:
					uncompressed = lz77_decompress(text)
					add_pgiter(self.page, 'Text', 'pdb', 0, uncompressed, reciter)
				elif self.version == 2:
					uncompressed = zlib.decompress(text)
					add_pgiter(self.page, 'Text', 'pdb', 0, uncompressed, reciter)
开发者ID:AlexP11223,项目名称:re-lab,代码行数:29,代码来源:pdb.py

示例9: parse_preview

def parse_preview(page, data, offset, parent):
	off = offset
	previter = add_pgiter(page, 'Preview bitmap', 'zbr', 0, data[off:off + 5264], parent)
	add_pgiter(page, 'DIB palette', 'zbr', 'palette', data[off:off + 64], previter)
	off += 64
	dibiter = add_pgiter(page, 'DIB data', 'zbr', 0, data[off:off + 5200], previter)
	return off + 5200
开发者ID:renyxa,项目名称:re-lab,代码行数:7,代码来源:zbr.py

示例10: parse_palette

	def parse_palette(self, off):
		(length, off) = rdata(self.data, off, '<I')
		length = int(length)
		data = self.data[off - 4:off + length]
		palette_iter = add_pgiter(self.page, 'Color Palette', 'zbr', 'color_palette', data, self.fileiter)
		add_pgiter(self.page, 'Palette', 'zbr', 'palette', data[4:], palette_iter)
		return off + length
开发者ID:AlexP11223,项目名称:re-lab,代码行数:7,代码来源:zbr.py

示例11: parse_color

	def parse_color(self, data, parent):
		(length, off) = rdata(data, 0xd, '<I')
		name_str = 'Color'
		if length > 1:
			(name, off) = rdata(data, off, '%ds' % (int(length) - 1))
			name_str += ' (%s)' % unicode(name, 'cp1250')
		add_pgiter(self.page, name_str, 'zmf', 'zmf2_color', data, parent)
		return len(data)
开发者ID:cherry-wb,项目名称:re-lab,代码行数:8,代码来源:zmf.py

示例12: parse_table

	def parse_table(self, data, parent):
		off = self._parse_object(data, 0, parent)
		off = self._parse_object(data, off, parent)
		off = self._parse_object(data, off, parent)
		add_pgiter(self.page, 'Bounding box', 'zmf', 'zmf2_bbox', data[off:off + 0x20], parent)
		off += 0x20
		add_pgiter(self.page, 'Def', 'zmf', 'zmf2_table', data[off:], parent)
		return off
开发者ID:cherry-wb,项目名称:re-lab,代码行数:8,代码来源:zmf.py

示例13: handle_footnotes

def handle_footnotes(page, data, parent, parser=None):
	(count, off) = rdata(data, 0, '<I')
	entry_size = 24 # FIXME: a guess
	off += 8
	for i in range(0, count):
		add_pgiter(page, 'Footnote %d' % i, 'wt602', '', data[off:off + entry_size], parent)
		off += entry_size
	if off < len(data):
		add_pgiter(page, 'Trailer', 'wt602', '', data[off:], parent)
开发者ID:rgwan,项目名称:re-lab,代码行数:9,代码来源:wt602.py

示例14: parse_header

	def parse_header(self):
		(offset, off) = rdata(self.data, 0x20, '<I')
		(preview, off) = rdata(self.data, off, '<I')
		if int(preview) != 0:
			self.preview_offset = int(preview) - int(offset)
			assert self.preview_offset == 0x20 # this is what I see in all files
		data = self.data[0:int(offset)]
		add_pgiter(self.page, 'Header', 'zmf', 'zmf4_header', data, self.parent)
		return offset
开发者ID:cherry-wb,项目名称:re-lab,代码行数:9,代码来源:zmf.py

示例15: handle_styles

def handle_styles(page, data, parent, parser = None):
	(hdrsize, off) = rdata(data, 0, '<I')
	count = hdrsize / 0x20
	off = 0x10
	hdriter = add_pgiter(page, 'Names', 'wt602', 0, data[:hdrsize + 0x10], parent)
	for i in range(0, count):
		add_pgiter(page, 'Style %d' % i, 'wt602', 'style_header', data[off:off + 0x20], hdriter)
		off += 0x20
	add_pgiter(page, 'Definitions', 'wt602', 0, data[hdrsize + 0x10:], parent)
开发者ID:rgwan,项目名称:re-lab,代码行数:9,代码来源:wt602.py


注:本文中的utils.add_pgiter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。