Flake8 and health fixes

This commit is contained in:
Andrew Murray 2015-06-19 15:36:23 +10:00
parent 43e2c92802
commit 33d51d4255
2 changed files with 8 additions and 7 deletions

View File

@ -48,7 +48,8 @@ def rgb(r, g, b, a=255):
return (qRgba(r, g, b, a) & 0xffffffff) return (qRgba(r, g, b, a) & 0xffffffff)
# :param im A PIL Image object, or a file name (given either as Python string or a PyQt string object). # :param im A PIL Image object, or a file name
# (given either as Python string or a PyQt string object)
def fromqimage(im): def fromqimage(im):
buffer = QBuffer() buffer = QBuffer()
@ -139,9 +140,8 @@ if qt_is_installed:
def __init__(self, im): def __init__(self, im):
im_data = _toqclass_helper(im) im_data = _toqclass_helper(im)
QImage.__init__(self, QImage.__init__(self,
im_data['data'], im_data['im'].size[0], im_data['im'].size[1], im_data['data'], im_data['im'].size[0],
im_data['format'] im_data['im'].size[1], im_data['format'])
)
if im_data['colortable']: if im_data['colortable']:
self.setColorTable(im_data['colortable']) self.setColorTable(im_data['colortable'])
@ -160,4 +160,4 @@ def toqpixmap(im):
im = im.convert('RGBA') im = im.convert('RGBA')
qimage = toqimage(im) qimage = toqimage(im)
qimage.save('/tmp/hopper_{}_qpixmap_qimage.png'.format(im.mode)) qimage.save('/tmp/hopper_{}_qpixmap_qimage.png'.format(im.mode))
return QPixmap.fromImage(qimage) return QPixmap.fromImage(qimage)

View File

@ -13,7 +13,7 @@ else:
test_case.skipTest('PyQt4, PyQt5, or PySide is not installed') test_case.skipTest('PyQt4, PyQt5, or PySide is not installed')
class PillowQtTestCase: class PillowQtTestCase(object):
def setUp(self): def setUp(self):
skip_if_qt_is_not_installed(self) skip_if_qt_is_not_installed(self)
@ -21,6 +21,7 @@ class PillowQtTestCase:
def tearDown(self): def tearDown(self):
pass pass
class PillowQPixmapTestCase(PillowQtTestCase): class PillowQPixmapTestCase(PillowQtTestCase):
def setUp(self): def setUp(self):
@ -34,7 +35,7 @@ class PillowQPixmapTestCase(PillowQtTestCase):
from PySide.QtGui import QGuiApplication from PySide.QtGui import QGuiApplication
except ImportError: except ImportError:
self.skipTest('QGuiApplication not installed') self.skipTest('QGuiApplication not installed')
self.app = QGuiApplication([]) self.app = QGuiApplication([])
def tearDown(self): def tearDown(self):