Пример #1
0
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)
Пример #2
0
def _backend_version(backend):
    loader = Loader()
    loader.force(backend)
    try:
        x = loader.selected()
        v = x.backend_version()
    except Exception:
        v = None
    return v
Пример #3
0
def backends():
    '''Back-end names as a list
    
    :return: back-ends as string list
    '''
    return Loader().all_names
Пример #4
0
def backends():
    """Back-end names as a list.

    :return: back-ends as string list
    """
    return Loader().all_names
Пример #5
0
def _grab_simple(backend=None, bbox=None, filename=None):
    loader = Loader()
    loader.force(backend)
    backend_obj = loader.selected()
    return backend_obj.grab(bbox)
Пример #6
0
 def test_mix(self):
     man = Loader()
     man.force('scrot')
     man.set_preference(['imagemagick', 'scrot'])
     eq_(man.selected().name, 'scrot')
Пример #7
0
 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
Пример #8
0
    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')
Пример #9
0
def _get_loader():
    global BACKEND_LOADER
    if not BACKEND_LOADER:
        BACKEND_LOADER = Loader()
    return BACKEND_LOADER