From a025d3ac5f0793af99bf0703a2639967e4789bee Mon Sep 17 00:00:00 2001 From: nodlek-ctrl Date: Thu, 13 Apr 2023 21:03:43 +1000 Subject: [PATCH] replace with fatal error --- printer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/printer.py b/printer.py index 3eab310..5d35a52 100644 --- a/printer.py +++ b/printer.py @@ -597,8 +597,8 @@ def magick_text(stdin, image_width, font_size, font_family): 'Pipe an io to ImageMagick for processing text to image, return output io' read_fd, write_fd = os.pipe() if _MagickExe is None: - error(i18n("imagemagick-not-found")) - exit(129) + fatal(i18n("imagemagick-not-found"), code=129) + subprocess.Popen([_MagickExe, '-background', 'white', '-fill', 'black', '-size', f'{image_width}x', '-font', font_family, '-pointsize', str(font_size), 'caption:@-', 'pbm:-'], @@ -609,8 +609,8 @@ def magick_image(stdin, image_width, dither): 'Pipe an io to ImageMagick for processing "usual" image to pbm, return output io' read_fd, write_fd = os.pipe() if _MagickExe is None: - error(i18n("imagemagick-not-found")) - exit(129) + fatal(i18n("imagemagick-not-found"), code=129) + subprocess.Popen([_MagickExe, '-', '-fill', 'white', '-opaque', 'transparent', '-resize', f'{image_width}x', '-dither', dither, '-monochrome', 'pbm:-'], stdin=stdin, stdout=io.FileIO(write_fd, 'w'))