[anaconda:master 4/7] Omit calculation and use of active_dev_type.

mulhern amulhern at redhat.com
Mon Oct 13 21:16:01 UTC 2014


It is only calculated for logging.

itr is only used to calculate active_dev_type, so get rid of that
calculation as well.

Note that the calculation of active_dev_type is mostly a copy of the body
of _get_current_device_type(), except that it uses combo, instead of
self._typeCombo. But, for the method to make any sense, combo must
be self._typeCombo, so put that in the preconditions.

Since it is nicer to print readable names than integer codes, though,
use get_current_device_type_name() to get that name and use in log.debug
statement.

Then transform it to integer code for blivet method calls.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 pyanaconda/ui/gui/spokes/custom.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 75e4baf..01f1508 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -2513,16 +2513,19 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         fancy_set_sensitive(self._fsCombo, self._reformatCheckbox.get_active() and device_type != DEVICE_TYPE_BTRFS)
 
     def on_device_type_changed(self, combo):
-        if not self._initialized:
+        if combo is not self._typeCombo:
             return
 
-        new_type = self._get_current_device_type()
-        itr = combo.get_active_iter()
-        if not itr:
+        if not self._initialized:
             return
 
-        active_dev_type = self._typeStore[itr]
-        log.debug("device_type_changed: %s %s", new_type, active_dev_type)
+        # The name of the device type is more informative than the numeric id
+        new_type = self._get_current_device_type_name()
+        log.debug("device_type_changed: %s", new_type)
+
+        # But the numeric id of the device is what is needed by blivet
+        new_type = dev_type_from_const(new_type)
+
         if new_type is None:
             return
 
-- 
1.9.3



More information about the anaconda-patches mailing list