mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Change line endings
This commit is contained in:
parent
84e5059b11
commit
0d4506f9c1
@ -1,85 +1,85 @@
|
|||||||
'''
|
'''
|
||||||
Created on 15 May 2010
|
Created on 15 May 2010
|
||||||
|
|
||||||
@author: charles
|
@author: charles
|
||||||
'''
|
'''
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from calibre.devices.usbms.driver import USBMS, BookList
|
from calibre.devices.usbms.driver import USBMS, BookList
|
||||||
|
|
||||||
# This class is added to the standard device plugin chain, so that it can
|
# This class is added to the standard device plugin chain, so that it can
|
||||||
# be configured. It has invalid vendor_id etc, so it will never match a
|
# be configured. It has invalid vendor_id etc, so it will never match a
|
||||||
# device. The 'real' FOLDER_DEVICE will use the config from it.
|
# device. The 'real' FOLDER_DEVICE will use the config from it.
|
||||||
class FOLDER_DEVICE_FOR_CONFIG(USBMS):
|
class FOLDER_DEVICE_FOR_CONFIG(USBMS):
|
||||||
name = 'Folder Device Interface'
|
name = 'Folder Device Interface'
|
||||||
gui_name = 'Folder Device'
|
gui_name = 'Folder Device'
|
||||||
description = _('Use an arbitrary folder as a device.')
|
description = _('Use an arbitrary folder as a device.')
|
||||||
author = 'John Schember/Charles Haley'
|
author = 'John Schember/Charles Haley'
|
||||||
supported_platforms = ['windows', 'osx', 'linux']
|
supported_platforms = ['windows', 'osx', 'linux']
|
||||||
FORMATS = ['epub', 'fb2', 'mobi', 'lrf', 'tcr', 'pmlz', 'lit', 'rtf', 'rb', 'pdf', 'oeb', 'txt', 'pdb']
|
FORMATS = ['epub', 'fb2', 'mobi', 'lrf', 'tcr', 'pmlz', 'lit', 'rtf', 'rb', 'pdf', 'oeb', 'txt', 'pdb']
|
||||||
VENDOR_ID = 0xffff
|
VENDOR_ID = 0xffff
|
||||||
PRODUCT_ID = 0xffff
|
PRODUCT_ID = 0xffff
|
||||||
BCD = 0xffff
|
BCD = 0xffff
|
||||||
|
|
||||||
|
|
||||||
class FOLDER_DEVICE(USBMS):
|
class FOLDER_DEVICE(USBMS):
|
||||||
type = _('Device Interface')
|
type = _('Device Interface')
|
||||||
|
|
||||||
name = 'Folder Device Interface'
|
name = 'Folder Device Interface'
|
||||||
gui_name = 'Folder Device'
|
gui_name = 'Folder Device'
|
||||||
description = _('Use an arbitrary folder as a device.')
|
description = _('Use an arbitrary folder as a device.')
|
||||||
author = 'John Schember/Charles Haley'
|
author = 'John Schember/Charles Haley'
|
||||||
supported_platforms = ['windows', 'osx', 'linux']
|
supported_platforms = ['windows', 'osx', 'linux']
|
||||||
FORMATS = ['epub', 'fb2', 'mobi', 'lrf', 'tcr', 'pmlz', 'lit', 'rtf', 'rb', 'pdf', 'oeb', 'txt', 'pdb']
|
FORMATS = ['epub', 'fb2', 'mobi', 'lrf', 'tcr', 'pmlz', 'lit', 'rtf', 'rb', 'pdf', 'oeb', 'txt', 'pdb']
|
||||||
|
|
||||||
VENDOR_ID = 0xffff
|
VENDOR_ID = 0xffff
|
||||||
PRODUCT_ID = 0xffff
|
PRODUCT_ID = 0xffff
|
||||||
BCD = 0xffff
|
BCD = 0xffff
|
||||||
|
|
||||||
THUMBNAIL_HEIGHT = 68 # Height for thumbnails on device
|
THUMBNAIL_HEIGHT = 68 # Height for thumbnails on device
|
||||||
|
|
||||||
CAN_SET_METADATA = True
|
CAN_SET_METADATA = True
|
||||||
SUPPORTS_SUB_DIRS = True
|
SUPPORTS_SUB_DIRS = True
|
||||||
|
|
||||||
#: Icon for this device
|
#: Icon for this device
|
||||||
icon = I('sd.svg')
|
icon = I('sd.svg')
|
||||||
METADATA_CACHE = '.metadata.calibre'
|
METADATA_CACHE = '.metadata.calibre'
|
||||||
|
|
||||||
_main_prefix = ''
|
_main_prefix = ''
|
||||||
_card_a_prefix = None
|
_card_a_prefix = None
|
||||||
_card_b_prefix = None
|
_card_b_prefix = None
|
||||||
|
|
||||||
is_connected = False
|
is_connected = False
|
||||||
|
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
raise IOError, 'Path is not a folder'
|
raise IOError, 'Path is not a folder'
|
||||||
self._main_prefix = path
|
self._main_prefix = path
|
||||||
self.booklist_class = BookList
|
self.booklist_class = BookList
|
||||||
self.is_connected = True
|
self.is_connected = True
|
||||||
|
|
||||||
def disconnect_from_folder(self):
|
def disconnect_from_folder(self):
|
||||||
self._main_prefix = ''
|
self._main_prefix = ''
|
||||||
self.is_connected = False
|
self.is_connected = False
|
||||||
|
|
||||||
def is_usb_connected(self, devices_on_system, debug=False,
|
def is_usb_connected(self, devices_on_system, debug=False,
|
||||||
only_presence=False):
|
only_presence=False):
|
||||||
return self.is_connected, self
|
return self.is_connected, self
|
||||||
|
|
||||||
def open(self):
|
def open(self):
|
||||||
if not self._main_prefix:
|
if not self._main_prefix:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_progress_reporter(self, report_progress):
|
def set_progress_reporter(self, report_progress):
|
||||||
self.report_progress = report_progress
|
self.report_progress = report_progress
|
||||||
|
|
||||||
def card_prefix(self, end_session=True):
|
def card_prefix(self, end_session=True):
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
|
||||||
def eject(self):
|
def eject(self):
|
||||||
self.is_connected = False
|
self.is_connected = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def settings(self):
|
def settings(self):
|
||||||
return FOLDER_DEVICE_FOR_CONFIG._config().parse()
|
return FOLDER_DEVICE_FOR_CONFIG._config().parse()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user