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


Python EasyProcess.wrap方法代码示例

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


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

示例1: test_slowshot_wrap

# 需要导入模块: from easyprocess import EasyProcess [as 别名]
# 或者: from easyprocess.EasyProcess import wrap [as 别名]
 def test_slowshot_wrap(self):
     disp = SmartDisplay(visible=0)
     py = path(__file__).parent / ('slowgui.py')
     proc = EasyProcess('python ' + py)
     f = disp.wrap(proc.wrap(disp.waitgrab))
     img = f()
     eq_(img is not None, True)
开发者ID:AvdN,项目名称:PyVirtualDisplay,代码行数:9,代码来源:test_smart.py

示例2: prog_shot

# 需要导入模块: from easyprocess import EasyProcess [as 别名]
# 或者: from easyprocess.EasyProcess import wrap [as 别名]
def prog_shot(cmd, f, wait, timeout, screen_size, visible, bgcolor, cwd=None):
    '''start process in headless X and create screenshot after 'wait' sec.
    Repeats screenshot until it is not empty if 'repeat_if_empty'=True.

    wait: wait at least N seconds after first window is displayed,
    it can be used to skip splash screen

    :param enable_crop: True -> crop screenshot
    :param wait: int
    '''
    disp = SmartDisplay(visible=visible, size=screen_size, bgcolor=bgcolor)
    disp.pyscreenshot_backend = None
    disp.pyscreenshot_childprocess = True
    proc = EasyProcess(cmd, cwd=cwd)

    def func():
        try:
            img = disp.waitgrab(timeout=timeout)
        except DisplayTimeoutError as e:
            raise DisplayTimeoutError(str(e) + ' ' + str(proc))
        if wait:
            proc.sleep(wait)
            img = disp.grab()
        return img

    img = disp.wrap(proc.wrap(func))()
    if img:
        img.save(f)
    return (proc.stdout, proc.stderr)
开发者ID:ponty,项目名称:sphinxcontrib-programscreenshot,代码行数:31,代码来源:programscreenshot.py

示例3: test_slowshot_timeout

# 需要导入模块: from easyprocess import EasyProcess [as 别名]
# 或者: from easyprocess.EasyProcess import wrap [as 别名]
 def test_slowshot_timeout(self):
     disp = SmartDisplay(visible=0)
     py = path(__file__).parent / ('slowgui.py')
     proc = EasyProcess('python ' + py)
     f = disp.wrap(proc.wrap(lambda: disp.waitgrab(timeout=1)))
     self.assertRaises(DisplayTimeoutError, f)
开发者ID:AvdN,项目名称:PyVirtualDisplay,代码行数:8,代码来源:test_smart.py

示例4: test_empty

# 需要导入模块: from easyprocess import EasyProcess [as 别名]
# 或者: from easyprocess.EasyProcess import wrap [as 别名]
 def test_empty(self):
     disp = SmartDisplay(visible=0)
     proc = EasyProcess(sys.executable)
     f = disp.wrap(proc.wrap(disp.waitgrab))
     self.assertRaises(Exception, f)
开发者ID:AvdN,项目名称:PyVirtualDisplay,代码行数:7,代码来源:test_smart.py


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