mirror of
https://github.com/NaitLee/Cat-Printer.git
synced 2025-05-15 23:00:15 -07:00
make it so error only happens when using cli
This commit is contained in:
parent
b01ab117ae
commit
2e152c2bd4
@ -592,12 +592,13 @@ def fallback_program(*programs):
|
||||
return None
|
||||
|
||||
_MagickExe = fallback_program('magick', 'magick.exe', 'convert', 'convert.exe')
|
||||
if _MagickExe is None:
|
||||
error(i18n("imagemagick-not-found"))
|
||||
|
||||
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)
|
||||
subprocess.Popen([_MagickExe, '-background', 'white', '-fill', 'black',
|
||||
'-size', f'{image_width}x', '-font', font_family, '-pointsize',
|
||||
str(font_size), 'caption:@-', 'pbm:-'],
|
||||
@ -607,6 +608,9 @@ def magick_text(stdin, image_width, font_size, font_family):
|
||||
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)
|
||||
subprocess.Popen([_MagickExe, '-', '-fill', 'white', '-opaque', 'transparent',
|
||||
'-resize', f'{image_width}x', '-dither', dither, '-monochrome', 'pbm:-'],
|
||||
stdin=stdin, stdout=io.FileIO(write_fd, 'w'))
|
||||
|
@ -160,6 +160,6 @@
|
||||
"scan": "Scan",
|
||||
"now-will-scan-for-all-bluetooth-devices-nearby": "Scan set to search for all bluetooth devides nearby.",
|
||||
"pf2-font-not-found-or-broken-0": "PF2 font not found or broken: '{0}'",
|
||||
"imagemagick-not-found": "ImageMagick not found, please install it before trying any command line hackery."
|
||||
"imagemagick-not-found": "ImageMagick not found, please install it and retry."
|
||||
|
||||
}
|
@ -138,6 +138,6 @@
|
||||
"now-will-scan-for-all-bluetooth-devices-nearby": "WIL FIND ALL THINY KITTE OR NOT",
|
||||
"scan": "FIND",
|
||||
"pf2-font-not-found-or-broken-0": "KITTE FONT LOST OR DEAD> {0}",
|
||||
"image-magick-not-found": "IMAGEMAGICK NOT FINDZ, PLZ INSTALL IT BEFORE TRYIN ANY COMMAND LINE FEATUREZ."
|
||||
"image-magick-not-found": "IMAGEMAGICK NOT FINDZ, PLZ INSTALL IT AND HAVES ANODA GO."
|
||||
|
||||
}
|
||||
|
@ -150,5 +150,5 @@
|
||||
"free-software": "自由软件",
|
||||
"free-software-description": "尊重您计算自由的软件。",
|
||||
"pf2-font-not-found-or-broken-0": "PF2 字体丢失或损坏:'{0}'",
|
||||
"image-magick-not-found": "未找到 ImageMagick,请在尝试任何命令行功能之前安装它。"
|
||||
"image-magick-not-found": "未找到 ImageMagick,请安装并重试。"
|
||||
}
|
@ -150,5 +150,5 @@
|
||||
"free-software": "自由軟件",
|
||||
"free-software-description": "尊重您計算自由的軟件。",
|
||||
"pf2-font-not-found-or-broken-0": "PF2 字體丟失或損壞:'{0}'",
|
||||
"imagemagick-not-found": "未找到 ImageMagick,請在嘗試任何命令行功能之前安裝它。"
|
||||
"imagemagick-not-found": "未找到 ImageMagick,請安裝並重試。"
|
||||
}
|
@ -150,5 +150,5 @@
|
||||
"free-software": "自由軟件",
|
||||
"free-software-description": "尊重您計算自由的軟件。",
|
||||
"pf2-font-not-found-or-broken-0": "PF2 字體丟失或損壞:'{0}'",
|
||||
"imagemagick-not-found": "未找到 ImageMagick,請在嘗試任何命令行功能之前安裝它。"
|
||||
"imagemagick-not-found": "未找到 ImageMagick,請安裝並重試。"
|
||||
}
|
@ -149,5 +149,5 @@
|
||||
"javascript-catprinter-description": "貓咪印表機 (Cat-Printer) 主指令碼",
|
||||
"free-software": "自由軟體",
|
||||
"free-software-description": "尊重您計算自由的軟體。",
|
||||
"pf2-font-not-found-or-broken-0": "未找到 ImageMagick,請在嘗試任何命令行功能之前安裝它。"
|
||||
"pf2-font-not-found-or-broken-0": "未找到 ImageMagick,請安裝並重試。"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user