mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Add tweak use_rectangular_images_for_icons_for_columns.
This commit is contained in:
parent
3ddc8d97fa
commit
a983762e72
@ -531,3 +531,18 @@ numeric_collation = False
|
||||
# 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 = ['']
|
||||
|
||||
|
@ -9,7 +9,7 @@ import functools, re, os, traceback, errno, time
|
||||
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,6 +94,9 @@ class ColumnIcon(object):
|
||||
return icon_bitmap
|
||||
d = os.path.join(config_dir, 'cc_icons', icon)
|
||||
if (os.path.exists(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
|
||||
|
Loading…
x
Reference in New Issue
Block a user