mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Code for #7131 - implementing SUPPORTS_BACKLOADING
This commit is contained in:
parent
b9499d7fc7
commit
4e8115a753
@ -39,6 +39,10 @@ class DevicePlugin(Plugin):
|
||||
#: Whether the metadata on books can be set via the GUI.
|
||||
CAN_SET_METADATA = ['title', 'authors', 'collections']
|
||||
|
||||
# Set this to True if the books on the device are files that the GUI can
|
||||
# access in order to add the books from the device to the library
|
||||
SUPPORTS_BACKLOADING = False
|
||||
|
||||
#: Path separator for paths to books on device
|
||||
path_sep = os.sep
|
||||
|
||||
|
@ -94,6 +94,9 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
EBOOK_DIR_CARD_B = ''
|
||||
DELETE_EXTS = []
|
||||
|
||||
# USB disk-based devices can see the book files on the device, so can
|
||||
# copy these back to the library
|
||||
SUPPORTS_BACKLOADING = True
|
||||
|
||||
def reset(self, key='-1', log_packets=False, report_progress=None,
|
||||
detected_device=None):
|
||||
|
@ -19,7 +19,12 @@ class AddToLibraryAction(InterfaceAction):
|
||||
self.qaction.triggered.connect(self.add_books_to_library)
|
||||
|
||||
def location_selected(self, loc):
|
||||
enabled = loc != 'library'
|
||||
enabled = False
|
||||
if loc != 'library':
|
||||
if self.gui.device_manager.is_device_connected:
|
||||
device = self.gui.device_manager.connected_device
|
||||
if device is not None:
|
||||
enabled = getattr(device, 'SUPPORTS_BACKLOADING', False)
|
||||
self.qaction.setEnabled(enabled)
|
||||
|
||||
def add_books_to_library(self, *args):
|
||||
|
Loading…
x
Reference in New Issue
Block a user