[pve-devel] [PATCH installer 2/2] tui: install progress: use ok/cancel as button text for installer prompt
Christoph Heiss
c.heiss at proxmox.com
Fri Nov 17 14:45:27 CET 2023
The GTK installer/UI module in the low-level installer does the same.
Messages used with this are worded for this, using yes/no instead can be
quite confusing (e.g.
Proxmox::Install::ask_existing_vg_rename_or_abort())
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
proxmox-tui-installer/src/main.rs | 12 ++++++++----
proxmox-tui-installer/src/views/install_progress.rs | 6 ++++--
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index e1411c6..4c14482 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -285,21 +285,23 @@ fn switch_to_prev_screen(siv: &mut Cursive) {
siv.set_screen(id);
}
-fn yes_no_dialog(
+fn prompt_dialog(
siv: &mut Cursive,
title: &str,
text: &str,
+ yes_text: &str,
callback_yes: Box<dyn Fn(&mut Cursive)>,
+ no_text: &str,
callback_no: Box<dyn Fn(&mut Cursive)>,
) {
siv.add_layer(
Dialog::around(TextView::new(text))
.title(title)
- .button("No", move |siv| {
+ .button(no_text, move |siv| {
siv.pop_layer();
callback_no(siv);
})
- .button("Yes", move |siv| {
+ .button(yes_text, move |siv| {
siv.pop_layer();
callback_yes(siv);
}),
@@ -311,11 +313,13 @@ fn trigger_abort_install_dialog(siv: &mut Cursive) {
siv.quit();
#[cfg(not(debug_assertions))]
- yes_no_dialog(
+ prompt_dialog(
siv,
"Abort installation?",
"Are you sure you want to abort the installation?",
+ "Yes",
Box::new(Cursive::quit),
+ "No",
Box::new(|_| {}),
)
}
diff --git a/proxmox-tui-installer/src/views/install_progress.rs b/proxmox-tui-installer/src/views/install_progress.rs
index 76dd518..01c9941 100644
--- a/proxmox-tui-installer/src/views/install_progress.rs
+++ b/proxmox-tui-installer/src/views/install_progress.rs
@@ -13,7 +13,7 @@ use cursive::{
CbSink, Cursive,
};
-use crate::{abort_install_button, setup::InstallConfig, yes_no_dialog, InstallerState};
+use crate::{abort_install_button, prompt_dialog, setup::InstallConfig, InstallerState};
use proxmox_installer_common::setup::spawn_low_level_installer;
pub struct InstallProgressView {
@@ -189,10 +189,11 @@ impl InstallProgressView {
}
fn show_prompt<W: Write + 'static>(siv: &mut Cursive, text: &str, writer: Arc<Mutex<W>>) {
- yes_no_dialog(
+ prompt_dialog(
siv,
"Prompt",
text,
+ "OK",
Box::new({
let writer = writer.clone();
move |_| {
@@ -201,6 +202,7 @@ impl InstallProgressView {
}
}
}),
+ "Cancel",
Box::new(move |_| {
if let Ok(mut writer) = writer.lock() {
let _ = writeln!(writer);
--
2.42.0
More information about the pve-devel
mailing list