mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
When vieweing a book on the device by clicking in the book details panel, first copy the book off the device, this allows it to work for the smart device driver and the MTP driver
This commit is contained in:
parent
4bc92ec184
commit
4e20f776bc
@ -256,6 +256,15 @@ class ViewAction(InterfaceAction):
|
||||
db.prefs['gui_view_history'] = history[:vh]
|
||||
self.build_menus(db)
|
||||
|
||||
def view_device_book(self, path):
|
||||
pt = PersistentTemporaryFile('_view_device_book'+\
|
||||
os.path.splitext(path)[1])
|
||||
self.persistent_files.append(pt)
|
||||
pt.close()
|
||||
self.gui.device_manager.view_book(
|
||||
Dispatcher(self.book_downloaded_for_viewing),
|
||||
path, pt.name)
|
||||
|
||||
def _view_books(self, rows):
|
||||
if not rows or len(rows) == 0:
|
||||
self._launch_viewer()
|
||||
@ -270,12 +279,5 @@ class ViewAction(InterfaceAction):
|
||||
else:
|
||||
paths = self.gui.current_view().model().paths(rows)
|
||||
for path in paths:
|
||||
pt = PersistentTemporaryFile('_viewer_'+\
|
||||
os.path.splitext(path)[1])
|
||||
self.persistent_files.append(pt)
|
||||
pt.close()
|
||||
self.gui.device_manager.view_book(\
|
||||
Dispatcher(self.book_downloaded_for_viewing),
|
||||
path, pt.name)
|
||||
|
||||
self.view_device_book(path)
|
||||
|
||||
|
@ -19,8 +19,8 @@ from calibre.ebooks.metadata import fmt_sidx
|
||||
from calibre.ebooks.metadata.sources.identify import urls_from_identifiers
|
||||
from calibre.constants import filesystem_encoding
|
||||
from calibre.library.comments import comments_to_html
|
||||
from calibre.gui2 import (config, open_local_file, open_url, pixmap_to_data,
|
||||
gprefs, rating_font)
|
||||
from calibre.gui2 import (config, open_url, pixmap_to_data, gprefs,
|
||||
rating_font)
|
||||
from calibre.utils.icu import sort_key
|
||||
from calibre.utils.formatter import EvalFormatter
|
||||
from calibre.utils.date import is_date_undefined
|
||||
@ -569,6 +569,7 @@ class BookDetails(QWidget): # {{{
|
||||
files_dropped = pyqtSignal(object, object)
|
||||
cover_changed = pyqtSignal(object, object)
|
||||
cover_removed = pyqtSignal(object)
|
||||
view_device_book = pyqtSignal(object)
|
||||
|
||||
# Drag 'n drop {{{
|
||||
DROPABBLE_EXTENSIONS = IMAGE_EXTENSIONS+BOOK_EXTENSIONS
|
||||
@ -643,7 +644,7 @@ class BookDetails(QWidget): # {{{
|
||||
id_, fmt = val.split(':')
|
||||
self.view_specific_format.emit(int(id_), fmt)
|
||||
elif typ == 'devpath':
|
||||
open_local_file(val)
|
||||
self.view_device_book.emit(val)
|
||||
else:
|
||||
try:
|
||||
open_url(QUrl(link, QUrl.TolerantMode))
|
||||
|
@ -269,6 +269,8 @@ class LayoutMixin(object): # {{{
|
||||
self.iactions['Remove Books'].remove_format_by_id)
|
||||
self.book_details.save_specific_format.connect(
|
||||
self.iactions['Save To Disk'].save_library_format_by_ids)
|
||||
self.book_details.view_device_book.connect(
|
||||
self.iactions['View'].view_device_book)
|
||||
|
||||
m = self.library_view.model()
|
||||
if m.rowCount(None) > 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user