Add tweak use_rectangular_images_for_icons_for_columns.

This commit is contained in:
Charles Haley 2013-03-31 10:27:58 +02:00
parent 3ddc8d97fa
commit a983762e72
2 changed files with 20 additions and 2 deletions

View file

@ -531,3 +531,18 @@
# number here. The default is ten libraries.
many_libraries = 10
#: Use rectangular (non-square) images for icons for columns
# When using column icons, the images are normally displayed as square icons in
# a small box. If necessary, the images are scaled to fit into that box to
# ensure that all the images are the same size. In some cases you might not want
# this behavior, instead wanting the image to be shown as rectangles with their
# orignal aspect ratio. Enter the lookup names of columns where you want this
# behavior. Note that calibre will scale the image so that it is maximum 128
# pixels wide and that it fits within the height of the displaying row. For this
# reason you should be sure that the images are oriented in landscape, not
# portrait.
# Examples:
# use_rectangular_images_for_icons_for_columns = ['#enum2', '#myrating']
# use_rectangular_images_for_icons_for_columns = []
use_rectangular_images_for_icons_for_columns = ['']

View file

@ -9,7 +9,7 @@
from collections import defaultdict
from PyQt4.Qt import (QAbstractTableModel, Qt, pyqtSignal, QIcon, QImage,
QModelIndex, QVariant, QDateTime, QColor)
QModelIndex, QVariant, QDateTime, QColor, QPixmap)
from calibre.gui2 import NONE, UNDEFINED_QDATETIME, error_dialog
from calibre.utils.pyparsing import ParseException
@ -94,7 +94,10 @@ def __call__(self, id_, key, fmt, kind, db, icon_cache, icon_bitmap_cache):
return icon_bitmap
d = os.path.join(config_dir, 'cc_icons', icon)
if (os.path.exists(d)):
icon_bitmap = QIcon(d)
if key in tweaks['use_rectangular_images_for_icons_for_columns']:
icon_bitmap = QPixmap(d)
else:
icon_bitmap = QIcon(d)
icon_cache[id_][dex] = icon_bitmap
icon_bitmap_cache[icon] = icon_bitmap
self.mi = None