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


Python Application.spawn方法代码示例

本文整理汇总了Python中zim.applications.Application.spawn方法的典型用法代码示例。如果您正苦于以下问题:Python Application.spawn方法的具体用法?Python Application.spawn怎么用?Python Application.spawn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在zim.applications.Application的用法示例。


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

示例1: do_response_ok

# 需要导入模块: from zim.applications import Application [as 别名]
# 或者: from zim.applications.Application import spawn [as 别名]
	def do_response_ok(self):
		tmpfile = TmpFile('insert-screenshot.png')
		options = ()

		if COMMAND == 'scrot':
			if self.select_radio.get_active():
				options += ('--select', '--border')
				# Interactively select a window or rectangle with the mouse.
				# When selecting a window, grab wm border too
			else:
				options += ('--multidisp',)
				# For multiple heads, grab shot from each and join them together.

		delay = self.time_spin.get_value_as_int()
		if delay > 0:
			options += ('-d', str(delay))
			# Wait NUM seconds before taking a shot.

		helper = Application((COMMAND,) + options)

		def callback(status, tmpfile):
			if status == helper.STATUS_OK:
				name = time.strftime('screenshot_%Y-%m-%d-%H%M%S.png')
				dir = self.notebook.get_attachments_dir(self.page)
				file = dir.new_file(name)
				tmpfile.rename(file)
				self.ui.pageview.insert_image(file, interactive=False) # XXX ui == window
			else:
				ErrorDialog(self.ui,
					_('Some error occurred while running "%s"') % COMMAND).run()
					# T: Error message in "insert screenshot" dialog, %s will be replaced by application name

		tmpfile.dir.touch()
		helper.spawn((tmpfile,), callback, tmpfile)
		return True
开发者ID:gdw2,项目名称:zim,代码行数:37,代码来源:screenshot.py

示例2: insert_screenshot2

# 需要导入模块: from zim.applications import Application [as 别名]
# 或者: from zim.applications.Application import spawn [as 别名]
	def insert_screenshot2(self):
		self.notebook = self.window.ui.notebook  # XXX
		self.page = self.window.ui.page  # XXX
		self.ui = self.window.ui  # XXX
		tmpfile = TmpFile('insert-screenshot.png')
		delay = 0
		selection_mode = True

		helper = Application((self.screenshot_command,))

		def callback(status, tmpfile):
			name = time.strftime('screenshot_%Y-%m-%d-%H%M%S.png')
			imgdir = self.notebook.get_attachments_dir(self.page)
			imgfile = imgdir.new_file(name)
			tmpfile.rename(imgfile)
			pageview = self.ui.mainwindow.pageview
			pageview.insert_image(imgfile, interactive=False, force=True)

		tmpfile.dir.touch()
		helper.spawn((tmpfile,), callback, tmpfile)
开发者ID:blue119,项目名称:yp-zim-plugin,代码行数:22,代码来源:screenshot2.py

示例3: spawn

# 需要导入模块: from zim.applications import Application [as 别名]
# 或者: from zim.applications.Application import spawn [as 别名]
	def spawn(self, *args):
		'''Spawn a new instance of zim'''
		# TODO: after implementing the daemon, put this in that module
		from zim.applications import Application
		zim = Application((ZIM_EXECUTABLE,) + args)
		zim.spawn()
开发者ID:damiansimanuk,项目名称:texslide,代码行数:8,代码来源:__init__.py


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