mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Changes to device editable columns to give fine-grain control over what columns can be edited.
This commit is contained in:
parent
02e9160f37
commit
c67a9d8487
@ -38,7 +38,7 @@ class FOLDER_DEVICE(USBMS):
|
||||
|
||||
THUMBNAIL_HEIGHT = 68 # Height for thumbnails on device
|
||||
|
||||
CAN_SET_METADATA = True
|
||||
CAN_SET_METADATA = ['title', 'authors']
|
||||
SUPPORTS_SUB_DIRS = True
|
||||
|
||||
#: Icon for this device
|
||||
|
@ -37,7 +37,7 @@ class DevicePlugin(Plugin):
|
||||
THUMBNAIL_HEIGHT = 68
|
||||
|
||||
#: Whether the metadata on books can be set via the GUI.
|
||||
CAN_SET_METADATA = True
|
||||
CAN_SET_METADATA = ['title', 'authors', 'collections']
|
||||
|
||||
#: Path separator for paths to books on device
|
||||
path_sep = os.sep
|
||||
|
@ -30,7 +30,7 @@ class KOBO(USBMS):
|
||||
|
||||
# Ordered list of supported formats
|
||||
FORMATS = ['epub', 'pdf']
|
||||
CAN_SET_METADATA = True
|
||||
CAN_SET_METADATA = ['collections']
|
||||
|
||||
VENDOR_ID = [0x2237]
|
||||
PRODUCT_ID = [0x4161]
|
||||
|
@ -27,7 +27,7 @@ class PRS505(USBMS):
|
||||
|
||||
|
||||
FORMATS = ['epub', 'lrf', 'lrx', 'rtf', 'pdf', 'txt']
|
||||
CAN_SET_METADATA = True
|
||||
CAN_SET_METADATA = ['title', 'authors', 'collections']
|
||||
|
||||
VENDOR_ID = [0x054c] #: SONY Vendor Id
|
||||
PRODUCT_ID = [0x031e]
|
||||
|
@ -50,7 +50,7 @@ class USBMS(CLI, Device):
|
||||
book_class = Book
|
||||
|
||||
FORMATS = []
|
||||
CAN_SET_METADATA = False
|
||||
CAN_SET_METADATA = []
|
||||
METADATA_CACHE = 'metadata.calibre'
|
||||
|
||||
def get_device_information(self, end_session=True):
|
||||
|
@ -907,7 +907,7 @@ class DeviceBooksModel(BooksModel): # {{{
|
||||
}
|
||||
self.marked_for_deletion = {}
|
||||
self.search_engine = OnDeviceSearch(self)
|
||||
self.editable = True
|
||||
self.editable = ['title', 'authors', 'collections']
|
||||
self.book_in_library = None
|
||||
|
||||
def mark_for_deletion(self, job, rows, rows_are_ids=False):
|
||||
@ -953,11 +953,11 @@ class DeviceBooksModel(BooksModel): # {{{
|
||||
if self.map[index.row()] in self.indices_to_be_deleted():
|
||||
return Qt.ItemIsUserCheckable # Can't figure out how to get the disabled flag in python
|
||||
flags = QAbstractTableModel.flags(self, index)
|
||||
if index.isValid() and self.editable:
|
||||
if index.isValid():
|
||||
cname = self.column_map[index.column()]
|
||||
if cname in ('title', 'authors') or \
|
||||
(cname == 'collections' and \
|
||||
callable(getattr(self.db, 'supports_collections', None)) and \
|
||||
if cname in self.editable and \
|
||||
cname != 'collections' or \
|
||||
(callable(getattr(self.db, 'supports_collections', None)) and \
|
||||
self.db.supports_collections() and \
|
||||
prefs['manage_device_metadata']=='manual'):
|
||||
flags |= Qt.ItemIsEditable
|
||||
@ -1243,7 +1243,14 @@ class DeviceBooksModel(BooksModel): # {{{
|
||||
def set_editable(self, editable):
|
||||
# Cannot edit if metadata is sent on connect. Reason: changes will
|
||||
# revert to what is in the library on next connect.
|
||||
self.editable = editable and prefs['manage_device_metadata']!='on_connect'
|
||||
if isinstance(editable, list):
|
||||
self.editable = editable
|
||||
elif editable:
|
||||
self.editable = ['title', 'authors', 'collections']
|
||||
else:
|
||||
self.editable = []
|
||||
if prefs['manage_device_metadata']=='on_connect':
|
||||
self.editable = []
|
||||
|
||||
def set_search_restriction(self, s):
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user