public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer 0/2] tui: make multi-disk selection view scrollable
@ 2023-06-22  9:56 Christoph Heiss
  2023-06-22  9:56 ` [pve-devel] [PATCH installer 1/2] tui: wrap multi-disk selection in scrollable view Christoph Heiss
  2023-06-22  9:56 ` [pve-devel] [PATCH installer 2/2] tui: disable automatic text wrapping for form labels Christoph Heiss
  0 siblings, 2 replies; 6+ messages in thread
From: Christoph Heiss @ 2023-06-22  9:56 UTC (permalink / raw)
  To: pve-devel

Small improvement; as in the title.

The second patch also does as it says on the tin; as otherwise weird
layouts can happen on small screen/cramped views.

Christoph Heiss (2):
  tui: wrap multi-disk selection in scrollable view
  tui: disable automatic text wrapping for form labels

 proxmox-tui-installer/src/views/bootdisk.rs | 9 ++++++---
 proxmox-tui-installer/src/views/mod.rs      | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

--
2.40.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 1/2] tui: wrap multi-disk selection in scrollable view
  2023-06-22  9:56 [pve-devel] [PATCH installer 0/2] tui: make multi-disk selection view scrollable Christoph Heiss
@ 2023-06-22  9:56 ` Christoph Heiss
  2023-06-22 12:41   ` [pve-devel] applied: " Thomas Lamprecht
  2023-06-22 12:45   ` [pve-devel] " Thomas Lamprecht
  2023-06-22  9:56 ` [pve-devel] [PATCH installer 2/2] tui: disable automatic text wrapping for form labels Christoph Heiss
  1 sibling, 2 replies; 6+ messages in thread
From: Christoph Heiss @ 2023-06-22  9:56 UTC (permalink / raw)
  To: pve-devel

If lots of disks are present and the available screen size is rather
small, it might be impossible for users to properly set all disks as
they want.

Fix it by making the view scrollable.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-tui-installer/src/views/bootdisk.rs | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/proxmox-tui-installer/src/views/bootdisk.rs b/proxmox-tui-installer/src/views/bootdisk.rs
index 09e6803..775ffa4 100644
--- a/proxmox-tui-installer/src/views/bootdisk.rs
+++ b/proxmox-tui-installer/src/views/bootdisk.rs
@@ -2,7 +2,9 @@ use std::{cell::RefCell, marker::PhantomData, rc::Rc};
 
 use cursive::{
     view::{Nameable, Resizable, ViewWrapper},
-    views::{Button, Dialog, DummyView, LinearLayout, NamedView, Panel, SelectView, TextView},
+    views::{
+        Button, Dialog, DummyView, LinearLayout, NamedView, Panel, ScrollView, SelectView, TextView,
+    },
     Cursive, View,
 };
 
