Exemple #1
0
    def __init__(self,
                 book_info,
                 format=None,
                 width=None,
                 height=None,
                 bleed=0):
        super(WLCover, self).__init__(book_info,
                                      format=format,
                                      width=width,
                                      height=height)
        # Set box position.
        self.box_position = book_info.cover_box_position or \
            self.kind_box_position.get(book_info.kind, self.box_position)
        # Set bar color.
        if book_info.cover_bar_color == 'none':
            self.bar_width = 0
        else:
            self.bar_color = book_info.cover_bar_color or \
                self.epoch_colors.get(book_info.epoch, self.bar_color)
        # Set title color.
        self.title_color = self.epoch_colors.get(book_info.epoch,
                                                 self.title_color)

        self.bleed = bleed
        self.box_top_margin += bleed
        self.box_bottom_margin += bleed
        self.bar_width += bleed

        if book_info.cover_url:
            url = book_info.cover_url
            bg_src = None
            if bg_src is None:
                bg_src = URLOpener().open(url)
            self.background_img = StringIO(bg_src.read())
            bg_src.close()
Exemple #2
0
    def __init__(self, book_info, format=None, width=None, height=None, bleed=0):
        super(WLCover, self).__init__(book_info, format=format, width=width, height=height)
        # Set box position.
        self.box_position = book_info.cover_box_position or \
            self.kind_box_position.get(book_info.kind, self.box_position)
        # Set bar color.
        if book_info.cover_bar_color == 'none':
            self.bar_width = 0
        else:
            self.bar_color = book_info.cover_bar_color or \
                self.epoch_colors.get(book_info.epoch, self.bar_color)
        # Set title color.
        self.title_color = self.epoch_colors.get(book_info.epoch, self.title_color)

        self.bleed = bleed
        self.box_top_margin += bleed
        self.box_bottom_margin += bleed
        self.bar_width += bleed

        if book_info.cover_url:
            url = book_info.cover_url
            bg_src = None
            if bg_src is None:
                bg_src = URLOpener().open(url)
            self.background_img = BytesIO(bg_src.read())
            bg_src.close()
Exemple #3
0
 def __init__(self, book_info, format=None, width=None, height=None, with_logo=False):
     super(WLCover, self).__init__(book_info, format=format, width=width, height=height)
     self.kind = book_info.kind
     self.epoch = book_info.epoch
     self.with_logo = with_logo
     if book_info.cover_url:
         url = book_info.cover_url
         bg_src = None
         if bg_src is None:
             bg_src = URLOpener().open(url)
         self.background_img = StringIO(bg_src.read())
         bg_src.close()
     else:
         self.background_img = self.default_background
Exemple #4
0
    def __init__(self, book_info, format=None, width=None, height=None):
        super(WLCover, self).__init__(book_info, format=format, width=width, height=height)
        # Set box position.
        self.box_position = book_info.cover_box_position or self.kind_box_position.get(
            book_info.kind, self.box_position
        )
        # Set bar color.
        if book_info.cover_bar_color == "none":
            self.bar_width = 0
        else:
            self.bar_color = book_info.cover_bar_color or self.epoch_colors.get(book_info.epoch, self.bar_color)
        # Set title color.
        self.title_color = self.epoch_colors.get(book_info.epoch, self.title_color)

        if book_info.cover_url:
            url = book_info.cover_url
            bg_src = None
            if bg_src is None:
                bg_src = URLOpener().open(url)
            self.background_img = StringIO(bg_src.read())
            bg_src.close()