Compare commits
2 Commits
047cc110a4
...
3b67d58ae2
Author | SHA1 | Date | |
---|---|---|---|
3b67d58ae2 | |||
d8e40bfb4d |
BIN
ica-rs/plugins/SMILEYSANS-OBLIQUE.TTF
Normal file
BIN
ica-rs/plugins/SMILEYSANS-OBLIQUE.TTF
Normal file
Binary file not shown.
@ -39,7 +39,7 @@ def local_env_image() -> bytes:
|
||||
img = Image.new("RGB", (800, 120), (255, 255, 255))
|
||||
# 往图片上写入一些信息
|
||||
draw = ImageDraw.Draw(img)
|
||||
font = ImageFont.truetype("simkai.ttf", size=25)
|
||||
font = ImageFont.truetype("SMILEYSANS-OBLIQUE.TTF", size=25)
|
||||
draw.text((10, 10), local_env_info(), fill=(0, 0, 0), font=font)
|
||||
img_cache = io.BytesIO()
|
||||
img.save(img_cache, format="PNG")
|
||||
|
@ -100,13 +100,29 @@ macro_rules! call_py_func {
|
||||
tokio::spawn(async move {
|
||||
Python::with_gil(|py| {
|
||||
if let Ok(py_func) = get_func($plugin.py_module.bind(py), $func_name) {
|
||||
if let Err(e) = py_func.call1($args) {
|
||||
if let Err(py_err) = py_func.call1($args) {
|
||||
let e = PyPluginError::FuncCallError(
|
||||
e,
|
||||
py_err,
|
||||
$func_name.to_string(),
|
||||
$plugin_path.to_string_lossy().to_string(),
|
||||
);
|
||||
event!(Level::WARN, "failed to call function<{}>: {:?}", $func_name, e);
|
||||
event!(
|
||||
Level::WARN,
|
||||
"failed to call function<{}>: {}\ntraceback: {}",
|
||||
$func_name,
|
||||
e,
|
||||
// 获取 traceback
|
||||
match &e {
|
||||
PyPluginError::FuncCallError(py_err, _, _) => match py_err.traceback_bound(py) {
|
||||
Some(traceback) => match traceback.format() {
|
||||
Ok(trace) => trace,
|
||||
Err(trace_e) => format!("failed to format traceback: {:?}", trace_e),
|
||||
},
|
||||
None => "no traceback".to_string(),
|
||||
},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user