break
line = parts[0]
- if line[-2] == ' ':
+ if len(line) > 2 and line[-2] == ' ':
line = line[:-2]
line_width = self.draw.textsize(line, font=font)[0]
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:
from librarian.covers.marquise import MarquiseCover, LabelMarquiseCover
COVER_CLASSES = {
- 'default': LogoWLCover,
+ 'legacy': LogoWLCover,
'kmlu': KMLUCover,
'mpw': MPWCover,
'atrium': AtriumCover,
'factory': FactoryCover,
'm': MarquiseCover,
'm-label': LabelMarquiseCover,
+ 'default': MarquiseCover,
}
def make_cover(book_info, *args, **kwargs):
+ cover_class_name = None
if 'cover_class' in kwargs:
cover_class_name = kwargs.pop('cover_class')
- else:
- cover_class_name = book_info.cover_class
+ if not cover_class_name:
+ cover_class_name = 'default'
cover_class = COVER_CLASSES[cover_class_name]
return cover_class(book_info, *args, **kwargs)