@@ -268,7 +270,7 @@ impl<T: View> MultiDiskOptionsView<T> {
         let disk_select_view = LinearLayout::vertical()
             .child(TextView::new("Disk setup").center())
             .child(DummyView)
-            .child(disk_form);
+            .child(ScrollView::new(disk_form));
 
         let options_view = LinearLayout::vertical()
             .child(TextView::new("Advanced options").center())
@@ -306,7 +308,8 @@ impl<T: View> MultiDiskOptionsView<T> {
             .get_child(0)?
             .downcast_ref::<LinearLayout>()?
             .get_child(2)?
-            .downcast_ref::<FormView>()?;
+            .downcast_ref::<ScrollView<FormView>>()?
+            .get_inner();
 
         for i in 0..disk_form.len() {
             let disk = disk_form.get_value::<SelectView<Option<Disk>>, _>(i)?;
-- 
2.40.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 2/2] tui: disable automatic text wrapping for form labels
  2023-06-22  9:56 [pve-devel] [PATCH installer 0/2] tui: make multi-disk selection view scrollable Christoph Heiss
  2023-06-22  9:56 ` [pve-devel] [PATCH installer 1/2] tui: wrap multi-disk selection in scrollable view Christoph Heiss
@ 2023-06-22  9:56 ` Christoph Heiss
  2023-06-22 12:41   ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 1 reply; 6+ messages in thread
From: Christoph Heiss @ 2023-06-22  9:56 UTC (permalink / raw)
  To: pve-devel

This just causes weird layouts; such that labels and inputs do not line
up anymore.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-tui-installer/src/views/mod.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-tui-installer/src/views/mod.rs b/proxmox-tui-installer/src/views/mod.rs
index ee96398..14d3209 100644
--- a/proxmox-tui-installer/src/views/mod.rs
+++ b/proxmox-tui-installer/src/views/mod.rs
@@ -305,7 +305,7 @@ impl FormView {
     }
 
     pub fn add_child(&mut self, label: &str, view: impl View) {
-        self.add_to_column(0, TextView::new(format!("{label}: ")));
+        self.add_to_column(0, TextView::new(format!("{label}: ")).no_wrap());
         self.add_to_column(1, view);
     }
 
-- 
2.40.1





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] applied: [PATCH installer 1/2] tui: wrap multi-disk selection in scrollable view
  2023-06-22  9:56 ` [pve-devel] [PATCH installer 1/2] tui: wrap multi-disk selection in scrollable view Christoph Heiss
@ 2023-06-22 12:41   ` Thomas Lamprecht
  2023-06-22 12:45   ` [pve-devel] " Thomas Lamprecht
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2023-06-22 12:41 UTC (permalink / raw)
  To: Proxmox VE development discussion, Christoph Heiss

Am 22/06/2023 um 11:56 schrieb Christoph Heiss:
> If lots of disks are present and the available screen size is rather
> small, it might be impossible for users to properly set all disks as
> they want.
> 
> Fix it by making the view scrollable.
> 
> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> ---
>  proxmox-tui-installer/src/views/bootdisk.rs | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] applied: [PATCH installer 2/2] tui: disable automatic text wrapping for form labels
  2023-06-22  9:56 ` [pve-devel] [PATCH installer 2/2] tui: disable automatic text wrapping for form labels Christoph Heiss
@ 2023-06-22 12:41   ` Thomas Lamprecht
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2023-06-22 12:41 UTC (permalink / raw)
  To: Proxmox VE development discussion, Christoph Heiss

Am 22/06/2023 um 11:56 schrieb Christoph Heiss:
> This just causes weird layouts; such that labels and inputs do not line
> up anymore.
> 
> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> ---
>  proxmox-tui-installer/src/views/mod.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [pve-devel] [PATCH installer 1/2] tui: wrap multi-disk selection in scrollable view
  2023-06-22  9:56 ` [pve-devel] [PATCH installer 1/2] tui: wrap multi-disk selection in scrollable view Christoph Heiss
  2023-06-22 12:41   ` [pve-devel] applied: " Thomas Lamprecht
@ 2023-06-22 12:45   ` Thomas Lamprecht
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2023-06-22 12:45 UTC (permalink / raw)
  To: Proxmox VE development discussion, Christoph Heiss

Am 22/06/2023 um 11:56 schrieb Christoph Heiss:
> If lots of disks are present and the available screen size is rather
> small, it might be impossible for users to properly set all disks as
> they want.
> 
> Fix it by making the view scrollable.
> 

what I forgot to write: It's much better than nothing if one has many disks, but the
selection behavior and scrolling interacts a bit weirdly IMO, i.e., something like:

- if I first move down the disk selection gets moved down, scrollbar stays as is
- if the selection goes over the view border the scroll bar moves but I see no
  selection any more
- once I then reached the end of the whole view (scrolled to bottom) the selection
  starts moving down again, but depending on how many disks entries there are it
  requires quite a few moves until it's in view again.

It would be more like expected if the selection moves along when scrolling down,
and up if scrolling up, respectively.






^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-22 12:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-22  9:56 [pve-devel] [PATCH installer 0/2] tui: make multi-disk selection view scrollable Christoph Heiss
2023-06-22  9:56 ` [pve-devel] [PATCH installer 1/2] tui: wrap multi-disk selection in scrollable view Christoph Heiss
2023-06-22 12:41   ` [pve-devel] applied: " Thomas Lamprecht
2023-06-22 12:45   ` [pve-devel] " Thomas Lamprecht
2023-06-22  9:56 ` [pve-devel] [PATCH installer 2/2] tui: disable automatic text wrapping for form labels Christoph Heiss
2023-06-22 12:41   ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal