mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
When an image is used for a column icon, display that image full-width if the image's width is more than 50% larger than the image's height, otherwise display it in an icon bounding box.
This commit is contained in:
parent
ccd8d30109
commit
2cc6b87ff3
@ -531,18 +531,3 @@ 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 = ['']
|
||||
|
||||
|
@ -94,10 +94,14 @@ 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)
|
||||
h = icon_bitmap.height()
|
||||
w = icon_bitmap.width()
|
||||
# If the image is landscape and width is more than 50%
|
||||
# large than height, use the pixmap. This tells Qt to display
|
||||
# the image full width. It might be clipped to row height.
|
||||
if w < (3 * h)/2:
|
||||
icon_bitmap = QIcon(icon_bitmap)
|
||||
icon_cache[id_][dex] = icon_bitmap
|
||||
icon_bitmap_cache[icon] = icon_bitmap
|
||||
self.mi = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user