fnp
/
librarian.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
15e446262d6d14399fc1d85252b0aa4823e5d4f7
[librarian.git]
/
src
/
librarian
/
covers
/
widgets
/
base.py
1
class Widget:
2
transparency = True
3
margin_top = 0
4
5
def __init__(self, cover):
6
self.cover = cover
7
self.setup()
8
9
def setup(self):
10
pass
11
12
def build(self, w, h):
13
raise NotImplementedError()
14
15
def apply(self, img, x, y, w=None, h=None):
16
my_img = self.build(w, h)
17
img.paste(
18
my_img,
19
(round(x), round(y - self.margin_top)),
20
my_img if self.transparency else None
21
)