예제 #1
0
def _get_presets_for_config(config_id):
    config_id = str(config_id)
    cfg_presets = []
    for preset_id in mmc.getAvailableConfigs(config_id):
        cfg_preset = MmAnywhere_pb2.MmConfigGroupPreset()
        cfg_preset.presetId = preset_id
        cfg_preset.presetLabel = preset_id
        for i in range(mmc.getConfigData(config_id, preset_id).size()):
            preset_cfg = mmc.getConfigData(config_id, preset_id).getSetting(i)
            cfg_preset.presetPropertyDevices.append(preset_cfg.getDeviceLabel())
            cfg_preset.presetPropertyLabels.append(preset_cfg.getPropertyName())
            cfg_preset.presetPropertyValues.append(preset_cfg.getPropertyValue())
        cfg_presets.append(cfg_preset)
        
    return cfg_presets
예제 #2
0
def _get_config_listing(config_id):
    config_id = str(config_id)
    config = mmc.getAvailableConfigs(config_id)

    config_listing = MmAnywhere_pb2.MmConfigGroup()
    config_listing.configGroupId = config_id
    config_listing.configGroupLabel = config_id
    config_listing.currentPreset = mmc.getCurrentConfig(config_id)
    config_listing.configGroupUrl = url_for('configurations.get_configuration_preset',
                                            config_id=config_id)
    for cfg_preset in _get_presets_for_config(config_id):
        new_preset = config_listing.configGroupPresets.add()
        new_preset.MergeFrom(cfg_preset)

    return config_listing