[PATCH 2/3] If you cannot reclaim more space, don't show the reclaim radio (#911791).

Chris Lumens clumens at redhat.com
Mon Feb 18 15:51:40 UTC 2013


The primary case for this is if you've got initially all blank disks, though
you'd also hit it if you first went through reclaim and deleted everything,
then went back to the install options dialogs.
---
 anaconda.spec.in                    |  2 +-
 pyanaconda/ui/gui/spokes/storage.py | 22 +++++++++++++++-------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/anaconda.spec.in b/anaconda.spec.in
index 7755fe8..f3efd83 100644
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -69,7 +69,7 @@ BuildRequires: s390utils-devel
 %endif
 
 Requires: anaconda-widgets = %{version}-%{release}
-Requires: python-blivet
+Requires: python-blivet >= 0.6
 Requires: gnome-icon-theme-symbolic
 Requires: python-meh >= %{mehver}
 Requires: libreport-anaconda >= 2.0.21-1
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 5854404..c52eb8d 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -51,6 +51,7 @@ from pyanaconda.ui.gui.categories.storage import StorageCategory
 from pyanaconda.ui.gui.utils import enlightbox, gtk_call_once, gtk_thread_wait
 
 from pyanaconda.kickstart import doKickstartStorage
+from blivet import empty_device
 from blivet.size import Size
 from blivet.errors import StorageError
 from blivet.platform import platform
@@ -140,6 +141,7 @@ class InstallOptions1Dialog(GUIObject):
 
     def __init__(self, *args, **kwargs):
         self.payload = kwargs.pop("payload", None)
+        self.showReclaim = kwargs.pop("showReclaim", None)
         GUIObject.__init__(self, *args, **kwargs)
 
     def run(self):
@@ -171,12 +173,16 @@ class InstallOptions1Dialog(GUIObject):
         label.set_line_wrap(True)
         label.set_use_underline(True)
 
-        label = self.builder.get_object("options1_reclaim_radio").get_children()[0]
-        label.set_markup(_("<span font-desc=\"Cantarell 11\">I want more space. "
-                           "_Guide me through shrinking and/or removing partitions "
-                           "so I can have more space for %(productName)s.</span>") % {"productName": productName})
-        label.set_line_wrap(True)
-        label.set_use_underline(True)
+        radio = self.builder.get_object("options1_reclaim_radio")
+        if self.showReclaim:
+            label = radio.get_children()[0]
+            label.set_markup(_("<span font-desc=\"Cantarell 11\">I want more space. "
+                               "_Guide me through shrinking and/or removing partitions "
+                               "so I can have more space for %(productName)s.</span>") % {"productName": productName})
+            label.set_line_wrap(True)
+            label.set_use_underline(True)
+        else:
+            radio.hide()
 
         label = self.builder.get_object("options1_custom_radio").get_children()[0]
         label.set_markup(_("<span font-desc=\"Cantarell 11\">I want to review/_modify "
@@ -747,7 +753,9 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         log.debug("disk free: %s  fs free: %s  sw needs: %s  auto swap: %s"
                         % (disk_free, fs_free, required_space, auto_swap))
         if disk_free >= required_space + auto_swap:
-            dialog = InstallOptions1Dialog(self.data)
+            showReclaim = not all(map(lambda dev: empty_device(dev, self.storage.devicetree),
+                                      self.disks))
+            dialog = InstallOptions1Dialog(self.data, showReclaim=showReclaim)
         elif disks_size >= required_space:
             dialog = InstallOptions2Dialog(self.data, payload=self.payload)
         else:
-- 
1.8.1.2



More information about the anaconda-patches mailing list