Ejemplo n.º 1
0
def selectedRaidLevel(raidLevelCombo):
    """Interpret the selection of a RAID level combo box.

       :returns: the selected raid level, None if none selected
       :rtype: instance of blivet.devicelibs.raid.RaidLevel or NoneType
    """
    if not raidLevelCombo.get_property("visible"):
        # the combo is hidden when raid level isn't applicable
        return None

    itr = raidLevelCombo.get_active_iter()
    store = raidLevelCombo.get_model()

    if not itr:
        return

    selected_level = store[itr][1]
    if selected_level == "none":
        return None
    else:
        return raid.getRaidLevel(selected_level)
Ejemplo n.º 2
0
 def _raid_level_visible(self, model, itr, user_data):
     raid_level_str = model[itr][1]
     raid_level = raid.getRaidLevel(raid_level_str) if raid_level_str != "none" else None
     return raid_level in containerRaidLevelsSupported(self.device_type)