Printing failures say printing failed, in every app (T-13)
This commit is contained in:
9 files changed
+18
-20
No files matched your search
@@ -81,10 +81,8 @@ impl Docs {
|
|||||||
let path = source.work.join("print.pdf");
|
let path = source.work.join("print.pdf");
|
||||||
let printing = path.clone();
|
let printing = path.clone();
|
||||||
return self.write_pdf(tab, path, pdf, cx, move |docs, written, cx| match written {
|
return self.write_pdf(tab, path, pdf, cx, move |docs, written, cx| match written {
|
||||||
Ok(()) => ely_office::print_later(printing, cx, |docs, error, cx| {
|
Ok(()) => ely_office::print_later(printing, cx),
|
||||||
docs.output_failed(&error, cx)
|
Err(error) => docs.print_failed(&error.to_string(), cx),
|
||||||
}),
|
|
||||||
Err(error) => docs.output_failed(&error.to_string(), cx),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let Some(dir) = ely_office::folder(source) else {
|
let Some(dir) = ely_office::folder(source) else {
|
||||||
|
|||||||
@@ -343,9 +343,7 @@ impl Desk {
|
|||||||
if !job.lost.whole() {
|
if !job.lost.whole() {
|
||||||
self.warn_lost(&job.lost, None, cx);
|
self.warn_lost(&job.lost, None, cx);
|
||||||
}
|
}
|
||||||
return ely_office::print_later(pdf, cx, |desk, why, cx| {
|
return ely_office::print_later(pdf, cx);
|
||||||
desk.exported(Err(io::Error::other(why)), cx)
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
// Never over the open file, not even through a link.
|
// Never over the open file, not even through a link.
|
||||||
let moved = not_open(self, &to)
|
let moved = not_open(self, &to)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ impl Viewer {
|
|||||||
id,
|
id,
|
||||||
move |worker, doc| worker.get()?.print_copy(*doc, &out),
|
move |worker, doc| worker.get()?.print_copy(*doc, &out),
|
||||||
move |viewer, done, _, cx| match done {
|
move |viewer, done, _, cx| match done {
|
||||||
Ok(()) => ely_office::print_later(printing, cx, |viewer, error, cx| viewer.panel_failed(&error, cx)),
|
Ok(()) => ely_office::print_later(printing, cx),
|
||||||
Err(error) => viewer.failed(&error, cx),
|
Err(error) => viewer.failed(&error, cx),
|
||||||
},
|
},
|
||||||
cx,
|
cx,
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ impl Deck {
|
|||||||
let path = work.join("print.pdf");
|
let path = work.join("print.pdf");
|
||||||
let printing = path.clone();
|
let printing = path.clone();
|
||||||
return self.write_pdf(&output, path, cx, move |_, cx| {
|
return self.write_pdf(&output, path, cx, move |_, cx| {
|
||||||
ely_office::print_later(printing, cx, |deck, error, cx| deck.output_failed(&error, cx))
|
ely_office::print_later(printing, cx)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let Some(dir) = ely_office::folder(source) else {
|
let Some(dir) = ely_office::folder(source) else {
|
||||||
|
|||||||
@@ -144,10 +144,8 @@ impl Book {
|
|||||||
tab,
|
tab,
|
||||||
move |worker, doc| doc.export_pdf(worker, &url, &WHOLE),
|
move |worker, doc| doc.export_pdf(worker, &url, &WHOLE),
|
||||||
move |book, written, _, cx| match written {
|
move |book, written, _, cx| match written {
|
||||||
Ok(()) => ely_office::print_later(path, cx, |book, error, cx| {
|
Ok(()) => ely_office::print_later(path, cx),
|
||||||
book.output_failed(&error, cx)
|
Err(error) => book.print_failed(&error.to_string(), cx),
|
||||||
}),
|
|
||||||
Err(error) => book.output_failed(&error.to_string(), cx),
|
|
||||||
},
|
},
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -242,11 +242,7 @@ pub fn in_window<H: Host, R>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Opens the print panel after GPUI releases the app.
|
/// Opens the print panel after GPUI releases the app.
|
||||||
pub fn print_later<H: Host>(
|
pub fn print_later<H: Tabs>(pdf: std::path::PathBuf, cx: &mut Context<H>) {
|
||||||
pdf: std::path::PathBuf,
|
|
||||||
cx: &mut Context<H>,
|
|
||||||
failed: impl FnOnce(&mut H, String, &mut Context<H>) + 'static,
|
|
||||||
) {
|
|
||||||
// The panel's modal loop calls back into GPUI.
|
// The panel's modal loop calls back into GPUI.
|
||||||
cx.spawn(async move |this, cx| {
|
cx.spawn(async move |this, cx| {
|
||||||
let printed = ely_platform::print::print_pdf(&pdf);
|
let printed = ely_platform::print::print_pdf(&pdf);
|
||||||
@@ -258,7 +254,7 @@ pub fn print_later<H: Host>(
|
|||||||
Ok(printed) => log::info!("office: print done, printed {printed}"),
|
Ok(printed) => log::info!("office: print done, printed {printed}"),
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
if this
|
if this
|
||||||
.update(cx, |host, cx| failed(host, error.to_string(), cx))
|
.update(cx, |host, cx| host.print_failed(&error.to_string(), cx))
|
||||||
.is_err()
|
.is_err()
|
||||||
{
|
{
|
||||||
log::error!("office: printing failed after its window closed: {error}");
|
log::error!("office: printing failed after its window closed: {error}");
|
||||||
@@ -293,6 +289,11 @@ pub trait Tabs: Host {
|
|||||||
self.toast_unlogged(text, severity, cx);
|
self.toast_unlogged(text, severity, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn print_failed(&self, error: &str, cx: &mut App) {
|
||||||
|
let text = text(cx, "office.print.failed", &[("error", error)]);
|
||||||
|
self.toast(text, Severity::Danger, cx);
|
||||||
|
}
|
||||||
|
|
||||||
/// A success toast with a button that opens `path`.
|
/// A success toast with a button that opens `path`.
|
||||||
fn toast_output(&self, text: SharedString, path: std::path::PathBuf, cx: &mut App) {
|
fn toast_output(&self, text: SharedString, path: std::path::PathBuf, cx: &mut App) {
|
||||||
log::info!("{}: {text}", Self::KIND.app.slug());
|
log::info!("{}: {text}", Self::KIND.app.slug());
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ pub(super) const EN: &[(&str, &str)] = &[
|
|||||||
"A conversion writes a new file; pick another name",
|
"A conversion writes a new file; pick another name",
|
||||||
),
|
),
|
||||||
("office.error.changed", "The document changed meanwhile; try again"),
|
("office.error.changed", "The document changed meanwhile; try again"),
|
||||||
|
("office.print.failed", "Printing failed: {error}"),
|
||||||
("office.recovery.failed", "A recovery copy was not written: {error}"),
|
("office.recovery.failed", "A recovery copy was not written: {error}"),
|
||||||
("office.recovery.off", "Recovery copies are off for this run: {error}"),
|
("office.recovery.off", "Recovery copies are off for this run: {error}"),
|
||||||
("office.recovery.lost", "{name} could not be recovered: {error}"),
|
("office.recovery.lost", "{name} could not be recovered: {error}"),
|
||||||
@@ -101,6 +102,7 @@ pub(super) const ZH_CN: &[(&str, &str)] = &[
|
|||||||
("office.error.conflict", "{name} 已在磁盘上改动,保存已停止"),
|
("office.error.conflict", "{name} 已在磁盘上改动,保存已停止"),
|
||||||
("office.error.convert", "格式转换要写成新文件,请换个名字"),
|
("office.error.convert", "格式转换要写成新文件,请换个名字"),
|
||||||
("office.error.changed", "文档在此间已改动,请重试"),
|
("office.error.changed", "文档在此间已改动,请重试"),
|
||||||
|
("office.print.failed", "打印失败:{error}"),
|
||||||
("office.recovery.failed", "恢复副本未能写入:{error}"),
|
("office.recovery.failed", "恢复副本未能写入:{error}"),
|
||||||
("office.recovery.off", "本次运行不写恢复副本:{error}"),
|
("office.recovery.off", "本次运行不写恢复副本:{error}"),
|
||||||
("office.recovery.lost", "{name} 未能恢复:{error}"),
|
("office.recovery.lost", "{name} 未能恢复:{error}"),
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@
|
|||||||
- [x] T-10 CSV 导入对话框开着时打开任何别的对话框,待导入的文件静默消失 — 被挤开的导入回到队头,已读完的保留列类型;R2 PASS
|
- [x] T-10 CSV 导入对话框开着时打开任何别的对话框,待导入的文件静默消失 — 被挤开的导入回到队头,已读完的保留列类型;R2 PASS
|
||||||
- [x] T-11 对话框比其标签活得久:导出、定义名称、重命名不可见却“开着”,挡住导入;名称表的“转到”激活已关闭的标签 — 关标签时一并关掉其对话框与选项列表;R1 PASS
|
- [x] T-11 对话框比其标签活得久:导出、定义名称、重命名不可见却“开着”,挡住导入;名称表的“转到”激活已关闭的标签 — 关标签时一并关掉其对话框与选项列表;R1 PASS
|
||||||
- [x] T-12 打印区域是整列或整行时页面设置无法应用 — 打印区域可为整列、整行(每端至多一个 $);R2 PASS
|
- [x] T-12 打印区域是整列或整行时页面设置无法应用 — 打印区域可为整列、整行(每端至多一个 $);R2 PASS
|
||||||
- [ ] T-13 打印失败报成“导出失败”(非 macOS 必现)
|
- [x] T-13 打印失败报成“导出失败”(非 macOS 必现) — print_later 自己以“打印失败”报错,五个应用同;R1 PASS
|
||||||
- [ ] T-14 导入扫描把整个文件的每个字段都建成字符串
|
- [ ] T-14 导入扫描把整个文件的每个字段都建成字符串
|
||||||
- [ ] T-15 非 UTF-8 文本的默认编码跟系统区域而不是界面语言
|
- [ ] T-15 非 UTF-8 文本的默认编码跟系统区域而不是界面语言
|
||||||
- [ ] S-01 切换幻灯片后主画布不重画
|
- [ ] S-01 切换幻灯片后主画布不重画
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
PASS
|
||||||
Reference in new issue
Block a user