Fix #4152 (Error launching calibre when Droid is mounted)

This commit is contained in:
Kovid Goyal 2009-12-10 10:18:43 -07:00
parent 6914dd8b20
commit 5ce0d7aba8
3 changed files with 12 additions and 5 deletions

View File

@ -36,12 +36,12 @@ class ANDROID(USBMS):
SUPPORTS_SUB_DIRS = True
def get_main_ebook_dir(self):
def post_open_callback(self):
opts = self.settings()
dirs = opts.extra_customization
if not dirs:
dirs = self.EBOOK_DIR_MAIN
else:
dirs = [x.strip() for x in dirs.split(',')]
return dirs
self.EBOOK_DIR_MAIN = dirs

View File

@ -578,7 +578,7 @@ class Device(DeviceConfig, DevicePlugin):
try:
self.open_windows()
except DeviceError:
time.sleep(5)
time.sleep(7)
self.open_windows()
if isosx:
try:
@ -587,6 +587,11 @@ class Device(DeviceConfig, DevicePlugin):
time.sleep(7)
self.open_osx()
self.post_open_callback()
def post_open_callback(self):
pass
def eject_windows(self):
from calibre.constants import plugins
from threading import Thread

View File

@ -21,7 +21,7 @@ from calibre.devices.usbms.device import Device
from calibre.devices.usbms.books import BookList, Book
from calibre.devices.mime import mime_type_ext
# CLI must come before Device as it implments the CLI functions that
# CLI must come before Device as it implements the CLI functions that
# are inherited from the device interface in Device.
class USBMS(CLI, Device):
@ -56,7 +56,9 @@ class USBMS(CLI, Device):
return bl
prefix = self._card_a_prefix if oncard == 'carda' else self._card_b_prefix if oncard == 'cardb' else self._main_prefix
ebook_dir = self.EBOOK_DIR_CARD_A if oncard == 'carda' else self.EBOOK_DIR_CARD_B if oncard == 'cardb' else self.EBOOK_DIR_MAIN
ebook_dir = self.EBOOK_DIR_CARD_A if oncard == 'carda' else \
self.EBOOK_DIR_CARD_B if oncard == 'cardb' else \
self.get_main_ebook_dir()
# Get all books in the ebook_dir directory
if self.SUPPORTS_SUB_DIRS: