summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2013-02-27 15:28:51 -0500
committerChris Lumens <clumens@redhat.com>2013-02-28 08:46:58 -0500
commit0cb477c5146280b6db98bedc3a7dc9d374457aa1 (patch)
tree116084467d6669571a1075e46e685686c92a0f63
parent16e7cd0cacbeeecb50b4e52b32325c0786ae2d7d (diff)
downloadanaconda-0cb477c5146280b6db98bedc3a7dc9d374457aa1.tar.gz
anaconda-0cb477c5146280b6db98bedc3a7dc9d374457aa1.tar.xz
anaconda-0cb477c5146280b6db98bedc3a7dc9d374457aa1.zip
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.
-rw-r--r--pyanaconda/ui/gui/spokes/lib/resize.py9
1 files changed, 8 insertions, 1 deletions
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()