filesystem: evaluate only once the status of the raid / LVM creation button

When refreshing the filesystem GUI, we used to set the status (i.e.,
enabled or disabled) of the "Create LVM volume group" and "Create
software RAID" buttons multiple times ; once for each disk found.

When multiple disks are listed, this creates intermediate status changes
that are not wanted, e.g.:
 * "Create software RAID" button gets set to disabled after finding a first
unpartitioned disk ;
 * "Create software RAID" button is set again to disabled after finding
   a partitioned disk (with no unmounted partitions) ;
 * "Create software RAID" button is set to enabled after finding a
   second unpartitioned disk.

Fixed by evaluating the status of the buttons only once after looping
through all disks.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2022-04-05 11:42:15 +02:00
parent 1e833a5402
commit c8c5eb501c
1 changed files with 2 additions and 2 deletions

View File

@ -516,8 +516,8 @@ class FilesystemView(BaseView):
raid_devices.add(p)
if p.ok_for_lvm_vg:
lvm_devices.add(p)
self._create_raid_btn.enabled = len(raid_devices) > 1
self._create_vg_btn.enabled = len(lvm_devices) > 0
self._create_raid_btn.enabled = len(raid_devices) > 1
self._create_vg_btn.enabled = len(lvm_devices) > 0
self.mount_list.refresh_model_inputs()
self.avail_list.refresh_model_inputs()
self.used_list.refresh_model_inputs()