[PATCH 06/13] Implement a function to get container type name
Vratislav Podzimek
vpodzime at redhat.com
Mon Mar 10 13:22:12 UTC 2014
It's better to export a function instead of a dictionary mapping constants to
strings.
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
pyanaconda/ui/gui/spokes/custom.py | 6 +++---
pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.py | 5 +----
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 2afc6e4..8765e01 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -74,7 +74,7 @@ from pyanaconda.ui.gui.spokes.lib.summary import ActionSummaryDialog
from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import size_from_entry, ui_storage_logger
from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import validate_label, validate_mountpoint, selectedRaidLevel
-from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import container_type_names, RAID_NOT_ENOUGH_DISKS
+from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import get_container_type_name, RAID_NOT_ENOUGH_DISKS
from pyanaconda.ui.gui.spokes.lib.custom_storage_helpers import AddDialog, ConfirmDeleteDialog, DisksDialog, ContainerDialog, HelpDialog
from pyanaconda.ui.gui.utils import setViewportBackground, enlightbox, fancy_set_sensitive, ignoreEscape
@@ -1975,7 +1975,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
return
device_type = self._get_current_device_type()
- container_type = _(container_type_names[device_type]).lower()
+ container_type = get_container_type_name(device_type).lower()
new_text = _(new_container_text) % {"container_type": container_type}
if container_name == new_text:
# run the vg editor dialog with a default name and disk set
@@ -2246,7 +2246,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
if container:
container_size_policy = container.size_policy
- container_type_text = _(container_type_names[device_type])
+ container_type_text = get_container_type_name(device_type)
self._containerLabel.set_text(container_type_text.title())
self._containerStore.clear()
if device_type == DEVICE_TYPE_BTRFS:
diff --git a/pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.py b/pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.py
index 32c565d..5288b18 100644
--- a/pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.py
+++ b/pyanaconda/ui/gui/spokes/lib/custom_storage_helpers.py
@@ -370,10 +370,7 @@ class ContainerDialog(GUIObject):
self._grabObjects()
# set up the dialog labels with device-type-specific text
- if self.device_type in CONTAINER_TYPE_NAMES:
- container_type = _(CONTAINER_TYPE_NAMES[self.device_type])
- else:
- container_type = _("container")
+ container_type = get_container_type_name(self.device_type)
title_text = _(CONTAINER_DIALOG_TITLE) % {"container_type": container_type.upper()}
self._title_label.set_text(title_text)
--
1.8.5.3
More information about the anaconda-patches
mailing list