From 6d6bf8e2524f7e104feb7e0c1be610a3d2b8586c Mon Sep 17 00:00:00 2001
From: David Lehman <dlehman@redhat.com>
Date: Fri, 6 Jan 2012 12:43:14 -0600
Subject: [PATCH 5/6] Various cleanups to install destination spoke.

- add description to FakeDisk
- use disk.description in DiskOverview instead of vendor+model
- fix conditional for choosing between install options dialogs 2, 3
- change bold text in install options dialogs to match mockups
- include disk name and serial in tooltip for DiskOverview
- change fake sw space req to 12000MB to add options given fake disks
---
 pyanaconda/ui/gui/spokes/storage.py |   35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index d7972be..dba34a9 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -73,6 +73,10 @@ class FakeDisk(object):
         self.model = model
         self.removable = removable
 
+    @property
+    def description(self):
+        return "%s %s" % (self.vendor, self.model)
+
 def getDisks(devicetree, fake=False):
     if not fake:
         disks = [d for d in devicetree.devices if d.isDisk and
@@ -259,7 +263,7 @@ class InstallOptions1Dialog(UIObject):
 
     def _get_sw_needs_text(self, required_space):
         required_space_text = Size(spec="%dmb" % required_space).humanReadable().upper()
-        sw_text = (_("Your current %s software selection requires "
+        sw_text = (_("Your current <b>%s</b> software selection requires "
                       "<b>%s</b> of available space.")
                    % (productName, required_space_text))
         return sw_text
@@ -309,8 +313,8 @@ class InstallOptions2Dialog(InstallOptions1Dialog):
         self.fs_free_label = self.builder.get_object("options2_fs_free_label")
         self._set_free_space_labels(disk_free, fs_free)
 
-        label_text = (_("You don't have enough space available to install "
-                        "<b>%s</b>, but we can help you reclaim space by "
+        label_text = (_("<b>You don't have enough space available to install "
+                        "%s</b>, but we can help you reclaim space by "
                         "shrinking or removing existing partitions.")
                       % productName)
         self.builder.get_object("options2_label2").set_markup(label_text)
@@ -326,18 +330,19 @@ class InstallOptions3Dialog(InstallOptions1Dialog):
 
     def setup(self, required_space, disk_free, fs_free):
         sw_text = self._get_sw_needs_text(required_space)
-        label_text = _("%s\nYou don't have enough space available to install "
-                       "%s, even if you used all of the free space available "
-                       "on the selected disks.") % (sw_text, productName)
+        label_text = (_("%s\nYou don't have enough space available to install "
+                        "<b>%s</b>, even if you used all of the free space "
+                        "available on the selected disks.")
+                      % (sw_text, productName))
         self.builder.get_object("options3_label1").set_markup(label_text)
 
         self.disk_free_label = self.builder.get_object("options3_disk_free_label")
         self.fs_free_label = self.builder.get_object("options3_fs_free_label")
         self._set_free_space_labels(disk_free, fs_free)
 
-        label_text = _("You don't have enough space available to install "
-                       "<b>%s</b>, even if you used all of the free space "
-                       "available on the selected disks. You could add more "
+        label_text = _("<b>You don't have enough space available to install "
+                       "%s</b>, even if you used all of the free space "
+                       "available on the selected disks.You could add more "
                        "disks for additional space, modify your software "
                        "selection to install a smaller version of <b>%s</b>, "
                        "or quit the installer.") % (productName, productName)
@@ -396,12 +401,12 @@ class StorageSpoke(NormalSpoke):
             else:
                 kind = "drive-harddisk"
 
-            description = "%s %s" % (disk.vendor, disk.model)
             size = Size(spec="%dmb" % disk.size).humanReadable().upper()
-            overview = AnacondaWidgets.DiskOverview(description,
+            popup_info = "%s | %s" % (disk.name, disk.serial)
+            overview = AnacondaWidgets.DiskOverview(disk.description,
                                                     kind,
                                                     size,
-                                                    popup=disk.name)
+                                                    popup=popup_info)
             local_disks_box.add(overview)
 
             # FIXME: this will need to get smarter
@@ -469,10 +474,8 @@ class StorageSpoke(NormalSpoke):
 
         # update the UI to reflect changes to self.data.ignoredisk.onlyuse
         overviews = self.builder.get_object("local_disks_box").get_children()
-        print "onlyuse is %s" % self.data.ignoredisk.onlyuse
         for overview in overviews:
             name = overview.get_property("popup-info")
-            print "looking at DO for %s" % name
             overview.set_selected(name in self.data.ignoredisk.onlyuse)
         self._update_summary()
 
@@ -487,10 +490,10 @@ class StorageSpoke(NormalSpoke):
         # show the installation options dialog
         disks = [d for d in self.disks if d.name in self.data.ignoredisk.onlyuse]
         (disk_free, fs_free) = get_free_space_info(disks, self.devicetree)
-        required_space = 16000      # TODO: find out where to get this
+        required_space = 12000      # TODO: find out where to get this
         if disk_free >= required_space:
             dialog = InstallOptions1Dialog(self.data)
-        elif disk_free + fs_free >= required_space:
+        elif sum([d.size for d in disks]) >= required_space:
             dialog = InstallOptions2Dialog(self.data)
         else:
             dialog = InstallOptions3Dialog(self.data)
-- 
1.7.8

