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 C1751A2A49 for ; Tue, 20 Jun 2023 11:16:14 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 96D98326A1 for ; Tue, 20 Jun 2023 11:16:14 +0200 (CEST) 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 ; Tue, 20 Jun 2023 11:16:13 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id DFC2041BE1 for ; Tue, 20 Jun 2023 11:16:11 +0200 (CEST) From: Maximiliano Sandoval To: pve-devel@lists.proxmox.com Date: Tue, 20 Jun 2023 11:16:05 +0200 Message-Id: <20230620091610.68835-3-m.sandoval@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230620091610.68835-1-m.sandoval@proxmox.com> References: <20230620091610.68835-1-m.sandoval@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 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 - Subject: [pve-devel] [PATCH installer 2/7] use basic grid in the network panel 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: Tue, 20 Jun 2023 09:16:14 -0000 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 --- proxinstall | 56 ++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/proxinstall b/proxinstall index fbd260b..72802c0 100755 --- a/proxinstall +++ b/proxinstall @@ -1440,18 +1440,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 ($default_ip, $default_mask) = @_; @@ -1461,23 +1457,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, 0, 0, 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; @@ -1502,17 +1497,17 @@ 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 $ipaddr_text = $config->{ipaddress} // "192.168.100.2"; my $netmask_text = $config->{netmask} // "24"; my $cidr_box; - ($cidr_box, $ipconf_entry_addr, $ipconf_entry_mask) = + my $cidr_label; + ($cidr_label, $cidr_box, $ipconf_entry_addr, $ipconf_entry_mask) = create_cidr_inputs($ipaddr_text, $netmask_text); my $device_cb = Gtk3::ComboBoxText->new(); @@ -1567,34 +1562,37 @@ sub create_ipconf_view { 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 $hn = $fqdn // "$iso_env->{product}." . ($ipconf->{domain} // "example.invalid"); - my ($hostbox, $hostentry) = create_text_input($hn, 'Hostname (FQDN):'); - $vbox->pack_start($hostbox, 0, 0, 2); + my ($hostlabel, $hostentry) = create_text_input($hn, 'Hostname (FQDN):'); + $grid->attach($hostlabel, 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); $gateway = $config->{gateway} // $ipconf->{gateway} || '192.168.100.1'; - my $gwbox; - ($gwbox, $ipconf_entry_gw) = + my $gwlabel; + ($gwlabel, $ipconf_entry_gw) = create_text_input($gateway, 'Gateway:'); - $vbox->pack_start($gwbox, 0, 0, 2); + $grid->attach($gwlabel, 0, 3, 1, 1); + $grid->attach($ipconf_entry_gw, 1, 3, 1, 1); $dnsserver = $config->{dnsserver} // $ipconf->{dnsserver} || $gateway; - my $dnsbox; - ($dnsbox, $ipconf_entry_dns) = + my $dns_label; + ($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