From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id D4B699A841 for ; Fri, 17 Nov 2023 14:47:50 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BBBE5336CB for ; Fri, 17 Nov 2023 14:47:20 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 17 Nov 2023 14:47:20 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 18AEA43E0E for ; Fri, 17 Nov 2023 14:47:20 +0100 (CET) From: Christoph Heiss To: pve-devel@lists.proxmox.com Date: Fri, 17 Nov 2023 14:45:27 +0100 Message-ID: <20231117134700.701332-2-c.heiss@proxmox.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231117134700.701332-1-c.heiss@proxmox.com> References: <20231117134700.701332-1-c.heiss@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.000 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [main.rs] Subject: [pve-devel] [PATCH installer 2/2] tui: install progress: use ok/cancel as button text for installer prompt X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Nov 2023 13:47:50 -0000 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 --- 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, + no_text: &str, callback_no: Box, ) { 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(siv: &mut Cursive, text: &str, writer: Arc>) { - 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