all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer 2/2] tui: install progress: use ok/cancel as button text for installer prompt
Date: Fri, 17 Nov 2023 14:45:27 +0100	[thread overview]
Message-ID: <20231117134700.701332-2-c.heiss@proxmox.com> (raw)
In-Reply-To: <20231117134700.701332-1-c.heiss@proxmox.com>

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@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





  reply	other threads:[~2023-11-17 13:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 13:45 [pve-devel] [RFC PATCH installer 1/2] ui: stdio: replace newlines with whitespaces in prompt messages Christoph Heiss
2023-11-17 13:45 ` Christoph Heiss [this message]
2023-11-17 16:09 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231117134700.701332-2-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal