PEP 8 compliance.
This commit is contained in:
parent
2076e7341d
commit
ebdac7c89d
1 changed files with 27 additions and 21 deletions
48
dcc/thumb.py
48
dcc/thumb.py
|
@ -3,28 +3,34 @@ import dcc.doom_base
|
||||||
import wand.color
|
import wand.color
|
||||||
import wand.image
|
import wand.image
|
||||||
|
|
||||||
|
|
||||||
class Thumb(dcc.doom_base.WadMap):
|
class Thumb(dcc.doom_base.WadMap):
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super().get_parser(prog_name)
|
parser = super().get_parser(prog_name)
|
||||||
parser.add_argument("--index", action="store_true")
|
parser.add_argument("--index", action="store_true")
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
|
||||||
base = self.base_thumb_path()
|
|
||||||
text = self.text_thumb_path()
|
|
||||||
mdoom = self.m_doom_path()
|
|
||||||
with wand.image.Image(filename=base) as bi, wand.color.Color("transparent") as tc:
|
|
||||||
with wand.image.Image(filename=text) as ti:
|
|
||||||
ti.border(tc, 5, 5)
|
|
||||||
bi.composite(ti, gravity="south_west")
|
|
||||||
|
|
||||||
with wand.image.Image(filename=mdoom) as mdi:
|
def take_action(self, parsed_args):
|
||||||
mdi.border(tc, 5, 5)
|
base = self.base_thumb_path()
|
||||||
bi.composite(mdi, gravity="north_west")
|
text = self.text_thumb_path()
|
||||||
|
mdoom = self.m_doom_path()
|
||||||
|
with (
|
||||||
|
wand.image.Image(filename=base) as bi,
|
||||||
|
wand.color.Color("transparent") as tc
|
||||||
|
):
|
||||||
|
with wand.image.Image(filename=text) as ti:
|
||||||
|
ti.border(tc, 5, 5)
|
||||||
|
bi.composite(ti, gravity="south_west")
|
||||||
|
|
||||||
if parsed_args.index:
|
with wand.image.Image(filename=mdoom) as mdi:
|
||||||
with wand.image.Image(filename=self.output.joinpath("doomed_index.png")) as di:
|
mdi.border(tc, 5, 5)
|
||||||
di.border(tc, 1, 1)
|
bi.composite(mdi, gravity="north_west")
|
||||||
bi.composite(di, gravity="north_east")
|
|
||||||
|
|
||||||
bi.save(filename=self.thumb_path())
|
if parsed_args.index:
|
||||||
|
with wand.image.Image(
|
||||||
|
filename=self.output.joinpath("doomed_index.png")
|
||||||
|
) as di:
|
||||||
|
di.border(tc, 1, 1)
|
||||||
|
bi.composite(di, gravity="north_east")
|
||||||
|
|
||||||
|
bi.save(filename=self.thumb_path())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue