codepet 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/codepet.js +15 -9
- package/package.json +1 -1
- package/scripts/polaroid_image.py +2 -2
package/bin/codepet.js
CHANGED
|
@@ -482,17 +482,23 @@ function doPopup() {
|
|
|
482
482
|
const script = path.join(__dirname, '..', 'scripts', 'polaroid.py');
|
|
483
483
|
const escapedScript = script.replace(/'/g, "'\\''");
|
|
484
484
|
execSync(`osascript -e 'tell application "Terminal" to do script "export HISTFILE=/dev/null && export BASH_SILENCE_DEPRECATION_WARNING=1 && export PS1=\\\"\\\" && clear && ${PYTHON} \\\"${escapedScript}\\\" ${pet.character} ${scene} 40 2>/dev/null && printf \\\"\\\\033[?25l\\\" && cat > /dev/null"' -e 'tell application "Terminal" to activate' &`, { shell: true, stdio: 'ignore' });
|
|
485
|
+
} else if (process.platform === 'win32') {
|
|
486
|
+
// Windows: 弹新 PowerShell 窗口显示彩色像素画拍立得
|
|
487
|
+
const script = path.join(__dirname, '..', 'scripts', 'polaroid.py').replace(/\\/g, '\\\\');
|
|
488
|
+
const psCmd = `${PYTHON} \\"${script}\\" ${pet.character} ${scene} 40 2>$null; Read-Host`;
|
|
489
|
+
execSync(`start powershell -NoProfile -Command "${psCmd}"`, { shell: true, stdio: 'ignore' });
|
|
485
490
|
} else {
|
|
486
|
-
//
|
|
487
|
-
const script = path.join(__dirname, '..', 'scripts', '
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
execSync(`${openCmd} "${photoPath}"`, { stdio: 'ignore', shell: true });
|
|
491
|
+
// Linux: 尝试终端弹窗
|
|
492
|
+
const script = path.join(__dirname, '..', 'scripts', 'polaroid.py');
|
|
493
|
+
if (process.env.DISPLAY) {
|
|
494
|
+
try {
|
|
495
|
+
execSync(`gnome-terminal -- bash -c '${PYTHON} "${script}" ${pet.character} ${scene} 40; read' 2>/dev/null &`, { shell: true, stdio: 'ignore' });
|
|
496
|
+
} catch {
|
|
497
|
+
try { execSync(`${PYTHON} "${script}" ${pet.character} ${scene} 40`, { stdio: 'inherit' }); } catch {}
|
|
494
498
|
}
|
|
495
|
-
}
|
|
499
|
+
} else {
|
|
500
|
+
try { execSync(`${PYTHON} "${script}" ${pet.character} ${scene} 40`, { stdio: 'inherit' }); } catch {}
|
|
501
|
+
}
|
|
496
502
|
}
|
|
497
503
|
}
|
|
498
504
|
|
package/package.json
CHANGED
|
@@ -65,8 +65,8 @@ def main():
|
|
|
65
65
|
target_h = int(sprite.height * ratio)
|
|
66
66
|
sprite = sprite.resize((target_w, target_h), Image.LANCZOS)
|
|
67
67
|
|
|
68
|
-
# 像素化处理 —
|
|
69
|
-
sprite = pixelate(sprite, pixel_size=
|
|
68
|
+
# 像素化处理 — 强烈像素风,类似拼豆/像素游戏
|
|
69
|
+
sprite = pixelate(sprite, pixel_size=14)
|
|
70
70
|
|
|
71
71
|
# 拍立得尺寸
|
|
72
72
|
padding = 50
|