• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python events.emit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: end_page

	def end_page(self):
		self.canvas.showPage()
		self.page_count += 1
		position = 1.0
		if self.num_pages:
			position = float(self.page_count) / float(self.num_pages)
		events.emit(events.FILTER_INFO, self.prgs_msg, position)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:7,代码来源:pdfgen.py


示例2: _build_model

	def _build_model(self):
		content_handler = XMLDocReader(self.presenter)
		error_handler = ErrorHandler()
		entity_resolver = EntityResolver()
		dtd_handler = DTDHandler()
		try:
			filename = os.path.join(self.presenter.doc_dir, 'content.xml')
			handler = open(filename, 'r')
			lines = float(sum(1 for l in handler))
			handler.close()
			self.file_handler = open(filename, "r")
			input_source = InputSource()
			input_source.setByteStream(self.file_handler)
			content_handler.lines = lines
			xml_reader = xml.sax.make_parser()
			xml_reader.setContentHandler(content_handler)
			xml_reader.setErrorHandler(error_handler)
			xml_reader.setEntityResolver(entity_resolver)
			xml_reader.setDTDHandler(dtd_handler)
			xml_reader.parse(input_source)
			self.file_handler.close()
			content_handler.file = None
		except:
			errtype, value, traceback = sys.exc_info()
			msg = _('It seems content.xml is corrupted') + '\n' + value
			events.emit(events.MESSAGES, msgconst.ERROR, msg)
			raise IOError(errtype, msg , traceback)
		self.model = content_handler.model

		msg = _('Content.xml is parsed successfully')
		events.emit(events.MESSAGES, msgconst.OK, msg)
开发者ID:Scrik,项目名称:sk1-wx,代码行数:31,代码来源:pdxf_filters.py


示例3: startElement

	def startElement(self, name, attrs):
		if name == 'Content':
			pass
		else:
			position = float(self.locator.getLineNumber()) / self.lines
			if position - self.position > 0.05:
				msg = _('Parsing in process...')
				events.emit(events.FILTER_INFO, msg, position)
				self.position = position
			obj = None
			cid = model.TAGNAME_TO_CID[name]
			obj = model.CID_TO_CLASS[cid](self.presenter.config)
			obj.tag = name
			for item in attrs._attrs.keys():
				line = 'self.value=' + attrs._attrs[item]
				code = compile(line, '<string>', 'exec')
				exec code
				obj.__dict__[item] = self.value

			if self.parent_stack:
				parent = self.parent_stack[-1]
				methods.add_child(parent, obj)
			else:
				self.model = obj

			self.parent_stack.append(obj)
开发者ID:Scrik,项目名称:sk1-wx,代码行数:26,代码来源:pdxf_filters.py


示例4: load

	def load(self, presenter, path):
		self.presenter = presenter
		self.path = path

		if not zipfile.is_zipfile(self.path):
			msg = _('It seems the file is not CDRZ file')
			events.emit(events.MESSAGES, msgconst.ERROR, msg)
			raise IOError(2, msg)

		self._extract_content()
		self.model = None

		path = os.path.join(self.presenter.doc_dir, 'content', 'riffData.cdr')

#		try:
#			file = open(path, 'rb')
#		except:
#			errtype, value, trace = sys.exc_info()
#			msg = _('Cannot open %s file for reading') % (path)
#			events.emit(events.MESSAGES, msgconst.ERROR, msg)
#			raise IOError(errtype, msg + '\n' + value, trace)
#
#		self.model = self.parse_file(file)
#
#		file.close()
		return self.model
开发者ID:sk1project,项目名称:uc2,代码行数:26,代码来源:cdrz_filters.py


示例5: start_page

	def start_page(self, w, h, left_margin=0.0, top_margin=0.0):
		self.canvas.translate(w / 2.0 - left_margin, h / 2.0 - top_margin)
		self.canvas.setPageSize((w, h))
		position = 0.0
		if self.num_pages:
			position = float(self.page_count) / float(self.num_pages)
		events.emit(events.FILTER_INFO, self.prgs_msg, position)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:7,代码来源:pdfgen.py


示例6: create_jobs

	def create_jobs(self):
		if self.obj_stack:
			m11, m21, m12, m22, dx, dy = SK2_to_PLT_TRAFO

			if self.plt_doc.config.force_zero:
				bbox = []
				bbox += self.obj_stack[0].cache_bbox
				for obj in self.obj_stack:
					bbox = libgeom.sum_bbox(bbox, obj.cache_bbox)

				dx = -bbox[0] * m11
				dy = -bbox[1] * m22

			trafo = [m11, m21, m12, m22, dx, dy]

			obj_num = len(self.obj_stack)
			for obj in self.obj_stack:

				self.counter += 1
				position = float(self.counter) / obj_num
				if position - self.position > 0.05:
					msg = _('Saving in process...')
					events.emit(events.FILTER_INFO, msg, position)
					self.position = position

				paths = libgeom.get_flattened_path(obj, trafo,
									self.plt_doc.config.tolerance)
				if paths is None: continue

				for path in paths:
					if path and path[1]:
						self.jobs.append(plt_model.PltJob('', path))
开发者ID:Scrik,项目名称:sk1-wx,代码行数:32,代码来源:plt_translators.py


示例7: render

	def render(self, objs, toplevel=False):
		obj_count = 0
		for obj in objs:
			if obj.is_pixmap():
				self.draw_pixmap(obj)
			elif obj.is_primitive():
				curve_obj = obj.to_curve()
				if curve_obj.is_primitive():
					self.draw_curve(curve_obj)
				else:
					self.render(curve_obj.childs)
			elif obj.is_container():
				self.draw_container(obj)
			else:
				self.render(obj.childs)

			#---Progress
			obj_count += 1
			shift = 0.0
			page_size = 1.0
			if self.num_pages:
				shift = float(self.page_count) / float(self.num_pages)
				page_size = 1.0 / float(self.num_pages)
			position = shift + obj_count / len(objs) * page_size
			events.emit(events.FILTER_INFO, self.prgs_msg, position)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:25,代码来源:pdfgen.py


示例8: get_saver_by_id

def get_saver_by_id(pid):
	saver = None
	if pid in data.SAVERS.keys():
		saver = data.SAVERS[pid]
	else:
		msg = _('Saver is not found for id %u') % (pid)
		events.emit(events.MESSAGES, msgconst.ERROR, msg)
	return saver
开发者ID:Scrik,项目名称:sk1-wx,代码行数:8,代码来源:__init__.py


示例9: get_loader_by_id

def get_loader_by_id(pid):
	loader = None
	if pid in data.LOADERS.keys():
		loader = data.LOADERS[pid]
	else:
		msg = _('Loader is not found for id %u') % (pid)
		events.emit(events.MESSAGES, msgconst.ERROR, msg)
	return loader
开发者ID:Scrik,项目名称:sk1-wx,代码行数:8,代码来源:__init__.py


示例10: _pack_content

	def _pack_content(self):
		pdxf_file = ZipFile(self.presenter.doc_file, 'w')
		for item in self.content:
			path, filename = item
			filename = filename.encode('ascii')
			pdxf_file.write(path, filename, zipfile.ZIP_DEFLATED)
		pdxf_file.close()

		msg = _('PDXF file is created successfully')
		events.emit(events.MESSAGES, msgconst.OK, msg)
开发者ID:Scrik,项目名称:sk1-wx,代码行数:10,代码来源:pdxf_filters.py


示例11: save

	def save(self, presenter, path):

		try:
			file = open(path, 'wb')
		except:
			errtype, value, traceback = sys.exc_info()
			msg = _('Cannot open %s file for writing') % (path)
			events.emit(events.MESSAGES, msgconst.ERROR, msg)
			raise IOError(errtype, msg + '\n' + value, traceback)

		file.write(presenter.model.get_chunk())
		file.close()
开发者ID:sk1project,项目名称:uc2,代码行数:12,代码来源:cdrz_filters.py


示例12: load

	def load(self, presenter, path):
		self.presenter = presenter
		self.path = path

		if not zipfile.is_zipfile(self.path):
			msg = _('It seems the file is not PDXF file')
			events.emit(events.MESSAGES, msgconst.ERROR, msg)
			raise IOError(2, msg)


		self._extract_content()
		self._build_model()
		return self.model
开发者ID:Scrik,项目名称:sk1-wx,代码行数:13,代码来源:pdxf_filters.py


示例13: check_wmf

def check_wmf(path):
	try:
		file = open(path, 'rb')
	except:
		errtype, value, traceback = sys.exc_info()
		msg = _('Cannot open %s file for reading') % (path)
		events.emit(events.MESSAGES, msgconst.ERROR, msg)
		raise IOError(errtype, msg + '\n' + value, traceback)

	string = file.read(4)

	file.close()
	if string == WMF_SIGNATURE: return True
	return False
开发者ID:Scrik,项目名称:sk1-wx,代码行数:14,代码来源:__init__.py


示例14: load

	def load(self, presenter, path):
		self.presenter = presenter
		self.path = path
		self.model = presenter.model
		self.jobs = []

		try:
			file = open(path, 'rb')
		except:
			errtype, value, traceback = sys.exc_info()
			msg = _('Cannot open %s file for writing') % (path)
			events.emit(events.MESSAGES, msgconst.ERROR, msg)
			raise IOError(errtype, msg + '\n' + value, traceback)

		res = file.read().split('IN;')
		file.close()

		if not len(res) == 2:
			msg = _('Wrong content in %s file: "IN;" instruction should be unique') % (path)
			events.emit(events.MESSAGES, msgconst.ERROR, msg)
			raise IOError(msg)

		if res[0]:
			self.model.string = res[0]
		cmds = res[1].split(';')
		jobs = []
		job = []
		stack = ''
		for cmd in cmds:
			if cmd[:2] == 'PU':
				stack = cmd
				if job:
					jobs.append(job)
					job = []
			elif cmd[:2] == 'PD':
				if not job:
					if not stack:
						stack = 'PU0,0'
					job.append(stack)
				job.append(cmd)

		for job in jobs:
			string = ''
			for cmd in job:
				string += cmd + ';'
			self.jobs.append(model.PltJob(string))

		self.model.childs[1].childs = self.jobs
		return self.model
