mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
on_card fixes
This commit is contained in:
parent
b9480a0170
commit
5ad981d2a7
@ -85,7 +85,7 @@ class USBMS(CLI, Device):
|
|||||||
elif on_card == 'cardb' and not self._card_b_prefix:
|
elif on_card == 'cardb' and not self._card_b_prefix:
|
||||||
raise ValueError(_('The reader has no storage card in this slot.'))
|
raise ValueError(_('The reader has no storage card in this slot.'))
|
||||||
elif on_card and on_card not in ('carda', 'cardb'):
|
elif on_card and on_card not in ('carda', 'cardb'):
|
||||||
raise DeviceError(_('The reader has no storage card in this slot.'))
|
raise DeviceError(_('Selected slot: %s is not supported.' % on_card))
|
||||||
|
|
||||||
if on_card == 'carda':
|
if on_card == 'carda':
|
||||||
path = os.path.join(self._card_a_prefix, self.EBOOK_DIR_CARD_A)
|
path = os.path.join(self._card_a_prefix, self.EBOOK_DIR_CARD_A)
|
||||||
|
@ -785,7 +785,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
|
|
||||||
def _add_books(self, paths, to_device, on_card=None):
|
def _add_books(self, paths, to_device, on_card=None):
|
||||||
if on_card is None:
|
if on_card is None:
|
||||||
on_card = self.stack.currentIndex() >= 2
|
on_card = 'carda' if self.stack.currentIndex() == 2 else 'cardb' if self.stack.currentIndex() == 3 else None
|
||||||
if not paths:
|
if not paths:
|
||||||
return
|
return
|
||||||
from calibre.gui2.add import Adder
|
from calibre.gui2.add import Adder
|
||||||
@ -795,7 +795,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
Dispatcher(self.__adder_func))
|
Dispatcher(self.__adder_func))
|
||||||
self._adder.add(paths)
|
self._adder.add(paths)
|
||||||
|
|
||||||
def _files_added(self, paths=[], names=[], infos=[], on_card=False):
|
def _files_added(self, paths=[], names=[], infos=[], on_card=None):
|
||||||
if paths:
|
if paths:
|
||||||
self.upload_books(paths,
|
self.upload_books(paths,
|
||||||
list(map(sanitize_file_name, names)),
|
list(map(sanitize_file_name, names)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user