本文整理匯總了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
示例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)
示例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()