mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:Clean up USBMS driver code
This commit is contained in:
parent
8baa05b43b
commit
3edec280e8
@ -9,10 +9,15 @@ device. This class handles devive detection.
|
||||
import os, time
|
||||
|
||||
from calibre.devices.interface import Device as _Device
|
||||
from calibre.devices.errors import DeviceError, FreeSpaceError
|
||||
from calibre.devices.errors import DeviceError
|
||||
from calibre import iswindows, islinux, isosx, __appname__
|
||||
|
||||
class Device(_Device):
|
||||
'''
|
||||
This class provides logic common to all drivers for devices that export themselves
|
||||
as USB Mass Storage devices. If you are writing such a driver, inherit from this
|
||||
class.
|
||||
'''
|
||||
|
||||
FDI_TEMPLATE = \
|
||||
'''
|
||||
|
@ -1,5 +1,5 @@
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, John Schember <john at nachtimwald.com'
|
||||
__copyright__ = '2009, John Schember <john at nachtimwald.com>'
|
||||
'''
|
||||
Generic USB Mass storage device driver. This is not a complete stand alone
|
||||
driver. It is intended to be subclassed with the relevant parts implemented
|
||||
@ -11,6 +11,7 @@ from itertools import cycle
|
||||
|
||||
from calibre.devices.usbms.device import Device
|
||||
from calibre.devices.usbms.books import BookList, Book
|
||||
from calibre.devices.errors import FreeSpaceError
|
||||
|
||||
class USBMS(Device):
|
||||
EBOOK_DIR = ''
|
||||
@ -57,11 +58,9 @@ class USBMS(Device):
|
||||
size = sum(sizes)
|
||||
|
||||
if on_card and size > self.free_space()[2] - 1024*1024:
|
||||
raise FreeSpaceError("There is insufficient free space "+\
|
||||
"on the storage card")
|
||||
raise FreeSpaceError(_("There is insufficient free space on the storage card"))
|
||||
if not on_card and size > self.free_space()[0] - 2*1024*1024:
|
||||
raise FreeSpaceError("There is insufficient free space " +\
|
||||
"in main memory")
|
||||
raise FreeSpaceError(_("There is insufficient free space in main memory"))
|
||||
|
||||
paths = []
|
||||
names = iter(names)
|
||||
|
Loading…
x
Reference in New Issue
Block a user