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

Python events.emit函数代码示例

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

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



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

示例1: save_as

	def save_as(self):
		doc_file = '' + self.current_doc.doc_file
		if not doc_file:
			doc_file = '' + self.current_doc.doc_name
		if not os.path.splitext(doc_file)[1] == "." + \
					uc2const.FORMAT_EXTENSION[uc2const.SK2][0]:
			doc_file = os.path.splitext(doc_file)[0] + "." + \
					uc2const.FORMAT_EXTENSION[uc2const.SK2][0]
		if not os.path.lexists(os.path.dirname(doc_file)):
			doc_file = os.path.join(config.save_dir,
								os.path.basename(doc_file))
		doc_file = dialogs.get_save_file_name(self.mw, self, doc_file)[0]
		if doc_file:
			old_file = self.current_doc.doc_file
			old_name = self.current_doc.doc_name
			self.current_doc.set_doc_file(doc_file)
			try:
				self.make_backup(doc_file)
				self.current_doc.save()
			except:
				self.current_doc.set_doc_file(old_file, old_name)
				first = _('Cannot save document')
				msg = ("%s '%s'.") % (first, self.current_doc.doc_name) + '\n'
				msg += _('Please check file name and write permissions')
				dialogs.error_dialog(self.mw, self.appdata.app_name, msg)
				self.print_stacktrace()
				return False
			config.save_dir = str(os.path.dirname(doc_file))
			self.history.add_entry(doc_file, appconst.SAVED)
			events.emit(events.DOC_SAVED, self.current_doc)
			events.emit(events.APP_STATUS, _('Document saved'))
			return True
		else:
			return False
开发者ID:Scrik,项目名称:sk1-wx,代码行数:34,代码来源:application.py


示例2: save

	def save(self, doc=''):
		if not doc:
			doc = self.current_doc
		if not doc.doc_file:
			return self.save_as()
		ext = os.path.splitext(self.current_doc.doc_file)[1]
		if not ext == "." + uc2const.FORMAT_EXTENSION[uc2const.SK2][0]:
			return self.save_as()
		if not os.path.lexists(os.path.dirname(self.current_doc.doc_file)):
			return self.save_as()

		try:
			self.make_backup(self.current_doc.doc_file)
			doc.save()
			self.history.add_entry(self.current_doc.doc_file, appconst.SAVED)
			events.emit(events.DOC_SAVED, doc)
		except:
			msg = _('Cannot save file')
			msg = "%s '%s'" % (msg, self.current_doc.doc_file) + '\n'
			msg += _('Please check file write permissions')
			dialogs.error_dialog(self.mw, self.appdata.app_name, msg)
			self.print_stacktrace()
			return False
		events.emit(events.APP_STATUS, _('Document saved'))
		return True
开发者ID:Scrik,项目名称:sk1-wx,代码行数:25,代码来源:application.py


示例3: set_selected_nodes

	def set_selected_nodes(self, points=[], add_flag=False):
		if points: self.new_node = None
		if not add_flag:
			for item in self.selected_nodes:
				item.selected = False
			self.selected_nodes = []
		for item in points:
			if item.is_start() and item.path.is_closed():
				continue
			if item.selected and item in self.selected_nodes:
				item.selected = False
				self.selected_nodes.remove(item)
			else:
				item.selected = True
				self.selected_nodes.append(item)
		if len(self.selected_nodes) == 1:
			self.create_control_points()
		else:
			self.clear_control_points()
		events.emit(events.SELECTION_CHANGED, self.presenter)
		msg = _('No selected nodes')
		if self.selected_nodes:
			msg = _('Selected %d node(s)') % len(self.selected_nodes)
		events.emit(events.APP_STATUS, msg)
		self.canvas.selection_redraw()
开发者ID:Scrik,项目名称:sk1-wx,代码行数:25,代码来源:editor_bezier.py


示例4: export_as

	def export_as(self):
		doc_file = '' + self.current_doc.doc_file
		if not doc_file:
			doc_file = '' + self.current_doc.doc_name
		if os.path.splitext(doc_file)[1] == "." + \
					uc2const.FORMAT_EXTENSION[uc2const.SK2][0]:
			doc_file = os.path.splitext(doc_file)[0] + "." + \
					uc2const.FORMAT_EXTENSION[uc2const.PNG][0]
		doc_file = os.path.join(config.export_dir,
								os.path.basename(doc_file))
		doc_file = dialogs.get_save_file_name(self.mw, self, doc_file,
							_('Export document As...'),
							file_types=data.SAVER_FORMATS[1:])[0]
		if doc_file:
			try:
				self.make_backup(doc_file, True)
				self.current_doc.export_as(doc_file)
			except:
				first = _('Cannot save document')
				msg = ("%s '%s'.") % (first, self.current_doc.doc_name) + '\n'
				msg += _('Please check file name and write permissions')
				dialogs.error_dialog(self.mw, self.appdata.app_name, msg)
				self.print_stacktrace()
				return
			config.export_dir = str(os.path.dirname(doc_file))
			events.emit(events.APP_STATUS, _('Document is successfully exported'))
开发者ID:Scrik,项目名称:sk1-wx,代码行数:26,代码来源:application.py


示例5: __setattr__

	def __setattr__(self, attr, value):
		if attr in ['filename', 'app']:
			self.__dict__[attr] = value
			return
		if not hasattr(self, attr) or getattr(self, attr) != value:
			self.__dict__[attr] = value
			events.emit(events.CONFIG_MODIFIED, attr, value)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:7,代码来源:app_conf.py


示例6: open

	def open(self, doc_file='', silent=False):
		if not doc_file:
			doc_file = dialogs.get_open_file_name(self.mw, self, config.open_dir)
		if os.path.lexists(doc_file) and os.path.isfile(doc_file):
			try:
				doc = PD_Presenter(self, doc_file, silent)

			except RuntimeError:
				msg = _('Cannot open file:')
				msg = "%s\n'%s'" % (msg, doc_file) + '\n'
				msg += _('The file contains newer SK2 format.\n')
				msg += _('Try updating sK1 application from http://www.sk1project.net')
				dialogs.error_dialog(self.mw, self.appdata.app_name, msg)
				self.print_stacktrace()
				return
			except:
				msg = _('Cannot open file:')
				msg = "%s\n'%s'" % (msg, doc_file) + '\n'
				msg += _('The file may be corrupted or not supported format')
				dialogs.error_dialog(self.mw, self.appdata.app_name, msg)
				self.print_stacktrace()
				return
			self.docs.append(doc)
			config.open_dir = str(os.path.dirname(doc_file))
			self.history.add_entry(doc_file)
			self.set_current_doc(doc)
			events.emit(events.APP_STATUS, _('Document opened'))
开发者ID:sk1project,项目名称:sk1-wx,代码行数:27,代码来源:application.py


示例7: save_as

	def save_as(self):
		doc_file = '' + self.current_doc.doc_file
		if not doc_file:
			doc_file = '' + self.current_doc.doc_name
		if not os.path.splitext(doc_file)[1] == "." + \
					uc2const.FORMAT_EXTENSION[uc2const.PDXF][0]:
			doc_file = os.path.splitext(doc_file)[0] + "." + \
					uc2const.FORMAT_EXTENSION[uc2const.PDXF][0]
		if not os.path.lexists(os.path.dirname(doc_file)):
			doc_file = os.path.join(config.save_dir,
								os.path.basename(doc_file))
		doc_file = get_save_file_name(self.mw, self, doc_file)
		if doc_file:
			old_file = self.current_doc.doc_file
			old_name = self.current_doc.doc_name
			self.current_doc.set_doc_file(doc_file)
			try:
				self.current_doc.save()
			except IOError:
				self.current_doc.set_doc_file(old_file, old_name)
				details = sys.exc_info()[1].__str__() + sys.exc_info()[2].__str__()
				first = _('Cannot save document')
				sec = _('Please check file name and write permissions')
				msg = ("%s '%s'.") % (first, self.current_doc.doc_name)

				wal.error_dialog(self.mw, self.appdata.app_name, msg, sec, details)

				return False
			config.save_dir = os.path.dirname(doc_file)
			events.emit(events.APP_STATUS, _('Document saved'))
			return True
		else:
			return False
开发者ID:tisn05,项目名称:sk1,代码行数:33,代码来源:application.py


示例8: mouse_move

	def mouse_move(self, event):
		if self.start:
			self.end = self.snap.snap_point(event.get_point())[2]
			self._update_style()
			style = deepcopy(self.new_style)
			self.api.set_temp_style(self.target, style)
			events.emit(events.APP_STATUS, self.msg)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:7,代码来源:grad_ctrl.py


示例9: update_points

	def update_points(self):
		self.corner_points = []
		self.midpoints = []
		coef1 = self.target.coef1
		coef2 = self.target.coef2
		angle1 = self.target.angle1
		angle2 = self.target.angle2
		corners_num = self.target.corners_num
		center = [0.5, 0.5]
		corner_angle = 2.0 * math.pi / float(corners_num)
		corners_start = [0.5, 0.5 + 0.5 * coef1]
		midpoint_start = [0.5, 0.5 + 0.5 * coef2 * math.cos(corner_angle / 2.0)]

		corner_angle_shift = angle1
		midpoint_angle_shift = corner_angle / 2.0 + angle2

		for i in range(0, corners_num):
			angle = float(i) * corner_angle + corner_angle_shift
			point = libgeom.rotate_point(center, corners_start, angle)
			self.corner_points.append(CornerPoint(self.canvas,
												self.target, point, i))

			angle = float(i) * corner_angle + midpoint_angle_shift
			point = libgeom.rotate_point(center, midpoint_start, angle)
			self.midpoints.append(CornerPoint(self.canvas,
												self.target, point, i))
		msg = _('Polygon in editing')
		events.emit(events.APP_STATUS, msg)
开发者ID:Scrik,项目名称:sk1-wx,代码行数:28,代码来源:editor_polygon.py


示例10: mouse_move

 def mouse_move(self, event):
     x, y = self.win_to_doc_coords(list(event.GetPositionTuple()))
     unit = self.presenter.model.doc_units
     tr_unit = uc2const.unit_short_names[unit]
     msg = "  %i x %i" % (x * point_dict[unit], y * point_dict[unit])
     events.emit(events.MOUSE_STATUS, "%s %s" % (msg, tr_unit))
     self.controller.mouse_move(CanvasEvent(event))
开发者ID:sk1project,项目名称:sk1-wx,代码行数:7,代码来源:canvas.py


示例11: goto_page

	def goto_page(self, index):
		pages = self.get_pages()
		current_index = pages.index(self.active_page)
		if index >= 0 and index <> current_index:
			self.api.set_active_page(index)
			self.eventloop.emit(self.eventloop.PAGE_CHANGED)
			events.emit(events.PAGE_CHANGED, self)
开发者ID:Scrik,项目名称:sk1-wx,代码行数:7,代码来源:presenter.py


示例12: config_changed

	def config_changed(self, attr, value):
		if attr[0:4] == 'cms_':
			self.update()
			self.update_mngrs()
			events.emit(events.CMS_CHANGED)
			for item in self.app.docs:
				item.model.clear_color_cache()
			self.app.current_doc.canvas.force_redraw()
开发者ID:sk1project,项目名称:sk1-wx,代码行数:8,代码来源:app_cms.py


示例13: close

	def close(self):
		if not self.docarea is None:
			self.app.mw.remove_tab(self.docarea)
		for obj in self.traced_objects: obj.close()
		fields = self.__dict__
		items = fields.keys()
		for item in items: fields[item] = None
		events.emit(events.DOC_CLOSED, self)
开发者ID:sk1project,项目名称:sk1-gtk2,代码行数:8,代码来源:presenter.py


示例14: start_

	def start_(self):
		self.snap = self.presenter.snap
		self.target = self.selection.objs[0]
		self.selection.clear()
		self.canvas.selection_redraw()
		self.orig_style = self.target.style
		self.new_style = deepcopy(self.orig_style)
		events.emit(events.APP_STATUS, self.msg)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:8,代码来源:grad_ctrl.py


示例15: start_

	def start_(self):
		self.snap = self.presenter.snap
		self.target = self.selection.objs[0]
		self.selected_obj = None
		self.update_points()
		self.api.set_mode()
		self.selection.clear()
		msg = _('Ellipse in editing')
		events.emit(events.APP_STATUS, msg)
开发者ID:Scrik,项目名称:sk1-wx,代码行数:9,代码来源:editor_ellipse.py


