public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer v2 6/7] gui: use basic grid in the network panel
Date: Tue, 21 Nov 2023 16:10:24 +0100	[thread overview]
Message-ID: <20231121151025.233224-7-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20231121151025.233224-1-m.sandoval@proxmox.com>

Using boxes causes the labels to not align correctly in certain
circumstances. In the following commits we replace the use of boxes with
grids and set the margins and spacing directly on the respective grid.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 proxinstall | 52 ++++++++++++++++++++++++----------------------------
 1 file changed, 24 insertions(+), 28 deletions(-)

diff --git a/proxinstall b/proxinstall
index 87e81fd..9551a89 100755
--- a/proxinstall
+++ b/proxinstall
@@ -281,18 +281,14 @@ sub check_number {
 sub create_text_input {
     my ($default, $text) = @_;
 
-    my $hbox = Gtk3::Box->new('horizontal', 0);
-
     my $label = Gtk3::Label->new($text);
     $label->set_size_request(150, -1);
     $label->set_xalign(1.0);
-    $hbox->pack_start($label, 0, 0, 10);
     my $e1 = Gtk3::Entry->new();
     $e1->set_width_chars(35);
-    $hbox->pack_start($e1, 0, 0, 0);
     $e1->set_text($default);
 
-    return ($hbox, $e1);
+    return ($label, $e1);
 }
 sub create_cidr_inputs {
     my ($cidr) = @_;
@@ -304,23 +300,22 @@ sub create_cidr_inputs {
     my $label = Gtk3::Label->new('IP Address (CIDR)');
     $label->set_size_request(150, -1);
     $label->set_xalign(1.0);
-    $hbox->pack_start($label, 0, 0, 10);
 
     my $ip_el = Gtk3::Entry->new();
     $ip_el->set_width_chars(28);
     $hbox->pack_start($ip_el, 1, 1, 0);
     $ip_el->set_text($default_ip);
 
-    $label = Gtk3::Label->new('/');
-    $label->set_size_request(10, -1);
-    $hbox->pack_start($label, 0, 0, 2);
+    my $dash_label = Gtk3::Label->new('/');
+    $dash_label->set_size_request(10, -1);
+    $hbox->pack_start($dash_label, 0, 0, 2);
 
     my $cidr_el = Gtk3::Entry->new();
     $cidr_el->set_width_chars(3);
     $hbox->pack_start($cidr_el, 0, 0, 0);
     $cidr_el->set_text($default_mask);
 
-    return ($hbox, $ip_el, $cidr_el);
+    return ($label, $hbox, $ip_el, $cidr_el);
 }
 
 my $ipconf_first_view = 1;
@@ -345,16 +340,15 @@ sub create_ipconf_view {
     cleanup_view();
     Proxmox::UI::display_html('ipconf.htm');
 
-    my $vcontainer = Gtk3::Box->new('vertical', 0);
-    $gtk_state->{inbox}->pack_start($vcontainer, 1, 0, 0);
-    my $hcontainer =  Gtk3::Box->new('horizontal', 0);
-    $vcontainer->pack_start($hcontainer, 0, 0, 10);
-    my $vbox =  Gtk3::Box->new('vertical', 0);
-    $hcontainer->add($vbox);
+    my $grid = &$create_basic_grid();
+    $grid->set_row_spacing(10);
+    $grid->set_column_spacing(10);
+
+    $gtk_state->{inbox}->pack_start($grid, 0, 0, 0);
 
     my $cidr = Proxmox::Install::Config::get_cidr() // '192.168.100.2/24';
 
-    my ($cidr_box, $ipconf_entry_addr, $ipconf_entry_mask) = create_cidr_inputs($cidr);
+    my ($cidr_label, $cidr_box, $ipconf_entry_addr, $ipconf_entry_mask) = create_cidr_inputs($cidr);
 
     my $device_model = Gtk3::ListStore->new('Glib::String', 'Glib::String');
     my $device_cb = Gtk3::ComboBox->new_with_model($device_model);
@@ -422,37 +416,39 @@ sub create_ipconf_view {
 	$device_cb->set_active(0);
     }
 
-    my $devicebox = Gtk3::Box->new('horizontal', 0);
     my $label = Gtk3::Label->new("Management Interface:");
     $label->set_size_request(150, -1);
     $label->set_xalign(1.0);
-    $devicebox->pack_start($label, 0, 0, 10);
-    $devicebox->pack_start($device_cb, 0, 0, 0);
 
-    $vbox->pack_start($devicebox, 0, 0, 2);
+    $grid->attach($label, 0, 0, 1, 1);
+    $grid->attach($device_cb, 1, 0, 1, 1);
 
     my $fqdn = Proxmox::Install::Config::get_fqdn();
     my $hostname = $run_env->{network}->{hostname} || $iso_env->{product};
     my $domain = $ipconf->{domain} || "example.invalid";
     $fqdn //= "$hostname.$domain";
 
-    my ($hostbox, $hostentry) = create_text_input($fqdn, 'Hostname (FQDN):');
-    $vbox->pack_start($hostbox, 0, 0, 2);
+    my ($host_label, $hostentry) = create_text_input($fqdn, 'Hostname (FQDN):');
+    $grid->attach($host_label, 0, 1, 1, 1);
+    $grid->attach($hostentry, 1, 1, 1, 1);
 
-    $vbox->pack_start($cidr_box, 0, 0, 2);
+    $grid->attach($cidr_label, 0, 2, 1, 1);
+    $grid->attach($cidr_box, 1, 2, 1, 1);
 
     my $cfg_gateway = Proxmox::Install::Config::get_gateway();
     my $gateway = $cfg_gateway // $ipconf->{gateway} || '192.168.100.1';
 
-    my ($gwbox, $ipconf_entry_gw) = create_text_input($gateway, 'Gateway:');
-    $vbox->pack_start($gwbox, 0, 0, 2);
+    my ($gw_label, $ipconf_entry_gw) = create_text_input($gateway, 'Gateway:');
+    $grid->attach($gw_label, 0, 3, 1, 1);
+    $grid->attach($ipconf_entry_gw, 1, 3, 1, 1);
 
     my $cfg_dns = Proxmox::Install::Config::get_dns();
     my $dnsserver = $cfg_dns // $ipconf->{dnsserver} || $gateway;
 
-    my ($dnsbox, $ipconf_entry_dns) = create_text_input($dnsserver, 'DNS Server:');
+    my ($dns_label, $ipconf_entry_dns) = create_text_input($dnsserver, 'DNS Server:');
 
-    $vbox->pack_start($dnsbox, 0, 0, 0);
+    $grid->attach($dns_label, 0, 4, 1, 1);
+    $grid->attach($ipconf_entry_dns, 1, 4, 1, 1);
 
     $gtk_state->{inbox}->show_all;
     set_next(undef, sub {
-- 
2.39.2





  parent reply	other threads:[~2023-11-21 15:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 15:10 [pve-devel] [PATCH installer v2 0/7] gui: use gtk grids when possible Maximiliano Sandoval
2023-11-21 15:10 ` [pve-devel] [PATCH installer v2 1/7] gui: move create_basic_grid subroutine definition up Maximiliano Sandoval
2023-11-21 15:10 ` [pve-devel] [PATCH installer v2 2/7] gui: expand ip address Gtk3::Entry Maximiliano Sandoval
2023-12-15 12:06   ` Christoph Heiss
2023-12-15 14:08     ` Maximiliano Sandoval
2023-12-20  9:40       ` Christoph Heiss
2023-11-21 15:10 ` [pve-devel] [PATCH installer v2 3/7] gui: use basic grid in password panel Maximiliano Sandoval
2023-11-21 15:10 ` [pve-devel] [PATCH installer v2 4/7] gui: use basic grid in country/timezone panel Maximiliano Sandoval
2023-11-21 15:10 ` [pve-devel] [PATCH installer v2 5/7] gui: change margins in create_basic_grid Maximiliano Sandoval
2023-11-21 15:10 ` Maximiliano Sandoval [this message]
2023-11-21 15:10 ` [pve-devel] [PATCH installer v2 7/7] gui: remove trailing spaces and colons Maximiliano Sandoval
2023-12-14 13:58 ` [pve-devel] [PATCH installer v2 0/7] gui: use gtk grids when possible Maximiliano Sandoval
2023-12-15  8:50 ` Lukas Wagner
2023-12-15 12:08 ` Christoph Heiss
2024-01-08 10:47 ` Maximiliano Sandoval
2024-02-14 13:32   ` Maximiliano Sandoval
2024-02-22 13:31     ` Maximiliano Sandoval
2024-02-23 13:16 ` [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=20231121151025.233224-7-m.sandoval@proxmox.com \
    --to=m.sandoval@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 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