mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Pull from driver-dev
This commit is contained in:
commit
3a99f99104
@ -205,7 +205,8 @@ def main():
|
|||||||
scanner.scan()
|
scanner.scan()
|
||||||
for d in device_plugins():
|
for d in device_plugins():
|
||||||
if scanner.is_device_connected(d):
|
if scanner.is_device_connected(d):
|
||||||
dev = d(log_packets=options.log_packets)
|
dev = d
|
||||||
|
dev.reset(log_packets=options.log_packets)
|
||||||
|
|
||||||
if dev is None:
|
if dev is None:
|
||||||
print >>sys.stderr, 'Unable to find a connected ebook reader.'
|
print >>sys.stderr, 'Unable to find a connected ebook reader.'
|
||||||
|
@ -90,12 +90,11 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_fdi(cls):
|
def get_fdi(cls):
|
||||||
fdi = ''
|
fdi = ''
|
||||||
|
|
||||||
for vid in cls.VENDOR_ID:
|
for vid in cls.VENDOR_ID:
|
||||||
for pid in cls.PRODUCT_ID:
|
for pid in cls.PRODUCT_ID:
|
||||||
fdi_base_values = dict(
|
fdi_base_values = dict(
|
||||||
app=__appname__,
|
app=__appname__,
|
||||||
deviceclass=cls.__class__.__name__,
|
deviceclass=cls.__name__,
|
||||||
vendor_id=hex(vid),
|
vendor_id=hex(vid),
|
||||||
product_id=hex(pid),
|
product_id=hex(pid),
|
||||||
main_memory=cls.MAIN_MEMORY_VOLUME_LABEL,
|
main_memory=cls.MAIN_MEMORY_VOLUME_LABEL,
|
||||||
|
@ -436,7 +436,7 @@ class DeviceGUI(object):
|
|||||||
fmt = None
|
fmt = None
|
||||||
if specific:
|
if specific:
|
||||||
d = ChooseFormatDialog(self, _('Choose format to send to device'),
|
d = ChooseFormatDialog(self, _('Choose format to send to device'),
|
||||||
self.device_manager.device_class.FORMATS)
|
self.device_manager.device_class.settings().format_map)
|
||||||
d.exec_()
|
d.exec_()
|
||||||
fmt = d.format().lower()
|
fmt = d.format().lower()
|
||||||
dest, sub_dest = dest.split(':')
|
dest, sub_dest = dest.split(':')
|
||||||
@ -581,7 +581,7 @@ class DeviceGUI(object):
|
|||||||
ids = list(dynamic.get('news_to_be_synced', set([])))
|
ids = list(dynamic.get('news_to_be_synced', set([])))
|
||||||
ids = [id for id in ids if self.library_view.model().db.has_id(id)]
|
ids = [id for id in ids if self.library_view.model().db.has_id(id)]
|
||||||
files = self.library_view.model().get_preferred_formats_from_ids(
|
files = self.library_view.model().get_preferred_formats_from_ids(
|
||||||
ids, self.device_manager.device_class.FORMATS)
|
ids, self.device_manager.device_class.settings().format_map)
|
||||||
files = [f for f in files if f is not None]
|
files = [f for f in files if f is not None]
|
||||||
if not files:
|
if not files:
|
||||||
dynamic.set('news_to_be_synced', set([]))
|
dynamic.set('news_to_be_synced', set([]))
|
||||||
@ -618,7 +618,7 @@ class DeviceGUI(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
_files, _auto_rows = self.library_view.model().get_preferred_formats(rows,
|
_files, _auto_rows = self.library_view.model().get_preferred_formats(rows,
|
||||||
self.device_manager.device_class.FORMATS,
|
self.device_manager.device_class.settings().format_map,
|
||||||
paths=True, set_metadata=True,
|
paths=True, set_metadata=True,
|
||||||
specific_format=specific_format,
|
specific_format=specific_format,
|
||||||
exclude_auto=do_auto_convert)
|
exclude_auto=do_auto_convert)
|
||||||
@ -667,7 +667,7 @@ class DeviceGUI(object):
|
|||||||
if specific_format == None:
|
if specific_format == None:
|
||||||
formats = [f.lower() for f in self.library_view.model().db.formats(row).split(',')]
|
formats = [f.lower() for f in self.library_view.model().db.formats(row).split(',')]
|
||||||
formats = formats if formats != None else []
|
formats = formats if formats != None else []
|
||||||
if list(set(formats).intersection(available_input_formats())) != [] and list(set(self.device_manager.device_class.FORMATS).intersection(available_output_formats())) != []:
|
if list(set(formats).intersection(available_input_formats())) != [] and list(set(self.device_manager.device_class.settings().format_map).intersection(available_output_formats())) != []:
|
||||||
auto.append(row)
|
auto.append(row)
|
||||||
else:
|
else:
|
||||||
bad.append(self.library_view.model().title(row))
|
bad.append(self.library_view.model().title(row))
|
||||||
@ -682,8 +682,8 @@ class DeviceGUI(object):
|
|||||||
autos = '\n'.join('<li>%s</li>'%(i,) for i in autos)
|
autos = '\n'.join('<li>%s</li>'%(i,) for i in autos)
|
||||||
d = info_dialog(self, _('No suitable formats'),
|
d = info_dialog(self, _('No suitable formats'),
|
||||||
_('Auto converting the following books before uploading to the device:<br><ul>%s</ul>')%(autos,))
|
_('Auto converting the following books before uploading to the device:<br><ul>%s</ul>')%(autos,))
|
||||||
for fmt in self.device_manager.device_class.FORMATS:
|
for fmt in self.device_manager.device_class.settings().format_map:
|
||||||
if fmt in list(set(self.device_manager.device_class.FORMATS).intersection(set(available_output_formats()))):
|
if fmt in list(set(self.device_manager.device_class.settings().format_map).intersection(set(available_output_formats()))):
|
||||||
format = fmt
|
format = fmt
|
||||||
break
|
break
|
||||||
d.exec_()
|
d.exec_()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user