* [pve-devel] [PATCH installer 1/3] proxinstall: move device changed callback after loop
@ 2024-12-17 15:23 Maximiliano Sandoval
2024-12-17 15:23 ` [pve-devel] [PATCH installer 2/3] proxinstall: set active element in combo box once Maximiliano Sandoval
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2024-12-17 15:23 UTC (permalink / raw)
To: pve-devel
Otherwise the callback will run once for each NIC.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
proxinstall | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proxinstall b/proxinstall
index 8168529..1d22e22 100755
--- a/proxinstall
+++ b/proxinstall
@@ -407,9 +407,9 @@ sub create_ipconf_view {
&$device_change_handler($device_cb);
$ipconf_first_view = 0;
}
- $device_cb->signal_connect('changed' => $device_change_handler);
$i++;
}
+ $device_cb->signal_connect('changed' => $device_change_handler);
if (my $nic = Proxmox::Install::Config::get_mngmt_nic()) {
$device_cb->set_active($device_active_reverse_map->{$nic} // 0);
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH installer 2/3] proxinstall: set active element in combo box once
2024-12-17 15:23 [pve-devel] [PATCH installer 1/3] proxinstall: move device changed callback after loop Maximiliano Sandoval
@ 2024-12-17 15:23 ` Maximiliano Sandoval
2024-12-17 15:23 ` [pve-devel] [PATCH installer 3/3] fix #2502: proxinstall: set cidr text manually Maximiliano Sandoval
2025-01-30 18:12 ` [pve-devel] applied-series: [PATCH installer 1/3] proxinstall: move device changed callback after loop Thomas Lamprecht
2 siblings, 0 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2024-12-17 15:23 UTC (permalink / raw)
To: pve-devel
We connect to the signal before setting the active device so it triggers.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
proxinstall | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/proxinstall b/proxinstall
index 1d22e22..cb74cc2 100755
--- a/proxinstall
+++ b/proxinstall
@@ -391,6 +391,8 @@ sub create_ipconf_view {
if $iface->{inet}->{prefix} || $iface->{inet6}->{prefix};
};
+ my $active_device_pos = 0;
+
my $i = 0;
for my $index (sort keys $ipconf->{ifaces}->%*) {
my $iface = $ipconf->{ifaces}->{$index};
@@ -403,20 +405,19 @@ sub create_ipconf_view {
$device_active_map->{$i} = $index;
$device_active_reverse_map->{$iface->{name}} = $i;
if ($ipconf_first_view && $index == $ipconf->{default}) {
- $device_cb->set_active($i);
- &$device_change_handler($device_cb);
+ $active_device_pos = $i;
$ipconf_first_view = 0;
}
$i++;
}
- $device_cb->signal_connect('changed' => $device_change_handler);
if (my $nic = Proxmox::Install::Config::get_mngmt_nic()) {
- $device_cb->set_active($device_active_reverse_map->{$nic} // 0);
- } else {
- $device_cb->set_active(0);
+ $active_device_pos = $device_active_reverse_map->{$nic};
}
+ $device_cb->signal_connect('changed' => $device_change_handler);
+ $device_cb->set_active($active_device_pos);
+
my $label = Gtk3::Label->new("Management Interface");
$label->set_size_request(150, -1);
$label->set_xalign(1.0);
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH installer 3/3] fix #2502: proxinstall: set cidr text manually
2024-12-17 15:23 [pve-devel] [PATCH installer 1/3] proxinstall: move device changed callback after loop Maximiliano Sandoval
2024-12-17 15:23 ` [pve-devel] [PATCH installer 2/3] proxinstall: set active element in combo box once Maximiliano Sandoval
@ 2024-12-17 15:23 ` Maximiliano Sandoval
2024-12-17 15:26 ` Maximiliano Sandoval
2025-01-30 18:12 ` [pve-devel] applied-series: [PATCH installer 1/3] proxinstall: move device changed callback after loop Thomas Lamprecht
2 siblings, 1 reply; 6+ messages in thread
From: Maximiliano Sandoval @ 2024-12-17 15:23 UTC (permalink / raw)
To: pve-devel
Instead of relying on the device_change_handler callback (which saves
the config) we manually set the text to the right value.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
proxinstall | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/proxinstall b/proxinstall
index cb74cc2..2f393f2 100755
--- a/proxinstall
+++ b/proxinstall
@@ -319,8 +319,6 @@ sub create_cidr_inputs {
return ($label, $hbox, $ip_el, $cidr_el);
}
-my $ipconf_first_view = 1;
-
my $create_basic_grid = sub {
my $grid = Gtk3::Grid->new();
$grid->set_visible(1);
@@ -392,6 +390,8 @@ sub create_ipconf_view {
};
my $active_device_pos = 0;
+ my $addr = undef;
+ my $mask = undef;
my $i = 0;
for my $index (sort keys $ipconf->{ifaces}->%*) {
@@ -404,9 +404,10 @@ sub create_ipconf_view {
);
$device_active_map->{$i} = $index;
$device_active_reverse_map->{$iface->{name}} = $i;
- if ($ipconf_first_view && $index == $ipconf->{default}) {
+ if ($index == $ipconf->{default}) {
$active_device_pos = $i;
- $ipconf_first_view = 0;
+ $addr = $iface->{inet}->{addr} || $iface->{inet6}->{addr};
+ $mask = $iface->{inet}->{prefix} || $iface->{inet6}->{prefix};
}
$i++;
}
@@ -415,8 +416,17 @@ sub create_ipconf_view {
$active_device_pos = $device_active_reverse_map->{$nic};
}
- $device_cb->signal_connect('changed' => $device_change_handler);
+ if (my $cidr = Proxmox::Install::Config::get_cidr()) {
+ my ($default_ip, $default_mask) = split('/', $cidr);
+ $addr = $default_ip if $default_ip;
+ $mask = $default_mask if $default_mask;
+ }
+
$device_cb->set_active($active_device_pos);
+ $ipconf_entry_addr->set_text($addr) if $addr;
+ $ipconf_entry_mask->set_text($mask) if $mask;
+
+ $device_cb->signal_connect('changed' => $device_change_handler);
my $label = Gtk3::Label->new("Management Interface");
$label->set_size_request(150, -1);
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pve-devel] [PATCH installer 3/3] fix #2502: proxinstall: set cidr text manually
2024-12-17 15:23 ` [pve-devel] [PATCH installer 3/3] fix #2502: proxinstall: set cidr text manually Maximiliano Sandoval
@ 2024-12-17 15:26 ` Maximiliano Sandoval
2025-01-30 14:00 ` Maximiliano Sandoval
0 siblings, 1 reply; 6+ messages in thread
From: Maximiliano Sandoval @ 2024-12-17 15:26 UTC (permalink / raw)
To: Maximiliano Sandoval; +Cc: pve-devel, Thomas Lamprecht
> Instead of relying on the device_change_handler callback (which saves
> the config) we manually set the text to the right value.
>
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
I am not completely sure if this patch series preserves the intentional
UI flow. Some testing would be welcome.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pve-devel] [PATCH installer 3/3] fix #2502: proxinstall: set cidr text manually
2024-12-17 15:26 ` Maximiliano Sandoval
@ 2025-01-30 14:00 ` Maximiliano Sandoval
0 siblings, 0 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2025-01-30 14:00 UTC (permalink / raw)
To: Maximiliano Sandoval; +Cc: pve-devel, Thomas Lamprecht
Maximiliano Sandoval <m.sandoval@proxmox.com> writes:
>> Instead of relying on the device_change_handler callback (which saves
>> the config) we manually set the text to the right value.
>>
>> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
>> ---
>
> I am not completely sure if this patch series preserves the intentional
> UI flow. Some testing would be welcome.
ping
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] applied-series: [PATCH installer 1/3] proxinstall: move device changed callback after loop
2024-12-17 15:23 [pve-devel] [PATCH installer 1/3] proxinstall: move device changed callback after loop Maximiliano Sandoval
2024-12-17 15:23 ` [pve-devel] [PATCH installer 2/3] proxinstall: set active element in combo box once Maximiliano Sandoval
2024-12-17 15:23 ` [pve-devel] [PATCH installer 3/3] fix #2502: proxinstall: set cidr text manually Maximiliano Sandoval
@ 2025-01-30 18:12 ` Thomas Lamprecht
2 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2025-01-30 18:12 UTC (permalink / raw)
To: Proxmox VE development discussion, Maximiliano Sandoval
Am 17.12.24 um 16:23 schrieb Maximiliano Sandoval:
> Otherwise the callback will run once for each NIC.
>
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
> proxinstall | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>
applied series, thanks!
I expanded the commit message of the third patch and did an s/proxinstall/gtk ui/
for all subjects. In a separate follow-up commit I also renamed the variables
used for getting the initial state to clarify that they are indeed only holding
initial state. That commit also had a tiny semantic change that I should
have split out: I only set the active value for the combobox if anything is
actually a valid one, similar to how address and mask text fields are handled,
but that should not change anything in practice I think.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-30 18:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-17 15:23 [pve-devel] [PATCH installer 1/3] proxinstall: move device changed callback after loop Maximiliano Sandoval
2024-12-17 15:23 ` [pve-devel] [PATCH installer 2/3] proxinstall: set active element in combo box once Maximiliano Sandoval
2024-12-17 15:23 ` [pve-devel] [PATCH installer 3/3] fix #2502: proxinstall: set cidr text manually Maximiliano Sandoval
2024-12-17 15:26 ` Maximiliano Sandoval
2025-01-30 14:00 ` Maximiliano Sandoval
2025-01-30 18:12 ` [pve-devel] applied-series: [PATCH installer 1/3] proxinstall: move device changed callback after loop Thomas Lamprecht
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