We should use OrderedDict instead of plain dict if we want to rely on the ordering of its items.
Also don't subtract 1 when getting the autopart type, we subtract 1 in the input method and also the default value is set to reflect that.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/ui/tui/spokes/storage.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py index 66b58a8..714c590 100644 --- a/pyanaconda/ui/tui/spokes/storage.py +++ b/pyanaconda/ui/tui/spokes/storage.py @@ -38,6 +38,8 @@ from pyanaconda.i18n import _, P_
from pykickstart.constants import CLEARPART_TYPE_ALL, CLEARPART_TYPE_LINUX, CLEARPART_TYPE_NONE
+from collections import OrderedDict + import logging log = logging.getLogger("anaconda")
@@ -377,8 +379,8 @@ class PartitionSchemeSpoke(NormalTUISpoke):
def __init__(self, app, data, storage, payload, instclass): NormalTUISpoke.__init__(self, app, data, storage, payload, instclass) - self.partschemes = {"Standard Partition": AUTOPART_TYPE_PLAIN, - "BTRFS": AUTOPART_TYPE_BTRFS, "LVM": AUTOPART_TYPE_LVM} + self.partschemes = OrderedDict([("Standard Partition", AUTOPART_TYPE_PLAIN), + ("LVM", AUTOPART_TYPE_LVM), ("BTRFS", AUTOPART_TYPE_BTRFS)])
@property def indirect(self): @@ -420,7 +422,7 @@ class PartitionSchemeSpoke(NormalTUISpoke):
schemelist = self.partschemes.values() try: - self.data.autopart.type = schemelist[self._selection - 1] + self.data.autopart.type = schemelist[self._selection] except IndexError: # we shouldn't ever see this, but just in case, don't crash. # when autopart.type is detected as None in AutoPartSpoke.apply(),
anaconda-patches@lists.fedorahosted.org