Edit book: insert image: remember size of displayed thumbnails. Fixes #1795845 [[enhancement] editor, remember insert image thumbnail settings](https://bugs.launchpad.net/calibre/+bug/1795845)

This commit is contained in:
Kovid Goyal 2018-10-11 21:01:03 +05:30
parent baf0cbad6a
commit bdb6d4e246
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -80,14 +80,15 @@ class ImageDelegate(QStyledItemDelegate):
def __init__(self, parent):
super(ImageDelegate, self).__init__(parent)
self.current_basic_size = [120, 160]
self.current_basic_size = tprefs.get('image-thumbnail-preview-size', [120, 160])
self.set_dimensions()
def change_size(self, increase=True):
percent = 10 if increase else -10
frac = (100 + percent) / 100.
self.current_basic_size[0] = max(40, int(frac * self.current_basic_size[0]))
self.current_basic_size[1] = max(60, int(frac * self.current_basic_size[1]))
self.current_basic_size[0] = min(1200, max(40, int(frac * self.current_basic_size[0])))
self.current_basic_size[1] = min(1600, max(60, int(frac * self.current_basic_size[1])))
tprefs.set('image-thumbnail-preview-size', self.current_basic_size)
self.set_dimensions()
def set_dimensions(self):