Compare commits

..

4 commits

Author SHA1 Message Date
469d8eb13a PEP 8 compliance. 2025-07-23 18:29:15 -04:00
366ddf6132 Properly handle overwriting values in a wad-level config.
This only was a problem for values that we were geenerating a property
for.
2025-07-23 18:26:45 -04:00
114fec8f7e Fix the extract command to work with the new nested config classes. 2025-07-23 18:26:11 -04:00
30baa49588 Fix text stroke color reference in the concat command. 2025-07-20 01:52:50 -04:00
4 changed files with 11 additions and 9 deletions

View file

@ -92,7 +92,7 @@ class Concat(dcc.doom_base.Wad):
)
img.trim(reset_coords=True)
img.border("graya(25%, 25%)", 10, 10)
img.border(dcc.config.TEXT_STROKE_COLOR, 16, 16)
img.border(self.thumbnail_text_stroke, 16, 16)
# for this to work... the image needs to have a width that's a
# multiple of 8. dude whyyyyyyy
padfactor = 8

View file

@ -20,6 +20,7 @@ class Base(Command):
self._config_name = parsed_args.config_name
self._config = tomlkit.toml_file.TOMLFile(
self.doom.joinpath(self.config_name)).read()
self._dsda = self._config.get("dsda")
if self.dsda is None:
raise Exception(
@ -28,6 +29,7 @@ class Base(Command):
for d in ("iwads", "pwads", "demos", "fabricate"):
self._init_attr([d], d, fn=self.doom.joinpath)
def finalize(self):
self._init_attr(["thumbnail", "height"], 720)
self._init_attr(["thumbnail", "width"], 1280)
self._init_attr(["thumbnail", "font"], None)

View file

@ -19,14 +19,15 @@ class Wad(dcc.config.Base):
wcp = self.pwads.joinpath(self.wad).joinpath(self.config_name)
if wcp.exists():
self._wad_config = tomlkit.toml_file.TOMLFile(wcp).read()
for k,v in self._wad_config.items():
for k, v in self._wad_config.items():
if isinstance(v, dict):
if not k in self._config:
if k not in self._config:
self._config[k] = {}
for sk in v:
self._config[k][sk] = v[sk]
else:
self._config[k] = v
self.finalize()
def run(self, parsed_args):
self.wad_init(parsed_args)

View file

@ -1,14 +1,13 @@
import dcc.config
import dcc.doom_base
import omg
import numpy as np
import wand.color
import wand.image
class Extract(dcc.config.base):
class Extract(dcc.doom_base.Wad):
def get_parser(self, prog_name):
parser = super().get_parser(prog_name)
parser.add_argument('wad')
parser.add_argument('lump')
return parser
@ -30,17 +29,17 @@ class Extract(dcc.config.base):
) as img:
img.transparent_color(wand.color.Color("#ff00ff"), 0.0)
img.save(
filename=self.output.joinpath(parsed_args.wad)
filename=self.fabricate.joinpath(parsed_args.wad)
.joinpath(parsed_args.lump + ".png")
)
return
except Exception as e:
print(
f"Wad {w} likely has no lump {parsed_args.lump}"
f"Wad {w} likely has no lump {parsed_args.lump} "
+ f"(exception {e})."
)
print(
"Lump {parsed_args.lump} not found in any wad in"
"Lump {parsed_args.lump} not found in any wad in "
+ f"{parsed_args.wad}"
)