开发者ID:sk1project,项目名称:uc2,代码行数:49,代码来源:plt_filters.py


示例15: _write_tree

	def _write_tree(self, item):
		self.counter += 1
		position = float(self.counter) / self.obj_num
		if position - self.position > 0.05:
			msg = _('Saving in process...')
			events.emit(events.FILTER_INFO, msg, position)
			self.position = position

		tag = model.CID_TO_TAGNAME[item.cid]
		params = self._get_params(item)
		self._open_tag(tag, params, item.childs)
		if item.childs:
			self.ident += 1
			for child in item.childs:
				self._write_tree(child)
			self.ident -= 1
			self._close_tag(tag)
开发者ID:Scrik,项目名称:sk1-wx,代码行数:17,代码来源:pdxf_filters.py


示例16: check_cdr

def check_cdr(path):
	try:
		file = open(path, 'rb')
	except:
		errtype, value, traceback = sys.exc_info()
		msg = _('Cannot open %s file for reading') % (path)
		events.emit(events.MESSAGES, msgconst.ERROR, msg)
		raise IOError(errtype, msg + '\n' + value, traceback)

	header = file.read(12)
	file.close()
	if not header[:4] == 'RIFF':
		return False
	if header[8:] in const.CDR_VERSIONS:
		return True
	else:
		return False
开发者ID:sk1project,项目名称:uc2,代码行数:17,代码来源:__init__.py


示例17: load

	def load(self, presenter, path):
		self.presenter = presenter
		self.model = None
		self.parent_stack = []
		self.file_size = os.path.getsize(path)

		try:
			file = open(path, 'rb')
		except:
			errtype, value, trace = sys.exc_info()
			msg = _('Cannot open %s file for reading') % (path)
			events.emit(events.MESSAGES, msgconst.ERROR, msg)
			raise IOError(errtype, msg + '\n' + value, trace)

		self.model = self.parse_file(file)

		file.close()
		return self.model
开发者ID:witwall,项目名称:uniconvertor,代码行数:18,代码来源:cdr_filters.py


示例18: _save_content

	def _save_content(self):
		content_xml = os.path.join(self.presenter.doc_dir, 'content.xml')
		try:
			self.file = open(content_xml, 'wb')
		except:
			errtype, value, traceback = sys.exc_info()
			msg = _('Cannot open %s file for writing') % (content_xml)
			events.emit(events.MESSAGES, msgconst.ERROR, msg)
			raise IOError(errtype, msg + '\n' + value, traceback)

		doc = self.presenter.model
		self.obj_num = doc.count()
		self._start()
		self._write_tree(doc)
		self._finish()

		msg = _('PDXF file content.xml is created')
		events.emit(events.MESSAGES, msgconst.OK, msg)
开发者ID:Scrik,项目名称:sk1-wx,代码行数:18,代码来源:pdxf_filters.py


示例19: load

	def load(self, presenter, path):
		self.filepath = path
		self.presenter = presenter
		self.config = self.presenter.config
		self.file_size = os.path.getsize(path)
		try:
			self.file = open(path, 'rb')
		except:
			errtype, value, traceback = sys.exc_info()
			msg = _('Cannot open %s file for writing') % (path)
			events.emit(events.MESSAGES, msgconst.ERROR, msg)
			raise IOError(errtype, msg + '\n' + value, traceback)

		self.do_load()

		self.file.close()
		self.position = 0
		return self.model
开发者ID:sk1project,项目名称:uc2,代码行数:18,代码来源:loader.py


示例20: _write_manifest

	def _write_manifest(self):
		xml = os.path.join(self.presenter.doc_dir, 'META-INF', 'manifest.xml')
		try:
			self.file = open(xml, 'wb')
		except:
			errtype, value, traceback = sys.exc_info()
			msg = _('Cannot open %s file for writing') % (xml)
			events.emit(events.MESSAGES, msgconst.ERROR, msg)
			raise IOError(errtype, msg + '\n' + value, traceback)
		self._start()
		self.file.write('<manifest>\n')
		self._write_manifest_entries()
		self.file.write('</manifest>\n')
		self._finish()
		filename = os.path.join('META-INF', 'manifest.xml')
		self.content.append((xml, filename))

		msg = _('PDXF file manifest.xml is created')
		events.emit(events.MESSAGES, msgconst.OK, msg)
开发者ID:Scrik,项目名称:sk1-wx,代码行数:19,代码来源:pdxf_filters.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python grid.GridUtil类代码示例发布时间:2022-05-27
下一篇:
Python uc2._函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap