mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge drivers for Cybook Gen3 and Opus and dont accept rich text in the comments fields of the edit meta information dialog
This commit is contained in:
commit
bbafe74245
@ -402,7 +402,7 @@ from calibre.customize.profiles import input_profiles, output_profiles
|
||||
|
||||
from calibre.devices.hanlin.driver import HANLINV3, HANLINV5, BOOX
|
||||
from calibre.devices.blackberry.driver import BLACKBERRY
|
||||
from calibre.devices.cybookg3.driver import CYBOOKG3, CYBOOK_OPUS
|
||||
from calibre.devices.cybook.driver import CYBOOK
|
||||
from calibre.devices.eb600.driver import EB600, COOL_ER, SHINEBOOK, \
|
||||
POCKETBOOK360, GER2, ITALICA, ECLICTO, DBOOK
|
||||
from calibre.devices.iliad.driver import ILIAD
|
||||
@ -460,7 +460,7 @@ plugins += [
|
||||
HANLINV3,
|
||||
HANLINV5,
|
||||
BLACKBERRY,
|
||||
CYBOOKG3,
|
||||
CYBOOK,
|
||||
ILIAD,
|
||||
IREXDR1000,
|
||||
JETBOOK,
|
||||
@ -476,7 +476,6 @@ plugins += [
|
||||
ANDROID,
|
||||
N770,
|
||||
N810,
|
||||
CYBOOK_OPUS,
|
||||
COOL_ER,
|
||||
ESLICK,
|
||||
NUUT2,
|
||||
|
57
src/calibre/devices/cybook/driver.py
Normal file
57
src/calibre/devices/cybook/driver.py
Normal file
@ -0,0 +1,57 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, John Schember <john at nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
Device driver for Bookeen's Cybook Gen 3 and Opus
|
||||
'''
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
from calibre.constants import isunix
|
||||
from calibre.devices.usbms.driver import USBMS
|
||||
import calibre.devices.cybook.t2b as t2b
|
||||
|
||||
class CYBOOK(USBMS):
|
||||
|
||||
name = 'Cybook Gen 3 / Opus Device Interface'
|
||||
gui_name = 'Cybook Gen 3 / Opus'
|
||||
description = _('Communicate with the Cybook Gen 3 / Opus eBook reader.')
|
||||
author = 'John Schember'
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
||||
# Ordered list of supported formats
|
||||
# Be sure these have an entry in calibre.devices.mime
|
||||
FORMATS = ['epub', 'mobi', 'prc', 'html', 'pdf', 'rtf', 'txt']
|
||||
|
||||
VENDOR_ID = [0x0bda, 0x3034]
|
||||
PRODUCT_ID = [0x0703, 0x1795]
|
||||
BCD = [0x110, 0x132]
|
||||
|
||||
VENDOR_NAME = 'BOOKEEN'
|
||||
WINDOWS_MAIN_MEM = re.compile(r'CYBOOK_(OPUS|GEN3)__-FD')
|
||||
WINDOWS_CARD_A_MEM = re.compile('CYBOOK_(OPUS|GEN3)__-SD')
|
||||
|
||||
EBOOK_DIR_MAIN = 'eBooks'
|
||||
EBOOK_DIR_CARD_A = 'eBooks'
|
||||
THUMBNAIL_HEIGHT = 144
|
||||
DELETE_EXTS = ['.mbp', '.dat', '.bin', '_6090.t2b']
|
||||
SUPPORTS_SUB_DIRS = True
|
||||
|
||||
def upload_cover(self, path, filename, metadata):
|
||||
coverdata = getattr(metadata, 'thumbnail', None)
|
||||
if coverdata and coverdata[2]:
|
||||
coverdata = coverdata[2]
|
||||
else:
|
||||
coverdata = None
|
||||
with open('%s_6090.t2b' % os.path.join(path, filename), 'wb') as t2bfile:
|
||||
t2b.write_t2b(t2bfile, coverdata)
|
||||
|
||||
@classmethod
|
||||
def can_handle(cls, device_info, debug=False):
|
||||
if isunix:
|
||||
return device_info[3] == 'Bookeen' and (device_info[4] == 'Cybook Gen3' or device_info[4] == 'Cybook Opus')
|
||||
return True
|
@ -1,92 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, John Schember <john at nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
Device driver for Bookeen's Cybook Gen 3
|
||||
'''
|
||||
|
||||
import os
|
||||
|
||||
from calibre.constants import isunix
|
||||
from calibre.devices.usbms.driver import USBMS
|
||||
import calibre.devices.cybookg3.t2b as t2b
|
||||
|
||||
class CYBOOKG3(USBMS):
|
||||
|
||||
name = 'Cybook Gen 3 Device Interface'
|
||||
gui_name = 'Cybook Gen 3'
|
||||
description = _('Communicate with the Cybook Gen 3 eBook reader.')
|
||||
author = 'John Schember'
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
||||
# Ordered list of supported formats
|
||||
# Be sure these have an entry in calibre.devices.mime
|
||||
FORMATS = ['epub', 'mobi', 'prc', 'html', 'pdf', 'rtf', 'txt']
|
||||
|
||||
VENDOR_ID = [0x0bda, 0x3034]
|
||||
PRODUCT_ID = [0x0703, 0x1795]
|
||||
BCD = [0x110, 0x132]
|
||||
|
||||
VENDOR_NAME = 'BOOKEEN'
|
||||
WINDOWS_MAIN_MEM = 'CYBOOK_GEN3__-FD'
|
||||
WINDOWS_CARD_A_MEM = 'CYBOOK_GEN3__-SD'
|
||||
|
||||
OSX_MAIN_MEM = 'Bookeen Cybook Gen3 -FD Media'
|
||||
OSX_CARD_A_MEM = 'Bookeen Cybook Gen3 -SD Media'
|
||||
|
||||
MAIN_MEMORY_VOLUME_LABEL = 'Cybook Gen 3 Main Memory'
|
||||
STORAGE_CARD_VOLUME_LABEL = 'Cybook Gen 3 Storage Card'
|
||||
|
||||
EBOOK_DIR_MAIN = 'eBooks'
|
||||
EBOOK_DIR_CARD_A = 'eBooks'
|
||||
THUMBNAIL_HEIGHT = 144
|
||||
DELETE_EXTS = ['.mbp', '.dat', '_6090.t2b']
|
||||
SUPPORTS_SUB_DIRS = True
|
||||
|
||||
def upload_cover(self, path, filename, metadata):
|
||||
coverdata = getattr(metadata, 'thumbnail', None)
|
||||
if coverdata and coverdata[2]:
|
||||
coverdata = coverdata[2]
|
||||
else:
|
||||
coverdata = None
|
||||
with open('%s_6090.t2b' % os.path.join(path, filename), 'wb') as t2bfile:
|
||||
t2b.write_t2b(t2bfile, coverdata)
|
||||
|
||||
@classmethod
|
||||
def can_handle(cls, device_info, debug=False):
|
||||
if isunix:
|
||||
return device_info[3] == 'Bookeen' and device_info[4] == 'Cybook Gen3'
|
||||
return True
|
||||
|
||||
|
||||
class CYBOOK_OPUS(CYBOOKG3):
|
||||
|
||||
name = 'Cybook Opus Device Interface'
|
||||
gui_name = 'Cybook Opus'
|
||||
description = _('Communicate with the Cybook Opus eBook reader.')
|
||||
author = 'John Schember'
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
||||
VENDOR_ID = [0x0bda]
|
||||
PRODUCT_ID = [0x0703]
|
||||
BCD = [0x110]
|
||||
|
||||
VENDOR_NAME = 'BOOKEEN'
|
||||
WINDOWS_MAIN_MEM = 'CYBOOK_OPUS__-FD'
|
||||
WINDOWS_CARD_A_MEM = 'CYBOOK_OPUS__-SD'
|
||||
|
||||
OSX_MAIN_MEM = 'Bookeen Cybook Opus -FD Media'
|
||||
OSX_CARD_A_MEM = 'Bookeen Cybook Opus -SD Media'
|
||||
|
||||
EBOOK_DIR_MAIN = 'eBooks'
|
||||
EBOOK_DIR_CARD_A = 'eBooks'
|
||||
SUPPORTS_SUB_DIRS = True
|
||||
|
||||
@classmethod
|
||||
def can_handle(cls, device_info, debug=False):
|
||||
if isunix:
|
||||
return device_info[3] == 'Bookeen' and device_info[4] == 'Cybook Opus'
|
||||
return True
|
@ -197,6 +197,12 @@ class Page(object):
|
||||
def find_elements_in_row_of(self, x):
|
||||
interval = Interval(x.top - self.YFUZZ * self.average_text_height,
|
||||
x.top + self.YFUZZ*(1+self.average_text_height))
|
||||
m = max(0, x.idx-15)
|
||||
for y in self.elements[m:x.idx+15]:
|
||||
y_interval = Interval(y.top, y.bottom)
|
||||
if interval.intersection(y_interval).width > \
|
||||
0.5*self.average_text_height:
|
||||
yield y
|
||||
|
||||
|
||||
class PDFDocument(object):
|
||||
|
@ -43,8 +43,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>879</width>
|
||||
<height>710</height>
|
||||
<width>869</width>
|
||||
<height>698</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
@ -408,7 +408,11 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="comments"/>
|
||||
<widget class="QTextEdit" name="comments">
|
||||
<property name="acceptRichText">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user