[mapguide-users] Python user scripts for MapGuide Maestro 5.0

Jackie Ng jumpinjackie at gmail.com
Fri Jun 6 01:10:52 PDT 2014


Try something like this:

def UpdateLayerTooltips(conn, folder, tooltip):
    """
    Updates the tooltip of all Layer Definitions under the specified folder
    """
    resList = conn.ResourceService.GetRepositoryResources(folder,
"LayerDefinition")
    for child in resList.Children:
        ldf = conn.ResourceService.GetResource(child.ResourceId)
        print "Updating: %s" % (child.ResourceId)
        ldf.SubLayer.ToolTip = tooltip
        # Save the changes back
        conn.ResourceService.SaveResource(ldf)
        print "Updated tooltip in: %s" % (child.ResourceId)

Usage:

conn = app.GetConnection(app.GetConnectionNames()[0])
UpdateLayerTooltips(conn, "Library://Path/To/My/Layers/",
"MyNewTooltipExpression")



- Jackie



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Python-user-scripts-for-MapGuide-Maestro-5-0-tp5067941p5144349.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list