From 0cb477c5146280b6db98bedc3a7dc9d374457aa1 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 27 Feb 2013 15:28:51 -0500 Subject: Modify the logic that makes the reclaim button sensitive (#911793). This dialog now serves two different purposes: (1) You do not have enough free space, and need to make some before you can continue to install. (2) You do have enough free space but want to free up additional space. Because the button is labeled "Reclaim space", we only want to allow clicking on it if you have chosen some destructive action. Buttons should be labeled with what they do, after all. However, we also want to take into account any free space that may already exist on disk when considering whether you have enough to continue. --- pyanaconda/ui/gui/spokes/lib/resize.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py index 4bb25cf51..7baf8941e 100644 --- a/pyanaconda/ui/gui/spokes/lib/resize.py +++ b/pyanaconda/ui/gui/spokes/lib/resize.py @@ -114,6 +114,7 @@ class ResizeDialog(GUIObject): totalDisks = 0 totalReclaimableSpace = 0 + self._initialFreeSpace = Size(0) self._selectedReclaimableSpace = 0 canShrinkSomething = False @@ -180,6 +181,7 @@ class ResizeDialog(GUIObject): False, self._get_tooltip(disk), float(converted)]) + self._initialFreeSpace += diskFree # And then go back and fill in the total reclaimable space for the # disk, now that we know what each partition has reclaimable. @@ -249,8 +251,13 @@ class ResizeDialog(GUIObject): self._deleteButton.set_sensitive(False) def _update_reclaim_button(self, got): + # The reclaim button is sensitive if two conditions are met: + # (1) There's enough available space (existing free/unpartitioned space, + # shrink space, etc.) on all disks. + # (2) At least one destructive action has been chosen. We can detect + # this by checking whether got is non-zero. need = self.payload.spaceRequired - self._resizeButton.set_sensitive(got >= need) + self._resizeButton.set_sensitive(got+self._initialFreeSpace >= need and got > Size(0)) def refresh(self, disks): super(ResizeDialog, self).refresh() -- cgit