mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Draw a thin broder around the cover in the edit metadata dialog. Fixes #6605 (Covers should be shown against a nonwhite background)
This commit is contained in:
parent
e8608b95be
commit
d1276cc5ff
@ -11,7 +11,7 @@ from PyQt4.Qt import QIcon, QFont, QLabel, QListWidget, QAction, \
|
|||||||
QPixmap, QSplitterHandle, QToolButton, \
|
QPixmap, QSplitterHandle, QToolButton, \
|
||||||
QAbstractListModel, QVariant, Qt, SIGNAL, pyqtSignal, \
|
QAbstractListModel, QVariant, Qt, SIGNAL, pyqtSignal, \
|
||||||
QRegExp, QSettings, QSize, QSplitter, \
|
QRegExp, QSettings, QSize, QSplitter, \
|
||||||
QPainter, QLineEdit, QComboBox, \
|
QPainter, QLineEdit, QComboBox, QPen, \
|
||||||
QMenu, QStringListModel, QCompleter, QStringList, \
|
QMenu, QStringListModel, QCompleter, QStringList, \
|
||||||
QTimer, QRect
|
QTimer, QRect
|
||||||
|
|
||||||
@ -151,11 +151,14 @@ class FormatList(QListWidget):
|
|||||||
|
|
||||||
class ImageView(QWidget):
|
class ImageView(QWidget):
|
||||||
|
|
||||||
|
BORDER_WIDTH = 1
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QWidget.__init__(self, parent)
|
QWidget.__init__(self, parent)
|
||||||
self._pixmap = QPixmap(self)
|
self._pixmap = QPixmap(self)
|
||||||
self.setMinimumSize(QSize(150, 200))
|
self.setMinimumSize(QSize(150, 200))
|
||||||
self.setAcceptDrops(True)
|
self.setAcceptDrops(True)
|
||||||
|
self.draw_border = True
|
||||||
|
|
||||||
# Drag 'n drop {{{
|
# Drag 'n drop {{{
|
||||||
DROPABBLE_EXTENSIONS = IMAGE_EXTENSIONS
|
DROPABBLE_EXTENSIONS = IMAGE_EXTENSIONS
|
||||||
@ -229,6 +232,11 @@ class ImageView(QWidget):
|
|||||||
p = QPainter(self)
|
p = QPainter(self)
|
||||||
p.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
|
p.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
|
||||||
p.drawPixmap(target, pmap)
|
p.drawPixmap(target, pmap)
|
||||||
|
pen = QPen()
|
||||||
|
pen.setWidth(self.BORDER_WIDTH)
|
||||||
|
p.setPen(pen)
|
||||||
|
if self.draw_border:
|
||||||
|
p.drawRect(target)
|
||||||
p.end()
|
p.end()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user