Move the remaining hardcoded constants into the configuration file.

This commit is contained in:
yrriban 2025-07-03 18:04:19 -04:00
parent 4bbf57036d
commit d778e281ba
4 changed files with 25 additions and 30 deletions

View file

@ -18,26 +18,19 @@ class SS(dcc.doom_base.WadMap):
pass
def _try_screenshot(self, gravity, yolo):
with wand.image.Image(
width=dcc.config.THUMB_WIDTH,
height=dcc.config.THUMB_HEIGHT,
pseudo="x:"
) as img:
width = self.thumbnail_width
height = self.thumbnail_height
with wand.image.Image(width=width, height=height, pseudo="x:") as img:
img.reset_coords()
if (
img.size[0] < dcc.config.THUMB_WIDTH
or img.size[1] < dcc.config.THUMB_HEIGHT
):
if (img.size[0] < width or img.size[1] < height):
if not messagebox.askretrycancel(
title="DCC", message="Image too small. Try again?"
title="DCC",
message=f"Image too small ({img.width}x{img.height})." +
"Try again?"
):
sys.exit("Gave up trying to select an image.")
return False
img.crop(
width=dcc.config.THUMB_WIDTH,
height=dcc.config.THUMB_HEIGHT,
gravity=gravity
)
img.crop(width=width, height=height, gravity=gravity)
img.reset_coords()
if not yolo:
wand.display.display(img)