def _grab_simple(to_file, backend=None, bbox=None, filename=None, timeout=None): loader = Loader() loader.force(backend) backend_obj = loader.selected() if to_file: return backend_obj.grab_to_file(filename) else: return backend_obj.grab(bbox)
def _backend_version(backend): loader = Loader() loader.force(backend) try: x = loader.selected() v = x.backend_version() except Exception: v = None return v
def backends(): '''Back-end names as a list :return: back-ends as string list ''' return Loader().all_names
def backends(): """Back-end names as a list. :return: back-ends as string list """ return Loader().all_names
def _grab_simple(backend=None, bbox=None, filename=None): loader = Loader() loader.force(backend) backend_obj = loader.selected() return backend_obj.grab(bbox)
def test_mix(self): man = Loader() man.force('scrot') man.set_preference(['imagemagick', 'scrot']) eq_(man.selected().name, 'scrot')
def test_force(self): man = Loader() for name in ['imagemagick', 'scrot', 'pygtk', 'pyqt', 'wx']: man.force(name) eq_(man.selected().name, name) man.force(None) # for other tests
def test_pref(self): man = Loader() man.force(None) man.set_preference(['imagemagick', 'scrot']) eq_(man.selected().name, 'imagemagick') man.set_preference(['imagemagick', 'scrot', 'imagemagick']) eq_(man.selected().name, 'imagemagick') man.set_preference(['imagemagick']) eq_(man.selected().name, 'imagemagick') man.set_preference(['pygtk', 'imagemagick', 'scrot']) eq_(man.selected().name, 'pygtk') man.set_preference(['scrot', 'imagemagick']) eq_(man.selected().name, 'scrot') man.set_preference(['scrot', 'imagemagick', 'pygtk']) eq_(man.selected().name, 'scrot') man.set_preference(['scrot', 'imagemagick', 'scrot']) eq_(man.selected().name, 'scrot') man.set_preference(['scrot']) eq_(man.selected().name, 'scrot')
def _get_loader(): global BACKEND_LOADER if not BACKEND_LOADER: BACKEND_LOADER = Loader() return BACKEND_LOADER