[PATCH 1/3] Add a page to the custom RHS notebook for uneditable devices. (#875942)

David Lehman dlehman at redhat.com
Tue Nov 20 18:55:54 UTC 2012


The obvious example is a VG with no LVs, which could happen because it
actually has no LVs or because only some of its encrypted PVs have been
unlocked.

This may end up being how we handle degraded md and incomplete lvm in
the future.
---
 pyanaconda/ui/gui/spokes/custom.glade |   89 ++++++++++++++++++++++++++++++++-
 pyanaconda/ui/gui/spokes/custom.py    |   21 +++++++-
 2 files changed, 106 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade
index 9398b06..70ec694 100644
--- a/pyanaconda/ui/gui/spokes/custom.glade
+++ b/pyanaconda/ui/gui/spokes/custom.glade
@@ -1191,7 +1191,7 @@ you'll be able to view their details here.</property>
                           <placeholder/>
                         </child>
                         <child>
-                          <object class="GtkBox" id="box5">
+                          <object class="GtkBox" id="encryptedDeviceBox">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="orientation">vertical</property>
@@ -1332,6 +1332,93 @@ you'll be able to view their details here.</property>
                         <child type="tab">
                           <placeholder/>
                         </child>
+                        <child>
+                          <object class="GtkBox" id="uneditableDeviceBox">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="orientation">vertical</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <object class="GtkBox" id="box17">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">6</property>
+                                <child>
+                                  <object class="GtkLabel" id="uneditableDeviceLabel">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label" translatable="yes">Selected Device</property>
+                                    <attributes>
+                                      <attribute name="font-desc" value="Cantarell Bold 10"/>
+                                      <attribute name="weight" value="bold"/>
+                                      <attribute name="scale" value="1.2"/>
+                                    </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="uneditableDeviceDescriptionLabel">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="halign">end</property>
+                                    <property name="label" translatable="yes">Device description</property>
+                                    <attributes>
+                                      <attribute name="font-desc" value="Cantarell Italic 10"/>
+                                      <attribute name="style" value="italic"/>
+                                    </attributes>
+                                  </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">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSeparator" id="separator3">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="uneditableDeviceOptionsLabel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">This device cannot be edited directly. You can remove it or select a different device.</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">2</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="position">3</property>
+                          </packing>
+                        </child>
+                        <child type="tab">
+                          <placeholder/>
+                        </child>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 515a9a7..a4097aa 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -89,6 +89,7 @@ __all__ = ["CustomPartitioningSpoke"]
 NOTEBOOK_LABEL_PAGE = 0
 NOTEBOOK_DETAILS_PAGE = 1
 NOTEBOOK_LUKS_PAGE = 2
+NOTEBOOK_UNEDITABLE_PAGE = 3
 
 new_install_name = N_("New %s %s Installation") % (productName, productVersion)
 unrecoverable_error_msg = N_("Storage configuration reset due to unrecoverable "
@@ -800,9 +801,12 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             # just-removed device
             return
 
+        if self._partitionsNotebook.get_current_page() != NOTEBOOK_DETAILS_PAGE:
+            return
+
         log.info("ui: saving changes to device %s" % device.name)
 
-        # TODO: member type, disk set
+        # TODO: member type
 
         size = self.builder.get_object("sizeSpinner").get_value()
         log.debug("new size: %s" % size)
@@ -1814,7 +1818,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             log.debug("new selector: %s" % selector._device)
             nb_page = self._partitionsNotebook.get_current_page()
             log.debug("notebook page = %s" % nb_page)
-            if nb_page != NOTEBOOK_LUKS_PAGE:
+            if nb_page == NOTEBOOK_DETAILS_PAGE:
                 self._save_right_side(self._current_selector)
 
             self._current_selector.set_chosen(False)
@@ -1831,6 +1835,17 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
             self._configButton.set_sensitive(False)
             self._removeButton.set_sensitive(True)
             return
+        elif getDeviceType(selector._device) is None:
+            self._partitionsNotebook.set_current_page(NOTEBOOK_UNEDITABLE_PAGE)
+            selectedDeviceLabel = self.builder.get_object("uneditableDeviceLabel")
+            selectedDeviceDescLabel = self.builder.get_object("uneditableDeviceDescriptionLabel")
+            selectedDeviceLabel.set_text(selector._device.name)
+            selectedDeviceDescLabel.set_text(self._description(selector._device.type))
+            selector.set_chosen(True)
+            self._current_selector = selector
+            self._configButton.set_sensitive(False)
+            self._removeButton.set_sensitive(True)
+            return
 
         # Make sure we're showing details instead of the "here's how you create
         # a new OS" label.
@@ -1853,7 +1868,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         if self._current_selector:
             nb_page = self._partitionsNotebook.get_current_page()
             log.debug("notebook page = %s" % nb_page)
-            if nb_page != NOTEBOOK_LUKS_PAGE:
+            if nb_page == NOTEBOOK_DETAILS_PAGE:
                 self._save_right_side(self._current_selector)
 
             self._current_selector.set_chosen(False)
-- 
1.7.7.6



More information about the anaconda-patches mailing list