Пример #1
0
	def InitTree(self):
		self.tree = Tree(self, multiple = True)
		self.root = self.tree.root

		# FIXME: duplicated code in RecordPanel.py
		import ContentTypeHandler
		icons = {
				Special       : (IconImages.getSpecialOffBitmap(),
								 IconImages.getSpecialBitmap()),

				Record.Record : IconImages.getRecordBitmap(),
				Record.Page   : IconImages.getPageBitmap(),
				Record.Hit    : IconImages.getHitBitmap(),

				Controller.Script: IconImages.getPythonBitmap(),
				Controller.If    : IconImages.getIfBitmap(),
				Controller.Loop  : IconImages.getLoopBitmap(),
				Controller.Block : IconImages.getBlockBitmap(),

				ContentTypeHandler.DefaultContentType : IconImages.getWebBitmap(),
				ContentTypeHandler.AMFContentType     : IconImages.getFlexBitmap(),
				ContentTypeHandler.HTMLContentType    : IconImages.getWebBitmap(),
				ContentTypeHandler.XMLContentType     : IconImages.getXMLBitmap(),
				ContentTypeHandler.PythonContentType  : IconImages.getPythonBitmap(),
				ContentTypeHandler.BinContentType     : IconImages.getBinaryBitmap(),
				}
		self.tree.SetIcons(icons)

		def GetType(data):
			if isinstance(data, Record.Hit):
				# TODO: this check is for compatibility, remove it in future
				if isinstance(data.req_handler, ContentTypeHandler.ContentType):
					return data.req_handler.__class__
				else:
					# You see, really dirty trick,  so remove it in future...
					if 'AMF' in str(data.req_handler.coder):
						return ContentTypeHandler.AMFContentType
					else:
						return data.__class__
			else:
				return data.__class__

		self.tree.GetType = GetType