Compare commits
No commits in common. "trunk" and "iss6" have entirely different histories.
3 changed files with 6 additions and 60 deletions
|
|
@ -71,7 +71,7 @@ class Text(dcc.doom_base.WadMap):
|
||||||
if map_names is not None:
|
if map_names is not None:
|
||||||
text = map_names.get(f"map{parsed_args.map}")
|
text = map_names.get(f"map{parsed_args.map}")
|
||||||
if text is None:
|
if text is None:
|
||||||
text = input("Map Name? ")
|
text = sys.stdin.read().rstrip()
|
||||||
if not parsed_args.nomap:
|
if not parsed_args.nomap:
|
||||||
text = "MAP{}: {}".format(parsed_args.map, text)
|
text = "MAP{}: {}".format(parsed_args.map, text)
|
||||||
text = "{}\n{}".format(text, parsed_args.demotype)
|
text = "{}\n{}".format(text, parsed_args.demotype)
|
||||||
|
|
@ -80,7 +80,7 @@ class Text(dcc.doom_base.WadMap):
|
||||||
width=self.thumbnail_width
|
width=self.thumbnail_width
|
||||||
) as img:
|
) as img:
|
||||||
self.draw_text(
|
self.draw_text(
|
||||||
img, text, wrap_dist=0.95
|
img, text,
|
||||||
)
|
)
|
||||||
img.trim()
|
img.trim()
|
||||||
img.reset_coords()
|
img.reset_coords()
|
||||||
|
|
|
||||||
10
dcc/thumb.py
10
dcc/thumb.py
|
|
@ -8,13 +8,12 @@ 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")
|
||||||
parser.add_argument("--noov", action="store_true")
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
base = self.base_thumb_path()
|
base = self.base_thumb_path()
|
||||||
text = self.text_thumb_path()
|
text = self.text_thumb_path()
|
||||||
overlay = self.thumb_overlay_path()
|
overlay = self.thumnail_overlay_path()
|
||||||
with (
|
with (
|
||||||
wand.image.Image(filename=base) as bi,
|
wand.image.Image(filename=base) as bi,
|
||||||
wand.color.Color("transparent") as tc
|
wand.color.Color("transparent") as tc
|
||||||
|
|
@ -23,10 +22,9 @@ class Thumb(dcc.doom_base.WadMap):
|
||||||
ti.border(tc, 5, 5)
|
ti.border(tc, 5, 5)
|
||||||
bi.composite(ti, gravity="south_west")
|
bi.composite(ti, gravity="south_west")
|
||||||
|
|
||||||
if not parsed_args.noov:
|
with wand.image.Image(filename=overlay) as mdi:
|
||||||
with wand.image.Image(filename=overlay) as mdi:
|
mdi.border(tc, 5, 5)
|
||||||
mdi.border(tc, 5, 5)
|
bi.composite(mdi, gravity="north_west")
|
||||||
bi.composite(mdi, gravity="north_west")
|
|
||||||
|
|
||||||
if parsed_args.index:
|
if parsed_args.index:
|
||||||
with wand.image.Image(
|
with wand.image.Image(
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
import cliff.app
|
|
||||||
import dcc.play
|
|
||||||
import logging
|
|
||||||
import mockito.matchers
|
|
||||||
import pathlib
|
|
||||||
import subprocess
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
def test_play(when):
|
|
||||||
with tempfile.TemporaryDirectory() as td:
|
|
||||||
tdp = pathlib.Path(td)
|
|
||||||
tdp.joinpath("config.toml").write_text(
|
|
||||||
"""
|
|
||||||
dsda = "dsda-doom/exe"
|
|
||||||
iwad = "DOOM2.WAD"
|
|
||||||
complevel = "2"
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
pwp = tdp.joinpath("pwads")
|
|
||||||
pwp.mkdir()
|
|
||||||
scp = pwp.joinpath("scythe")
|
|
||||||
scp.mkdir()
|
|
||||||
scp.joinpath("config.toml").touch()
|
|
||||||
scp.joinpath("scythe.wad").touch()
|
|
||||||
zero = subprocess.CompletedProcess
|
|
||||||
zero.returncode = 0
|
|
||||||
when(subprocess).run(
|
|
||||||
[
|
|
||||||
tdp.joinpath("dsda-doom").joinpath("exe"),
|
|
||||||
"-iwad",
|
|
||||||
tdp.joinpath("iwads").joinpath("DOOM2.WAD"),
|
|
||||||
"-file",
|
|
||||||
tdp.joinpath("pwads").joinpath("scythe").joinpath("scythe.wad"),
|
|
||||||
"-complevel",
|
|
||||||
"2",
|
|
||||||
"-skill",
|
|
||||||
"4",
|
|
||||||
"-warp",
|
|
||||||
"01",
|
|
||||||
]
|
|
||||||
).thenReturn(zero)
|
|
||||||
dcc.play.Play.__init__ = lambda self: None
|
|
||||||
dcc.play.Play.get_epilog = lambda self: ""
|
|
||||||
rig = dcc.play.Play()
|
|
||||||
rig._hooks = []
|
|
||||||
parser = rig.get_parser("test_play")
|
|
||||||
parsed_args = parser.parse_args(args=["--doom", td, "scythe", "01"])
|
|
||||||
assert rig.run(parsed_args) == 0
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue