當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。