fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add support for predesigned covers to Marquise. Remove support for changing cover...
[librarian.git]
/
src
/
librarian
/
cover.py
diff --git
a/src/librarian/cover.py
b/src/librarian/cover.py
index
b60ec34
..
9cd813a
100644
(file)
--- a/
src/librarian/cover.py
+++ b/
src/librarian/cover.py
@@
-72,7
+72,7
@@
class TextBox(object):
break
line = parts[0]
break
line = parts[0]
- if line[-2] == ' ':
+ if l
en(line) > 2 and l
ine[-2] == ' ':
line = line[:-2]
line_width = self.draw.textsize(line, font=font)[0]
line = line[:-2]
line_width = self.draw.textsize(line, font=font)[0]
@@
-153,6
+153,15
@@
class Cover(object):
def __init__(self, book_info, format=None, width=None, height=None, cover_logo=None):
self.book_info = book_info
def __init__(self, book_info, format=None, width=None, height=None, cover_logo=None):
self.book_info = book_info
+
+ self.predesigned = False
+ if book_info.cover_class == 'image':
+ self.predesigned = True
+
+ # TODO: deprecated
+ if book_info.cover_box_position == 'none':
+ self.predesigned = True
+
self.authors = [auth.readable() for auth in book_info.authors]
self.title = book_info.title
if format is not None:
self.authors = [auth.readable() for auth in book_info.authors]
self.title = book_info.title
if format is not None:
@@
-989,7
+998,7
@@
class FactoryCover(LogoWLCover):
from librarian.covers.marquise import MarquiseCover, LabelMarquiseCover
COVER_CLASSES = {
from librarian.covers.marquise import MarquiseCover, LabelMarquiseCover
COVER_CLASSES = {
- '
default
': LogoWLCover,
+ '
legacy
': LogoWLCover,
'kmlu': KMLUCover,
'mpw': MPWCover,
'atrium': AtriumCover,
'kmlu': KMLUCover,
'mpw': MPWCover,
'atrium': AtriumCover,
@@
-1000,13
+1009,15
@@
COVER_CLASSES = {
'factory': FactoryCover,
'm': MarquiseCover,
'm-label': LabelMarquiseCover,
'factory': FactoryCover,
'm': MarquiseCover,
'm-label': LabelMarquiseCover,
+ 'default': MarquiseCover,
}
def make_cover(book_info, *args, **kwargs):
}
def make_cover(book_info, *args, **kwargs):
+ cover_class_name = None
if 'cover_class' in kwargs:
cover_class_name = kwargs.pop('cover_class')
if 'cover_class' in kwargs:
cover_class_name = kwargs.pop('cover_class')
-
els
e:
- cover_class_name =
book_info.cover_class
+
if not cover_class_nam
e:
+ cover_class_name =
'default'
cover_class = COVER_CLASSES[cover_class_name]
return cover_class(book_info, *args, **kwargs)
cover_class = COVER_CLASSES[cover_class_name]
return cover_class(book_info, *args, **kwargs)