示例16: _set_target_vector

	def _set_target_vector(self, temp=True):
		itrafo = libgeom.invert_trafo(self.target.fill_trafo)
		vector = [self.vector[0].point, self.vector[1].point]
		self.new_style[0][2][1] = libgeom.apply_trafo_to_points(vector, itrafo)
		if temp:
			self.api.set_temp_style(self.target, self.new_style)
		else:
			self.api.set_fill_style(deepcopy(self.new_style[0]))
		events.emit(events.APP_STATUS, self.msg)
开发者ID:sk1project,项目名称:sk1-wx,代码行数:9,代码来源:grad_ctrl.py


示例17: call_after

	def call_after(self, *args):
		if self.docs: return
		if config.new_doc_on_start:
			self.load_plugins()
			self.new()
		else:
			txt = _('To start, create new document or open existing')
			events.emit(events.APP_STATUS, txt)
			self.load_plugins()
开发者ID:Scrik,项目名称:sk1-wx,代码行数:9,代码来源:application.py


示例18: update_points

	def update_points(self):
		self.points = []
		self.midpoints = []
		mps = self.target.get_midpoints()
		for item in mps:
			self.midpoints.append(MidPoint(self.canvas, self.target, item))
		corner_points = self.target.get_corner_points()
		stops = self.target.get_stops()
		for index in range(4):
			if not self.target.corners[index]:
				start = corner_points[index]
				stop = stops[index][0]
				stop2 = stops[index - 1]
				if len(stop2) == 2: stop2 = stop2[1]
				else: stop2 = stop2[0]
				coef = self.target.corners[index]
				self.points.append(ControlPoint(self.canvas, self.target, start,
											stop, stop2=stop2,
											coef=coef, index=index))
			elif self.target.corners[index] == 1.0:
				start = corner_points[index]
				stop = stops[index - 1]
				if len(stop) == 2:
					stop = stop[1]
					coef = self.target.corners[index]
					self.points.append(ControlPoint(self.canvas, self.target,
										start, stop, coef=coef, index=index))
				elif not self.target.corners[index - 1] == 1.0:
					stop = stop[0]
					coef = self.target.corners[index]
					self.points.append(ControlPoint(self.canvas, self.target,
										start, stop, coef=coef, index=index))

				stop = stops[index][0]
				start2 = []
				if len(stops[index]) == 1 and \
					self.target.corners[index - 3] == 1.0:
						start2 = corner_points[index - 3]
				coef = self.target.corners[index]
				self.points.append(ControlPoint(self.canvas, self.target, start,
									stop, start2=start2,
									coef=coef, index=index, subindex=1))
			else:
				start = corner_points[index]
				stop = stops[index - 1]
				if len(stop) == 2: stop = stop[1]
				else: stop = stop[0]
				coef = self.target.corners[index]
				self.points.append(ControlPoint(self.canvas, self.target, start,
											stop, coef=coef, index=index))

				stop = stops[index][0]
				self.points.append(ControlPoint(self.canvas, self.target, start,
									stop, coef=coef, index=index, subindex=1))
		msg = _('Rectangle in editing')
		events.emit(events.APP_STATUS, msg)
开发者ID:Scrik,项目名称:sk1-wx,代码行数:56,代码来源:editor_rect.py


示例19: set_mode

	def set_mode(self, mode=modes.SELECT_MODE):
		if not mode == self.mode:
			if not self.controller is None:
				self.controller.stop_()
			self.mode = mode
			self.controller = self.ctrls[mode]
			self.controller.set_cursor()
			self.controller.start_()
			events.emit(events.MODE_CHANGED, mode)
			self.grab_focus()
开发者ID:sk1project,项目名称:sk1-gtk2,代码行数:10,代码来源:canvas.py


示例20: call_after

	def call_after(self, *args):
		if self.docs: return
		if config.new_doc_on_start:
			self.load_plugins()
			self.new()
		else:
			txt = _('To start, create new document or open existing')
			events.emit(events.APP_STATUS, txt)
			self.load_plugins()
			if not wal.is_wx2(): events.emit(events.NO_DOCS)
		self.update_actions()
开发者ID:sk1project,项目名称:sk1-wx,代码行数:11,代码来源:application.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python libttk.TFrame类代码示例发布时间:2022-05-27
下一篇:
Python events.connect函数代码示例发布时间: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