mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
commit
1b9a1c7ed7
|
@ -33,6 +33,8 @@ class PillowQPixmapTestCase(PillowQtTestCase):
|
|||
from PyQt4.QtGui import QGuiApplication
|
||||
elif ImageQt.qt_version == 'side':
|
||||
from PySide.QtGui import QGuiApplication
|
||||
elif ImageQt.qt_version == 'side2':
|
||||
from PySide2.QtGui import QGuiApplication
|
||||
except ImportError:
|
||||
self.skipTest('QGuiApplication not installed')
|
||||
|
||||
|
@ -56,6 +58,8 @@ class TestImageQt(PillowQtTestCase, PillowTestCase):
|
|||
from PyQt4.QtGui import qRgb
|
||||
elif ImageQt.qt_version == 'side':
|
||||
from PySide.QtGui import qRgb
|
||||
elif ImageQt.qt_version == 'side2':
|
||||
from PySide2.QtGui import qRgb
|
||||
|
||||
self.assertEqual(qRgb(0, 0, 0), qRgba(0, 0, 0, 255))
|
||||
|
||||
|
|
|
@ -13,13 +13,21 @@ if ImageQt.qt_is_installed:
|
|||
QT_VERSION = 5
|
||||
except (ImportError, RuntimeError):
|
||||
try:
|
||||
from PyQt4 import QtGui
|
||||
from PyQt4.QtGui import QWidget, QHBoxLayout, QLabel, QApplication
|
||||
QT_VERSION = 4
|
||||
from PySide2 import QtGui
|
||||
from PySide2.QtWidgets import QWidget, QHBoxLayout, QLabel, \
|
||||
QApplication
|
||||
QT_VERSION = 5
|
||||
except (ImportError, RuntimeError):
|
||||
from PySide import QtGui
|
||||
from PySide.QtGui import QWidget, QHBoxLayout, QLabel, QApplication
|
||||
QT_VERSION = 4
|
||||
try:
|
||||
from PyQt4 import QtGui
|
||||
from PyQt4.QtGui import QWidget, QHBoxLayout, QLabel, \
|
||||
QApplication
|
||||
QT_VERSION = 4
|
||||
except (ImportError, RuntimeError):
|
||||
from PySide import QtGui
|
||||
from PySide.QtGui import QWidget, QHBoxLayout, QLabel, \
|
||||
QApplication
|
||||
QT_VERSION = 4
|
||||
|
||||
|
||||
class TestToQImage(PillowQtTestCase, PillowTestCase):
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
:py:mod:`ImageQt` Module
|
||||
========================
|
||||
|
||||
The :py:mod:`ImageQt` module contains support for creating PyQt4, PyQt5 or
|
||||
PySide QImage objects from PIL images.
|
||||
The :py:mod:`ImageQt` module contains support for creating PyQt4, PyQt5, PySide or
|
||||
PySide2 QImage objects from PIL images.
|
||||
|
||||
.. versionadded:: 1.1.6
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import sys
|
|||
|
||||
qt_versions = [
|
||||
['5', 'PyQt5'],
|
||||
['side2', 'PySide2'],
|
||||
['4', 'PyQt4'],
|
||||
['side', 'PySide']
|
||||
]
|
||||
|
@ -33,6 +34,9 @@ for qt_version, qt_module in qt_versions:
|
|||
if qt_module == 'PyQt5':
|
||||
from PyQt5.QtGui import QImage, qRgba, QPixmap
|
||||
from PyQt5.QtCore import QBuffer, QIODevice
|
||||
elif qt_module == 'PySide2':
|
||||
from PySide2.QtGui import QImage, qRgba, QPixmap
|
||||
from PySide2.QtCore import QBuffer, QIODevice
|
||||
elif qt_module == 'PyQt4':
|
||||
from PyQt4.QtGui import QImage, qRgba, QPixmap
|
||||
from PyQt4.QtCore import QBuffer, QIODevice
|
||||
|
|
Loading…
Reference in New Issue
Block a user