from pyscreenshot.util import platform_is_osx from bt import backend_to_check, check_import # qt color problem on osx if not platform_is_osx(): if check_import("PySide"): def test_pyside(): backend_to_check("pyside")
from pyscreenshot.util import platform_is_osx from bt import backend_to_check, check_import # qt color problem on osx if not platform_is_osx(): if check_import("PyQt4"): def test_pyqt4(): backend_to_check("pyqt")
from pyscreenshot.util import platform_is_osx from bt import backend_to_check, check_import # qt color problem on osx if not platform_is_osx(): if check_import("qtpy"): def test_qtpy(): backend_to_check("qtpy")
except ImportError: display = None # https://github.com/python-xlib/python-xlib/blob/master/examples/xrandr.py#L44 def missing_RANDR(): if platform_is_osx(): return False if not display: return False disp = display.Display() return not disp.has_extension("RANDR") ok = False if check_import("mss"): if platform_is_osx() and not use_x_display(): ok = True if platform_is_linux() and use_x_display(): ok = True if platform_is_win(): ok = True if ok: def test_mss(): if missing_RANDR(): try: backend_to_check("mss") except FailedBackendError: pass
from pyscreenshot.util import platform_is_osx, py2 from bt import backend_to_check, check_import # qt color problem on osx if not platform_is_osx(): if not py2() and check_import("PySide2"): def test_pyside2(): backend_to_check("pyside2")
from pyscreenshot.util import py2 from bt import backend_to_check, check_import # no pygtk for py3 if py2() and check_import("gtk"): def test_pygtk(): backend_to_check("pygtk")
from bt import backend_to_check, check_import from pyscreenshot.util import platform_is_osx # qt color problem on osx if not platform_is_osx(): if check_import("PyQt5"): def test_pyqt5(): backend_to_check("pyqt5")
from bt import backend_to_check, check_import from pyscreenshot.util import platform_is_osx if not platform_is_osx() and check_import("wx"): def test_wx(): backend_to_check("wx")
except ImportError: display = None # https://github.com/python-xlib/python-xlib/blob/master/examples/xrandr.py#L44 def missing_RANDR(): if platform_is_osx(): return False if not display: return False disp = display.Display() return not disp.has_extension("RANDR") ok = False if not py2() and check_import("mss"): if platform_is_osx() and not use_x_display(): ok = True if platform_is_linux() and use_x_display(): ok = True if platform_is_win(): ok = True if ok: def test_mss(): if missing_RANDR(): try: backend_to_check("mss") except FailedBackendError: pass
from bt import backend_to_check, check_import from pyscreenshot.util import use_x_display ok = False if check_import("gi"): if use_x_display(): import gi # Arch: AttributeError: module 'gi' has no attribute 'require_version' try: gi.require_version("Gdk", "3.0") ok = True except AttributeError: pass except ValueError: pass if ok: def test_pygdk3(): backend_to_check("pygdk3")