本文整理汇总了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()