on_card fixes

This commit is contained in:
John Schember 2009-05-31 16:23:51 -04:00
parent b9480a0170
commit 5ad981d2a7
2 changed files with 3 additions and 3 deletions

View File

@ -85,7 +85,7 @@ class USBMS(CLI, Device):
elif on_card == 'cardb' and not self._card_b_prefix:
raise ValueError(_('The reader has no storage card in this slot.'))
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':
path = os.path.join(self._card_a_prefix, self.EBOOK_DIR_CARD_A)

View File

@ -785,7 +785,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
def _add_books(self, paths, to_device, on_card=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:
return
from calibre.gui2.add import Adder
@ -795,7 +795,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
Dispatcher(self.__adder_func))
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:
self.upload_books(paths,
list(map(sanitize_file_name, names)),