mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Book details popup: Double clicking on the cover now uses calibre's internal image viewer. Right click on the cover to open it with another program. Fixes #1975406 [[Enhancement] Double click to open cover with the calibre Image viewer](https://bugs.launchpad.net/calibre/+bug/1975406)
This commit is contained in:
parent
47009b94db
commit
d5c83e5721
@ -7,9 +7,9 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import functools
|
import functools
|
||||||
from qt.core import (
|
from qt.core import (
|
||||||
QAction, QApplication, QDialog, QEvent, QIcon, QLabel, QMenu, QStylePainter,
|
QAction, QApplication, QDialog, QEvent, QIcon, QLabel, QMenu, QPixmap, QUrl,
|
||||||
QSizePolicy, QSplitter, QStackedWidget, QStatusBar, QStyle, QStyleOption, Qt,
|
QSizePolicy, QSplitter, QStackedWidget, QStatusBar, QStyle, QStyleOption,
|
||||||
QTabBar, QTimer, QToolButton, QVBoxLayout, QWidget
|
QStylePainter, Qt, QTabBar, QTimer, QToolButton, QVBoxLayout, QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.constants import get_appname_for_display, get_version, ismacos
|
from calibre.constants import get_appname_for_display, get_version, ismacos
|
||||||
@ -741,7 +741,15 @@ class LayoutMixin: # {{{
|
|||||||
cpath = self.current_db.new_api.format_abspath(book_id, '__COVER_INTERNAL__')
|
cpath = self.current_db.new_api.format_abspath(book_id, '__COVER_INTERNAL__')
|
||||||
if cpath:
|
if cpath:
|
||||||
if entry is None:
|
if entry is None:
|
||||||
|
pm = QPixmap()
|
||||||
|
pm.load(cpath)
|
||||||
|
pm.setDevicePixelRatio(self.devicePixelRatioF())
|
||||||
|
if pm.isNull():
|
||||||
open_local_file(cpath)
|
open_local_file(cpath)
|
||||||
|
else:
|
||||||
|
from calibre.gui2.image_popup import ImageView
|
||||||
|
iv = ImageView(QApplication.instance().focusWindow(), pm, QUrl.fromLocalFile(cpath), geom_name='book_details_image_view')
|
||||||
|
iv(use_exec=True)
|
||||||
return
|
return
|
||||||
from calibre.gui2.open_with import run_program
|
from calibre.gui2.open_with import run_program
|
||||||
run_program(entry, cpath, self)
|
run_program(entry, cpath, self)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user