mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
[Device] Give prompts when Bambook SDK is not avalible.
This commit is contained in:
parent
90e45787ed
commit
3cfe6d95a2
@ -12,11 +12,12 @@ import time, os, hashlib
|
||||
from itertools import cycle
|
||||
from calibre.devices.interface import DevicePlugin
|
||||
from calibre.devices.usbms.deviceconfig import DeviceConfig
|
||||
from calibre.devices.bambook.libbambookcore import Bambook, text_encoding, CONN_CONNECTED
|
||||
from calibre.devices.bambook.libbambookcore import Bambook, text_encoding, CONN_CONNECTED, is_bambook_lib_ready
|
||||
from calibre.devices.usbms.books import Book, BookList
|
||||
from calibre.ebooks.metadata.book.json_codec import JsonCodec
|
||||
from calibre.ptempfile import TemporaryDirectory, TemporaryFile
|
||||
from calibre.constants import __appname__, __version__
|
||||
from calibre.devices.errors import OpenFeedback
|
||||
|
||||
class BAMBOOK(DeviceConfig, DevicePlugin):
|
||||
name = 'Bambook Device Interface'
|
||||
@ -52,6 +53,9 @@ class BAMBOOK(DeviceConfig, DevicePlugin):
|
||||
self.open()
|
||||
|
||||
def open(self):
|
||||
# Make sure the Bambook library is ready
|
||||
if not is_bambook_lib_ready():
|
||||
raise OpenFeedback(_("Unable to connect to Bambook, you need to install Bambook library first."))
|
||||
# Disconnect first if connected
|
||||
self.eject()
|
||||
# Connect
|
||||
|
@ -38,6 +38,9 @@ elif islinux:
|
||||
elif isosx:
|
||||
text_encoding = 'utf-8'
|
||||
|
||||
def is_bambook_lib_ready():
|
||||
return lib_handle != None
|
||||
|
||||
# Constant
|
||||
DEFAULT_BAMBOOK_IP = '192.168.250.2'
|
||||
BAMBOOK_SDK_VERSION = 0x00090000
|
||||
|
Loading…
x
Reference in New Issue
Block a user