summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2006-11-01 19:58:28 +0000
committerChris Lumens <clumens@redhat.com>2006-11-01 19:58:28 +0000
commit5890ea5da91b86345943ee4ada2608f70ee5711b (patch)
treeeaf28d41bbc7faae01ac9484495199e7e231e3a3
parent0e823f745ec7386b2b6d5e4a7f4d9c5fb25e4de6 (diff)
downloadanaconda-5890ea5da91b86345943ee4ada2608f70ee5711b.tar.gz
anaconda-5890ea5da91b86345943ee4ada2608f70ee5711b.tar.xz
anaconda-5890ea5da91b86345943ee4ada2608f70ee5711b.zip
Always set an active value on the peCombo, and don't traceback if the default
value is the first one in the list (#212317).
-rw-r--r--ChangeLog4
-rw-r--r--iw/lvm_dialog_gui.py28
2 files changed, 17 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 70688fced..6ce6154d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
* kickstart.py (AnacondaKSHandlers.doClearPart): Fix line wrapping
(#213425).
+ * iw/lvm_dialog_gui.py (VolumeGroupEditor.createPEOptionMenu): Always
+ set an active value on the peCombo, and don't traceback if the default
+ value is the first one in the list (#212317).
+
2006-10-31 Chris Lumens <clumens@redhat.com>
* urlinstall.py (UrlInstallMethod.__checkUrlForIsoMounts): Set
diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index 319b801b6..730654f6a 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -241,25 +241,23 @@ class VolumeGroupEditor:
def createPEOptionMenu(self, default=4096):
peCombo = datacombo.DataComboBox()
- idx = 0
- defindex = None
- actualPE = lvm.getPossiblePhysicalExtents(floor=1024)
- for curpe in actualPE:
- # dont show PE over 128M, unless it's the default
- if curpe > 131072 and curpe != default:
- continue
-
+ actualPE = lvm.getPossiblePhysicalExtents(floor=1024)
+ for curpe in actualPE:
+ # don't show PE over 128M, unless it's the default
+ if curpe > 131072 and curpe != default:
+ continue
+
val = self.prettyFormatPESize(curpe)
peCombo.append(val, curpe)
- if default == curpe:
- defindex = idx
-
- idx = idx + 1
-
- if defindex:
- peCombo.set_active(defindex)
+ # First try to set the combo's active value to the default we're
+ # passed. If that doesn't work, just set it to the first one to
+ # prevent TypeErrors everywhere.
+ try:
+ peCombo.set_active(actualPE.index(default))
+ except ValueError:
+ peCombo.set_active(0)
peCombo.set_data("lastidx", peCombo.get_active())
peCombo.connect("changed", self.peChangeCB)