[PATCH rhel7-branch 1/5] Remove the existing install_options1 dialog, rename the others (#1014671).

Chris Lumens clumens at redhat.com
Wed Jan 15 20:09:33 UTC 2014


This is in preparation for making the custom partitioning spoke more
discoverable.  We won't be displaying the first option dialog anymore
since autopart users will just go straight back to the hub if there's
enough space, and if they want to do anything else they'll need to go
through custom part.
---
 pyanaconda/ui/gui/spokes/storage.glade | 286 ++++-----------------------------
 pyanaconda/ui/gui/spokes/storage.py    | 211 +++++++++++-------------
 2 files changed, 121 insertions(+), 376 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade
index cefed27..f973bc0 100644
--- a/pyanaconda/ui/gui/spokes/storage.glade
+++ b/pyanaconda/ui/gui/spokes/storage.glade
@@ -9,238 +9,6 @@
     <property name="icon-size">6</property>
   </object>
   <object class="GtkDialog" id="options1_dialog">
-    <property name="width_request">500</property>
-    <property name="height_request">200</property>
-    <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="modal">True</property>
-    <property name="window_position">center-on-parent</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="type_hint">dialog</property>
-    <property name="decorated">False</property>
-    <property name="mnemonics_visible">False</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox2">
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">6</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area2">
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="options1_cancel_button">
-                <property name="label" translatable="yes">Cancel &amp; _add more disks</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="halign">start</property>
-                <property name="border_width">6</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-                <property name="secondary">True</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="options_continue_button1">
-                <property name="label" translatable="yes">_Continue</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="has_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="border_width">6</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-                <property name="non_homogeneous">True</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkBox" id="box4">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">6</property>
-            <child>
-              <object class="GtkLabel" id="options1_title_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">INSTALLATION OPTIONS</property>
-                <attributes>
-                  <attribute name="font-desc" value="Cantarell Bold 10"/>
-                  <attribute name="weight" value="bold"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkLabel" id="options1_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="xalign">0</property>
-                <property name="label">Here we'll describe what your options are.</property>
-                <property name="wrap">True</property>
-                <attributes>
-                  <attribute name="font-desc" value="Cantarell 11"/>
-                </attributes>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkRadioButton" id="options1_autopart_radio">
-                <property name="label">Here's the autopart label.</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_underline">True</property>
-                <property name="xalign">0</property>
-                <property name="active">True</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkRadioButton" id="options1_reclaim_radio">
-                <property name="label">Here's the reclaim label.</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_underline">True</property>
-                <property name="xalign">0</property>
-                <property name="active">True</property>
-                <property name="draw_indicator">True</property>
-                <property name="group">options1_autopart_radio</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkRadioButton" id="options1_custom_radio">
-                <property name="label">Here's the custom label.</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_underline">True</property>
-                <property name="xalign">0</property>
-                <property name="active">True</property>
-                <property name="draw_indicator">True</property>
-                <property name="group">options1_autopart_radio</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">4</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkBox" id="box1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin_top">12</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkLabel" id="label3">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Partition scheme:&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkComboBoxText" id="options1_combo">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="active">3</property>
-                    <items>
-                      <item translatable="yes">Standard Partition</item>
-                      <item translatable="yes">BTRFS</item>
-                      <item translatable="yes">LVM</item>
-                      <item translatable="yes">LVM Thin Provisioning</item>
-                    </items>
-                    <signal name="changed" handler="on_type_changed" swapped="no"/>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">5</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="encryption1_checkbutton">
-                <property name="label" translatable="yes">_Encrypt my data. I'll set a passphrase later.</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="hexpand">True</property>
-                <property name="use_underline">True</property>
-                <property name="xalign">0</property>
-                <property name="draw_indicator">True</property>
-                <signal name="toggled" handler="on_encrypt_toggled" swapped="no"/>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">6</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <action-widgets>
-      <action-widget response="0">options1_cancel_button</action-widget>
-      <action-widget response="1">options_continue_button1</action-widget>
-    </action-widgets>
-  </object>
-  <object class="GtkDialog" id="options2_dialog">
     <property name="width_request">600</property>
     <property name="height_request">400</property>
     <property name="can_focus">False</property>
@@ -261,7 +29,7 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="options2_cancel_button">
+              <object class="GtkButton" id="options1_cancel_button">
                 <property name="label" translatable="yes">Cancel &amp; _add more disks</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -277,7 +45,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="options2_custom_button">
+              <object class="GtkButton" id="options1_custom_button">
                 <property name="label" translatable="yes">_Custom partitioning</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -293,7 +61,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="options2_reclaim_button">
+              <object class="GtkButton" id="options1_reclaim_button">
                 <property name="label" translatable="yes">_Reclaim space</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -324,7 +92,7 @@
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
-              <object class="GtkLabel" id="options2_title_label">
+              <object class="GtkLabel" id="options1_title_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="margin_bottom">6</property>
@@ -342,7 +110,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="options2_label1">
+              <object class="GtkLabel" id="options1_label1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -368,7 +136,7 @@
                 <property name="column_spacing">6</property>
                 <property name="row_homogeneous">True</property>
                 <child>
-                  <object class="GtkLabel" id="options2_disk_free_label">
+                  <object class="GtkLabel" id="options1_disk_free_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="xalign">1</property>
@@ -386,7 +154,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="options2_disk_free_desc_label">
+                  <object class="GtkLabel" id="options1_disk_free_desc_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="xalign">0</property>
@@ -404,7 +172,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="options2_fs_free_label">
+                  <object class="GtkLabel" id="options1_fs_free_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="xalign">1</property>
@@ -422,7 +190,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="options2_fs_free_desc_label">
+                  <object class="GtkLabel" id="options1_fs_free_desc_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="xalign">0</property>
@@ -447,7 +215,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="options2_label2">
+              <object class="GtkLabel" id="options1_label2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -483,7 +251,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBoxText" id="options2_combo">
+                  <object class="GtkComboBoxText" id="options1_combo">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="active">3</property>
@@ -509,7 +277,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkCheckButton" id="encryption2_checkbutton">
+              <object class="GtkCheckButton" id="encryption1_checkbutton">
                 <property name="label" translatable="yes">_Encrypt my data. I'll set a passphrase later.</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -536,12 +304,12 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="0">options2_cancel_button</action-widget>
-      <action-widget response="5">options2_custom_button</action-widget>
-      <action-widget response="3">options2_reclaim_button</action-widget>
+      <action-widget response="0">options1_cancel_button</action-widget>
+      <action-widget response="5">options1_custom_button</action-widget>
+      <action-widget response="3">options1_reclaim_button</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkDialog" id="options3_dialog">
+  <object class="GtkDialog" id="options2_dialog">
     <property name="width_request">400</property>
     <property name="height_request">300</property>
     <property name="can_focus">False</property>
@@ -562,7 +330,7 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="options3_quit_button">
+              <object class="GtkButton" id="options2_quit_button">
                 <property name="label" translatable="yes">_Quit installer</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -578,7 +346,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="options3_cancel_button">
+              <object class="GtkButton" id="options2_cancel_button">
                 <property name="label" translatable="yes">_Cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -609,7 +377,7 @@
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
-              <object class="GtkLabel" id="options3_title_label">
+              <object class="GtkLabel" id="options2_title_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="margin_bottom">6</property>
@@ -626,7 +394,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="options3_label1">
+              <object class="GtkLabel" id="options2_label1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -652,7 +420,7 @@
                 <property name="column_spacing">6</property>
                 <property name="row_homogeneous">True</property>
                 <child>
-                  <object class="GtkLabel" id="options3_disk_free_label">
+                  <object class="GtkLabel" id="options2_disk_free_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="xalign">1</property>
@@ -669,7 +437,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="options3_disk_free_desc_label1">
+                  <object class="GtkLabel" id="options2_disk_free_desc_label1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="xalign">0</property>
@@ -687,7 +455,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="options3_fs_free_label">
+                  <object class="GtkLabel" id="options2_fs_free_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="xalign">1</property>
@@ -705,7 +473,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="options3_fs_free_desc_label">
+                  <object class="GtkLabel" id="options2_fs_free_desc_label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="xalign">0</property>
@@ -730,7 +498,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="options3_label2">
+              <object class="GtkLabel" id="options2_label2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -756,8 +524,8 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="4">options3_quit_button</action-widget>
-      <action-widget response="0">options3_cancel_button</action-widget>
+      <action-widget response="4">options2_quit_button</action-widget>
+      <action-widget response="0">options2_cancel_button</action-widget>
     </action-widgets>
   </object>
   <object class="GtkListStore" id="specialized_disk_store">
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 023dc96..1d9c755 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -1,6 +1,6 @@
 # Storage configuration spoke classes
 #
-# Copyright (C) 2011, 2012  Red Hat, Inc.
+# Copyright (C) 2011-2013  Red Hat, Inc.
 #
 # This copyrighted material is made available to anyone wishing to use,
 # modify, copy, or redistribute it subject to the terms and conditions of
@@ -17,6 +17,7 @@
 # Red Hat, Inc.
 #
 # Red Hat Author(s): David Lehman <dlehman at redhat.com>
+#                    Chris Lumens <clumens at redhat.com>
 #
 
 """
@@ -53,7 +54,6 @@ from pyanaconda.ui.gui.categories.system import SystemCategory
 from pyanaconda.ui.gui.utils import enlightbox, gtk_call_once, gtk_action_wait
 
 from pyanaconda.kickstart import doKickstartStorage, getAvailableDiskSpace
-from blivet import empty_device
 from blivet.size import Size
 from blivet.devices import MultipathDevice
 from blivet.errors import StorageError
@@ -76,97 +76,43 @@ log = logging.getLogger("anaconda")
 
 __all__ = ["StorageSpoke"]
 
-class InstallOptions1Dialog(GUIObject):
-    builderObjects = ["options1_dialog"]
-    mainWidgetName = "options1_dialog"
+# Response ID codes for all the various buttons on all the dialogs.
+RESPONSE_CANCEL = 0
+RESPONSE_CONTINUE = 1
+RESPONSE_MODIFY_SW = 2
+RESPONSE_RECLAIM = 3
+RESPONSE_QUIT = 4
+RESPONSE_CUSTOM = 5
+
+# Which radiobutton is selected on the options1 dialog?
+RESPONSE_CONTINUE_NONE = -1
+RESPONSE_CONTINUE_AUTOPART = 0
+RESPONSE_CONTINUE_RECLAIM = 1
+RESPONSE_CONTINUE_CUSTOM = 2
+
+class InstallOptionsDialogBase(GUIObject):
     uiFile = "spokes/storage.glade"
 
-    # Response ID codes for all the various buttons on all the dialogs.
-    RESPONSE_CANCEL = 0
-    RESPONSE_CONTINUE = 1
-    RESPONSE_MODIFY_SW = 2
-    RESPONSE_RECLAIM = 3
-    RESPONSE_QUIT = 4
-    RESPONSE_CUSTOM = 5
-
-    # Which radiobutton is selected on the options1 dialog?
-    RESPONSE_CONTINUE_NONE = -1
-    RESPONSE_CONTINUE_AUTOPART = 0
-    RESPONSE_CONTINUE_RECLAIM = 1
-    RESPONSE_CONTINUE_CUSTOM = 2
-
     def __init__(self, *args, **kwargs):
         self.payload = kwargs.pop("payload", None)
-        self.showReclaim = kwargs.pop("showReclaim", None)
         GUIObject.__init__(self, *args, **kwargs)
 
+        self.autoPartType = None
+        self.encrypted = False
+
+        self._grabObjects()
+
+    def _grabObjects(self):
+        pass
+
     def run(self):
         rc = self.window.run()
         self.window.destroy()
         return rc
 
-    def refresh(self, required_space, auto_swap, disk_free, fs_free, autoPartType, encrypted):
-        self.autoPartType = autoPartType
-        self.autoPartTypeCombo = self.builder.get_object("options1_combo")
-        self.autoPartTypeCombo.set_active(self.autoPartType)
-
-        self.encrypted = encrypted
-        self.encryptCheckbutton = self.builder.get_object("encryption1_checkbutton")
-        self.encryptCheckbutton.set_active(self.encrypted)
-
-        options_label = self.builder.get_object("options1_label")
-
-        options_text = _("You have <b>%(freeSpace)s</b> of free space, which is "
-                         "enough to install %(productName)s.  What would you "
-                         "like to do?") % {"freeSpace": disk_free, "productName": productName}
-        options_label.set_markup(options_text)
-
-        label = self.builder.get_object("options1_autopart_radio").get_children()[0]
-        label.set_markup(_("<span font-desc=\"Cantarell 11\">A_utomatically "
-                           "configure my %(productName)s installation to the "
-                           "disk(s) I selected and return me to the main "
-                           "menu.</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 "
-                           "my disk partitions before continuing.</span>"))
-        label.set_line_wrap(True)
-        label.set_use_underline(True)
-
-    @property
-    def continue_response(self):
-        if self.builder.get_object("options1_autopart_radio").get_active():
-            return self.RESPONSE_CONTINUE_AUTOPART
-        elif self.builder.get_object("options1_reclaim_radio").get_active():
-            return self.RESPONSE_CONTINUE_RECLAIM
-        elif self.builder.get_object("options1_custom_radio").get_active():
-            return self.RESPONSE_CONTINUE_CUSTOM
-        else:
-            return self.RESPONSE_CONTINUE_NONE
-
-    def _set_free_space_labels(self, disk_free, fs_free):
-        disk_free_text = size_str(disk_free)
-        self.disk_free_label.set_text(disk_free_text)
-
-        fs_free_text = size_str(fs_free)
-        self.fs_free_label.set_text(fs_free_text)
-
     def _modify_sw_link_clicked(self, label, uri):
         if self._software_is_ready():
-            self.window.response(self.RESPONSE_MODIFY_SW)
+            self.window.response(RESPONSE_MODIFY_SW)
 
         return True
 
@@ -215,29 +161,40 @@ class InstallOptions1Dialog(GUIObject):
     def on_encrypt_toggled(self, checkbox):
         self.encrypted = checkbox.get_active()
 
-class InstallOptions2Dialog(InstallOptions1Dialog):
-    builderObjects = ["options2_dialog"]
-    mainWidgetName = "options2_dialog"
+class InstallOptions1Dialog(InstallOptionsDialogBase):
+    builderObjects = ["options1_dialog"]
+    mainWidgetName = "options1_dialog"
 
+    def _grabObjects(self):
+        self.autoPartTypeCombo = self.builder.get_object("options1_combo")
+        self.encryptCheckbutton = self.builder.get_object("encryption1_checkbutton")
+        self.disk_free_label = self.builder.get_object("options1_disk_free_label")
+        self.fs_free_label = self.builder.get_object("options1_fs_free_label")
+
+    def _set_free_space_labels(self, disk_free, fs_free):
+        self.disk_free_label.set_text(str(disk_free))
+        self.fs_free_label.set_text(str(fs_free))
+
+    # pylint: disable-msg=W0221
     def refresh(self, required_space, auto_swap, disk_free, fs_free, autoPartType, encrypted):
         self.autoPartType = autoPartType
-        self.autoPartTypeCombo = self.builder.get_object("options2_combo")
+        self.autoPartTypeCombo = self.builder.get_object("options1_combo")
         self.autoPartTypeCombo.set_active(self.autoPartType)
 
         self.encrypted = encrypted
-        self.encryptCheckbutton = self.builder.get_object("encryption2_checkbutton")
+        self.encryptCheckbutton = self.builder.get_object("encryption1_checkbutton")
         self.encryptCheckbutton.set_active(self.encrypted)
 
         sw_text = self._get_sw_needs_text(required_space, auto_swap)
         label_text = _("%s The disks you've selected have the following "
                        "amounts of free space:") % sw_text
-        label = self.builder.get_object("options2_label1")
+        label = self.builder.get_object("options1_label1")
         label.set_markup(label_text)
         label.set_tooltip_text(_("Please wait... software metadata still loading."))
         label.connect("activate-link", self._modify_sw_link_clicked)
 
-        self.disk_free_label = self.builder.get_object("options2_disk_free_label")
-        self.fs_free_label = self.builder.get_object("options2_fs_free_label")
+        self.disk_free_label = self.builder.get_object("options1_disk_free_label")
+        self.fs_free_label = self.builder.get_object("options1_fs_free_label")
         self._set_free_space_labels(disk_free, fs_free)
 
         label_text = _("<b>You don't have enough space available to install "
@@ -245,31 +202,40 @@ class InstallOptions2Dialog(InstallOptions1Dialog):
                        "via our guided reclaim space tool, or you can adjust your "
                        "partitions on your own in the custom partitioning "
                        "interface.") % productName
-        self.builder.get_object("options2_label2").set_markup(label_text)
+        self.builder.get_object("options1_label2").set_markup(label_text)
 
-        self._add_modify_watcher("options2_label1")
+        self._add_modify_watcher("options1_label1")
 
     @property
     def continue_response(self):
-        return self.RESPONSE_CONTINUE_NONE
+        return RESPONSE_CONTINUE_NONE
+
+class InstallOptions2Dialog(InstallOptionsDialogBase):
+    builderObjects = ["options2_dialog"]
+    mainWidgetName = "options2_dialog"
 
-class InstallOptions3Dialog(InstallOptions1Dialog):
-    builderObjects = ["options3_dialog"]
-    mainWidgetName = "options3_dialog"
+    def _grabObjects(self):
+        self.disk_free_label = self.builder.get_object("options2_disk_free_label")
+        self.fs_free_label = self.builder.get_object("options2_fs_free_label")
+
+    def _set_free_space_labels(self, disk_free, fs_free):
+        self.disk_free_label.set_text(str(disk_free))
+        self.fs_free_label.set_text(str(fs_free))
 
+    # pylint: disable-msg=W0221
     def refresh(self, required_space, auto_swap, disk_free, fs_free, autoPartType, encrypted):
         sw_text = self._get_sw_needs_text(required_space, auto_swap)
         label_text = (_("%(sw_text)s You don't have enough space available to install "
                         "<b>%(product)s</b>, even if you used all of the free space "
                         "available on the selected disks.")
                       % {"sw_text": sw_text, "product": productName})
-        label = self.builder.get_object("options3_label1")
+        label = self.builder.get_object("options2_label1")
         label.set_markup(label_text)
         label.set_tooltip_text(_("Please wait... software metadata still loading."))
         label.connect("activate-link", self._modify_sw_link_clicked)
 
-        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.disk_free_label = self.builder.get_object("options2_disk_free_label")
+        self.fs_free_label = self.builder.get_object("options2_fs_free_label")
         self._set_free_space_labels(disk_free, fs_free)
 
         label_text = _("<b>You don't have enough space available to install "
@@ -278,13 +244,13 @@ class InstallOptions3Dialog(InstallOptions1Dialog):
                        "disks for additional space, "
                        "modify your software selection to install a smaller "
                        "version of <b>%s</b>, or quit the installer.") % (productName, productName)
-        self.builder.get_object("options3_label2").set_markup(label_text)
+        self.builder.get_object("options2_label2").set_markup(label_text)
 
-        self._add_modify_watcher("options3_label1")
+        self._add_modify_watcher("options2_label1")
 
     @property
     def continue_response(self):
-        return self.RESPONSE_CONTINUE_NONE
+        return RESPONSE_CONTINUE_NONE
 
 class StorageChecker(object):
     errors = []
@@ -839,42 +805,49 @@ 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:
-            showReclaim = not all(map(lambda dev: empty_device(dev, self.storage.devicetree),
-                                      self.disks))
-            dialog = InstallOptions1Dialog(self.data, showReclaim=showReclaim)
+            dialog = None
         elif disks_size >= required_space:
-            dialog = InstallOptions2Dialog(self.data, payload=self.payload)
+            dialog = InstallOptions1Dialog(self.data, payload=self.payload)
+            dialog.refresh(required_space, auto_swap, disk_free, fs_free, self.autoPartType,
+                           self.encrypted)
+            rc = self.run_lightbox_dialog(dialog)
         else:
-            dialog = InstallOptions3Dialog(self.data, payload=self.payload)
+            dialog = InstallOptions2Dialog(self.data, payload=self.payload)
+            dialog.refresh(required_space, auto_swap, disk_free, fs_free, self.autoPartType,
+                           self.encrypted)
+            rc = self.run_lightbox_dialog(dialog)
 
-        dialog.refresh(required_space, auto_swap, disk_free, fs_free, self.autoPartType,
-                       self.encrypted)
-        rc = self.run_lightbox_dialog(dialog)
-        if rc == dialog.RESPONSE_CONTINUE:
+        if not dialog:
+            self.autopart = True
+        elif rc == RESPONSE_CONTINUE:
             self.autoPartType = dialog.autoPartType
             self.encrypted = dialog.encrypted
 
             if not self._check_encrypted():
                 return
 
-            if dialog.continue_response == dialog.RESPONSE_CONTINUE_AUTOPART:
+            if dialog.continue_response == RESPONSE_CONTINUE_AUTOPART:
                 self.autopart = True
-            elif dialog.continue_response == dialog.RESPONSE_CONTINUE_RECLAIM:
+            elif dialog.continue_response == RESPONSE_CONTINUE_RECLAIM:
                 self.apply()
                 if not self._show_resize_dialog(disks):
                     # User pressed cancel on the reclaim dialog, so don't leave
                     # the storage spoke.
                     return
-            elif dialog.continue_response == dialog.RESPONSE_CONTINUE_CUSTOM:
+
+                # if the user did not press cancel that means they want to
+                # proceed with autopart
+                self.autopart = True
+            elif dialog.continue_response == RESPONSE_CONTINUE_CUSTOM:
                 self.autopart = False
                 self.skipTo = "CustomPartitioningSpoke"
-        elif rc == dialog.RESPONSE_CANCEL:
+        elif rc == RESPONSE_CANCEL:
             # stay on this spoke
             return
-        elif rc == dialog.RESPONSE_MODIFY_SW:
+        elif rc == RESPONSE_MODIFY_SW:
             # go to software spoke
             self.skipTo = "SoftwareSelectionSpoke"
-        elif rc == dialog.RESPONSE_RECLAIM:
+        elif rc == RESPONSE_RECLAIM:
             self.autoPartType = dialog.autoPartType
             self.encrypted = dialog.encrypted
 
@@ -886,9 +859,13 @@ class StorageSpoke(NormalSpoke, StorageChecker):
                 # User pressed cancel on the reclaim dialog, so don't leave
                 # the storage spoke.
                 return
-        elif rc == dialog.RESPONSE_QUIT:
+
+            # if the user did not press cancel that means they want to
+            # proceed with autopart
+            self.autopart = True
+        elif rc == RESPONSE_QUIT:
             raise SystemExit("user-selected exit")
-        elif rc == dialog.RESPONSE_CUSTOM:
+        elif rc == RESPONSE_CUSTOM:
             self.autopart = False
             self.autoPartType = dialog.autoPartType
             self.encrypted = dialog.encrypted
-- 
1.8.3.1



More information about the anaconda-patches mailing list