Allow configuration of the thumbnail icon overlay.

Previously this was hardcoded to be M_DOOM_scaled.png.
This commit is contained in:
yrriban 2025-11-19 04:35:47 -05:00
parent c1e4156f3c
commit fcc6b22785
3 changed files with 10 additions and 9 deletions

View file

@ -28,6 +28,7 @@ class ConfigBase(object):
self._init_attr(["thumbnail", "font"], None) self._init_attr(["thumbnail", "font"], None)
self._init_attr(["thumbnail", "text_fill"], "white") self._init_attr(["thumbnail", "text_fill"], "white")
self._init_attr(["thumbnail", "text_stroke"], "red") self._init_attr(["thumbnail", "text_stroke"], "red")
self._init_attr(["thumbnail", "overlay_name"], "M_DOOM_scaled.png")
self._init_attr( self._init_attr(
["fetch", "mirror"], ["fetch", "mirror"],
"https://youfailit.net/pub/idgames" "https://youfailit.net/pub/idgames"

View file

@ -69,6 +69,12 @@ class Wad(dcc.config.Base):
return ["-assign", ",".join(options)] return ["-assign", ",".join(options)]
return [] return []
def thumb_overlay_path(self):
return (
self._ensure(self.fabricate.joinpath(self.wad))
.joinpath(self.thumbnail_overlay_name)
)
class WadMap(Wad): class WadMap(Wad):
def get_parser(self, prog_name): def get_parser(self, prog_name):
@ -82,7 +88,7 @@ class WadMap(Wad):
self._name = parsed_args.name self._name = parsed_args.name
self.wad_init(parsed_args) self.wad_init(parsed_args)
self.take_action(parsed_args) return self.take_action(parsed_args)
@property @property
def map(self): def map(self):
@ -162,12 +168,6 @@ class WadMap(Wad):
.joinpath(self._file_base("_base.png")) .joinpath(self._file_base("_base.png"))
) )
def m_doom_path(self):
return (
self._ensure(self.fabricate.joinpath(self.wad))
.joinpath("M_DOOM_scaled.png")
)
def text_thumb_path(self): def text_thumb_path(self):
return ( return (
self._ensure(self.fabricate.joinpath(self.wad)) self._ensure(self.fabricate.joinpath(self.wad))

View file

@ -13,7 +13,7 @@ class Thumb(dcc.doom_base.WadMap):
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()
mdoom = self.m_doom_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
@ -22,7 +22,7 @@ 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")
with wand.image.Image(filename=mdoom) 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")