Beispiel #1
0
def updatePlugin(currentName: str, newName: str, desc: str):
    plugin = getPlugin(currentName)
    PluginData.objects(id=plugin.id).update_one(set__description=desc,
                                                set__name=newName)
    plugin = getPlugin(newName)

    return plugin.name
Beispiel #2
0
def createPlugin(path: str, pds: str, name: str, desc: str, poi: list):
    plugin = PluginData()
    plugin.name = name
    plugin.predefinedDataSet = pds
    plugin.description = desc
    plugin.path = path
    plugin.pluginPOI = poi
    plugin.save()
Beispiel #3
0
def getPluginPOITypes(pluginName: str):
    plugin = PluginData.objects(name=pluginName).first()

    allPOI = plugin.pluginPOI
    poiNames = []
    for poi in allPOI:
        poiNames.append(poi.type)

    return set(poiNames)
Beispiel #4
0
def getPluginPOI(pluginName: str):
    plugin = PluginData.objects(name=pluginName).first()

    allPOI = plugin.pluginPOI
    pois = []
    for poi in allPOI:
        pois.append(poi)

    return pois
Beispiel #5
0
def deletePOI(pluginName: str, poiName: str):
    plugin = PluginData.objects(name=pluginName).first()

    pois = plugin.pluginPOI

    for poi in pois:
        if poi.name == poiName:
            plugin.pluginPOI.remove(poi)
            plugin.save()
            return
Beispiel #6
0
def updatePOI(pluginName: str, poiName: str, newPOIName: str, type: str,
              return_type: str, data: dict):
    plugin = PluginData.objects(name=pluginName).first()

    pois = plugin.pluginPOI

    for i, poi in enumerate(pois):
        if poi.name == poiName:
            plugin.pluginPOI[i] = createPOI(newPOIName, type, return_type,
                                            data)
            plugin.save()
            return newPOIName
Beispiel #7
0
def getPlugin(name: str):
    plugin = PluginData.objects(name=name).first()
    return plugin
Beispiel #8
0
def addToPlugin(name: str, poi: PluginPOI):
    plugin = PluginData.objects(name=name).first()
    plugin.pluginPOI.append(poi)
    plugin.save()